accept config file as program argument

This commit is contained in:
2020-03-18 17:45:24 -04:00
parent 2606f74f70
commit c7c59e08d5
2 changed files with 6 additions and 7 deletions

View File

@@ -7,7 +7,3 @@ groups:
color: [0.3, 0.3, 0.3] color: [0.3, 0.3, 0.3]
exclude: exclude:
- [0, 1, 2] - [0, 1, 2]
wires:
- root: [0.50, 0.05, 0.05, 0.05, 0.01]
color: [0.9, 0.9, 0.9]
curve: true

View File

@@ -180,7 +180,7 @@ struct Wire {
} }
}; };
void run(GLFWwindow *window) { void run(const std::string &config_file, GLFWwindow *window) {
glEnable(GL_DEPTH_TEST); glEnable(GL_DEPTH_TEST);
glEnable(GL_BLEND); glEnable(GL_BLEND);
@@ -199,7 +199,7 @@ void run(GLFWwindow *window) {
.stage(sh.slice) .stage(sh.slice)
.stage(sh.solid); .stage(sh.solid);
auto scene = YAML::LoadFile("presets/default.yaml"); auto scene = YAML::LoadFile(config_file);
auto slices = std::vector<Slice<4>>(); auto slices = std::vector<Slice<4>>();
auto wires = std::vector<Wire>(); auto wires = std::vector<Wire>();
@@ -326,7 +326,10 @@ int main(int argc, char *argv[]) {
std::cout << utilInfo(); std::cout << utilInfo();
run(window); std::string config_file = "presets/default.yaml";
if (argc > 1) config_file = std::string(argv[1]);
run(config_file, window);
glfwTerminate(); glfwTerminate();
return EXIT_SUCCESS; return EXIT_SUCCESS;