diff --git a/gui/src/main.cpp b/gui/src/main.cpp index d00627b81ecc5e6ac447d9deab8c2b7c07303906..1abbb199385c8a1bc9157fcc3653804427d1d261 100644 --- a/gui/src/main.cpp +++ b/gui/src/main.cpp @@ -8,12 +8,28 @@ #include <selection_manager.hpp> #include <metadata_manager.hpp> #include <visibility_manager.hpp> +#include <INIReader.h> #include <screendefs.hpp> -#define METADATA_PATH "C:\\Users\\Pascal\\repos\\rbcomb-sample-visualizer\\gui\\resources\\metadata\\" +//#define METADATA_PATH "C:\\Users\\Pascal\\repos\\rbcomb-sample-visualizer\\gui\\resources\\metadata\\" int main(int argc, char** argv) { + INIReader inireader("config.ini"); + if (inireader.ParseError() < 0) { + std::cout << "Can't load config.ini" << std::endl; + return 1; + } + std::string metadata_path = inireader.GetString("paths", "pathMetadata", "NONE"); + std::string models_path = inireader.GetString("paths", "pathModels", "NONE"); + std::string shaders_path = inireader.GetString("paths", "pathShaders", "NONE"); + std::string association_path = inireader.GetString("paths", "pathAssociation", "NONE"); + std::cout << "Config loaded:" << std::endl + << "pathMetadata = " << inireader.GetString("paths", "pathMetadata", "NONE") << std::endl + << "pathModels = " << inireader.GetString("paths", "pathModels", "NONE") << std::endl + << "pathShaders = " << inireader.GetString("paths", "pathShaders", "NONE") << std::endl + << "pathAssociation" << inireader.GetString("paths", "pathAssociation", "NONE") << std::endl; + /*Init Window and OpenGL Context*/ Infrastructure infra; infra.init("RBComb Sample Visualizer", WIDTH, HEIGHT); @@ -42,12 +58,18 @@ int main(int argc, char** argv) { Material mat_drum{ glm::vec4(0.804f, 0.51f, 1.0f, 0.9f), glm::vec4(0.f,0.85f,0.f,1.f), glm::vec4(0.f,0.f,0.15f,1.f), glm::vec4(0.15f,0.f,0.0f,1.f) }; //Load layers - Layer bottom_metal ("Bottom Metal", "C:\\Users\\Pascal\\repos\\rbcomb-sample-visualizer\\data_generation\\python\\models\\bottom_metal_single\\bottom_metal.obj", 0.0f, mat_gold); - Layer bottom_drums ("Bottom Drums", "C:\\Users\\Pascal\\repos\\rbcomb-sample-visualizer\\data_generation\\python\\models\\bottom_drums_single\\bottom_drums.obj", 0.0f, mat_drum); - Layer bottom_silicon ("Bottom Silicon", "C:\\Users\\Pascal\\repos\\rbcomb-sample-visualizer\\data_generation\\python\\models\\bottom_silicon_single\\bottom_silicon.obj", 0.0f, mat_wafer); - Layer top_metal ("Top Metal", "C:\\Users\\Pascal\\repos\\rbcomb-sample-visualizer\\data_generation\\python\\models\\top_metal_single\\top_metal.obj", 0.0f, mat_gold); - Layer top_drums("Top Drums", "C:\\Users\\Pascal\\repos\\rbcomb-sample-visualizer\\data_generation\\python\\models\\top_drums_single\\top_drums.obj", 0.0f, mat_drum); - Layer top_silicon("Top Silicon", "C:\\Users\\Pascal\\repos\\rbcomb-sample-visualizer\\data_generation\\python\\models\\top_silicon_single\\top_silicon.obj", 0.0f, mat_wafer_top); + //Layer bottom_metal ("Bottom Metal", "C:\\Users\\Pascal\\repos\\rbcomb-sample-visualizer\\data_generation\\python\\models\\bottom_metal_single\\bottom_metal.obj", 0.0f, mat_gold); + //Layer bottom_drums ("Bottom Drums", "C:\\Users\\Pascal\\repos\\rbcomb-sample-visualizer\\data_generation\\python\\models\\bottom_drums_single\\bottom_drums.obj", 0.0f, mat_drum); + //Layer bottom_silicon ("Bottom Silicon", "C:\\Users\\Pascal\\repos\\rbcomb-sample-visualizer\\data_generation\\python\\models\\bottom_silicon_single\\bottom_silicon.obj", 0.0f, mat_wafer); + //Layer top_metal ("Top Metal", "C:\\Users\\Pascal\\repos\\rbcomb-sample-visualizer\\data_generation\\python\\models\\top_metal_single\\top_metal.obj", 0.0f, mat_gold); + //Layer top_drums("Top Drums", "C:\\Users\\Pascal\\repos\\rbcomb-sample-visualizer\\data_generation\\python\\models\\top_drums_single\\top_drums.obj", 0.0f, mat_drum); + //Layer top_silicon("Top Silicon", "C:\\Users\\Pascal\\repos\\rbcomb-sample-visualizer\\data_generation\\python\\models\\top_silicon_single\\top_silicon.obj", 0.0f, mat_wafer_top); + Layer bottom_metal("Bottom Metal", models_path + "bottom_metal_single\\bottom_metal.obj", 0.0f, mat_gold); + Layer bottom_drums("Bottom Drums", models_path + "bottom_drums_single\\bottom_drums.obj", 0.0f, mat_drum); + Layer bottom_silicon("Bottom Silicon", models_path + "bottom_silicon_single\\bottom_silicon.obj", 0.0f, mat_wafer); + Layer top_metal("Top Metal", models_path + "top_metal_single\\top_metal.obj", 0.0f, mat_gold); + Layer top_drums("Top Drums", models_path + "top_drums_single\\top_drums.obj", 0.0f, mat_drum); + Layer top_silicon("Top Silicon", models_path + "top_silicon_single\\top_silicon.obj", 0.0f, mat_wafer_top); MetadataManager::addLayer(bottom_metal); MetadataManager::markBottomMetal(bottom_metal.name()); MetadataManager::addLayer(bottom_drums); @@ -356,12 +378,12 @@ int main(int argc, char** argv) { static char input_text[256] = ""; ImGui::InputText("Metadata File", input_text, IM_ARRAYSIZE(input_text)); if (ImGui::Button("Save")) { - std::string path = METADATA_PATH + std::string(input_text); + std::string path = metadata_path + std::string(input_text); MetadataManager::save(path, bottom_metal.name()); } ImGui::SameLine(); if (ImGui::Button("Load")) { - std::string path = METADATA_PATH + std::string(input_text); + std::string path = metadata_path + std::string(input_text); //load data MetadataManager::load(path, bottom_metal.name()); //push data to GPU @@ -380,12 +402,12 @@ int main(int argc, char** argv) { static char input_text2[256] = ""; ImGui::InputText("Metadata File ", input_text2, IM_ARRAYSIZE(input_text2)); if (ImGui::Button("Save ")) { - std::string path = METADATA_PATH + std::string(input_text2); + std::string path = metadata_path + std::string(input_text2); MetadataManager::save(path, bottom_drums.name()); } ImGui::SameLine(); if (ImGui::Button("Load ")) { - std::string path = METADATA_PATH + std::string(input_text2); + std::string path = metadata_path + std::string(input_text2); MetadataManager::load(path, bottom_drums.name()); //push data to GPU bottom_drums.setAllObjectStates(MetadataManager::getLayerData(bottom_drums.name())); @@ -403,12 +425,12 @@ int main(int argc, char** argv) { static char input_text3[256] = ""; ImGui::InputText("Metadata File ", input_text3, IM_ARRAYSIZE(input_text3)); if (ImGui::Button("Save ")) { - std::string path = METADATA_PATH + std::string(input_text3); + std::string path = metadata_path + std::string(input_text3); MetadataManager::save(path, top_metal.name()); } ImGui::SameLine(); if (ImGui::Button("Load ")) { - std::string path = METADATA_PATH + std::string(input_text3); + std::string path = metadata_path + std::string(input_text3); MetadataManager::load(path, top_metal.name()); //push data to GPU top_metal.setAllObjectStates(MetadataManager::getLayerData(top_metal.name())); @@ -426,12 +448,12 @@ int main(int argc, char** argv) { static char input_text4[256] = ""; ImGui::InputText("Metadata File ", input_text4, IM_ARRAYSIZE(input_text4)); if (ImGui::Button("Save ")) { - std::string path = METADATA_PATH + std::string(input_text4); + std::string path = metadata_path + std::string(input_text4); MetadataManager::save(path, top_drums.name()); } ImGui::SameLine(); if (ImGui::Button("Load ")) { - std::string path = METADATA_PATH + std::string(input_text4); + std::string path = metadata_path + std::string(input_text4); MetadataManager::load(path, top_drums.name()); //push data to GPU top_drums.setAllObjectStates(MetadataManager::getLayerData(top_drums.name()));