Skip to content
Snippets Groups Projects
Commit bfaeadff authored by Pascal Engeler's avatar Pascal Engeler
Browse files

Added GUI windows, included metadata management, metadata path

parent 1cc91cc5
No related branches found
No related tags found
No related merge requests found
......@@ -6,9 +6,12 @@
#include <imgui_bundle.hpp>
#include <input_state.hpp>
#include <selection_manager.hpp>
#include <metadata_manager.hpp>
#include <screendefs.hpp>
#define METADATA_PATH "C:\\Users\\Pascal\\repos\\rbcomb-sample-visualizer\\gui\\resources\\metadata\\"
int main(int argc, char** argv) {
/*Init Window and OpenGL Context*/
Infrastructure infra;
......@@ -33,6 +36,7 @@ int main(int argc, char** argv) {
//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.f);
MetadataManager::addLayer(bottom_metal);
std::cout << "Error Code: " << glGetError() << std::endl;
std::cout << "GL_NO_ERROR: " << GL_NO_ERROR << std::endl;
......@@ -47,6 +51,8 @@ int main(int argc, char** argv) {
glm::mat4 view = camera.GetViewMatrix();
glm::mat4 model = glm::mat4(1.0f);
int draw_mode = 0;
size_t count = 0;
auto start = std::chrono::high_resolution_clock::now();
while (!InputState::should_quit) {
......@@ -97,33 +103,68 @@ int main(int argc, char** argv) {
ImGui::Text(text.c_str());
text = "Selected Object: " + std::to_string(SelectionManager::selectedIndex);
ImGui::Text(text.c_str());
int object_status;
text = "Status: ";
ImGui::Text(text.c_str());
ImGui::SameLine();
ImGui::RadioButton("Good", &object_status, 0);
ImGui::SameLine();
ImGui::RadioButton("Sketch", &object_status, 1);
ImGui::SameLine();
ImGui::RadioButton("Broken", &object_status, 2);
if (SelectionManager::selectedIndex != -1) {
int object_status = MetadataManager::getData(SelectionManager::selectedLayerName, SelectionManager::selectedIndex).status;
text = "Status: ";
ImGui::Text(text.c_str());
ImGui::SameLine();
ImGui::RadioButton("Good", &object_status, 0);
ImGui::SameLine();
ImGui::RadioButton("Sketch", &object_status, 1);
ImGui::SameLine();
ImGui::RadioButton("Broken", &object_status, 2);
if (object_status != MetadataManager::getData(SelectionManager::selectedLayerName, SelectionManager::selectedIndex).status) {
MetadataManager::getData(SelectionManager::selectedLayerName, SelectionManager::selectedIndex).status = object_status;
//Update layer data here, and push to GPU
if (SelectionManager::selectedLayerName == bottom_metal.name()) {
bottom_metal.setObjectState(SelectionManager::selectedIndex, object_status);
}
}
}
ImGui::End();
//Data Window
ImGui::Begin("Data");
//Layer Window
ImGui::Begin("Layers");
text = "Layer: " + bottom_metal.name();
ImGui::Text(text.c_str());
text = "Objects: " + std::to_string(bottom_metal.numObjects());
ImGui::Text(text.c_str());
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);
MetadataManager::save(path, bottom_metal.name());
}
ImGui::SameLine();
if (ImGui::Button("Load")) {
std::string path = METADATA_PATH + std::string(input_text);
//load data
MetadataManager::load(path, bottom_metal.name());
//push data to GPU
bottom_metal.setAllObjectStates(MetadataManager::getLayerData(bottom_metal.name()));
}
/*
ImGui::Separator();
text = "Layer: " + bottom_drums.name();
ImGui::Text(text.c_str());
text = "Objects: " + std::to_string(bottom_drums.numObjects());
ImGui::Text(text.c_str());
char input_text[256];
ImGui::InputText("Filename", input_text, IM_ARRAYSIZE(input_text));
ImGui::InputText("Metadata File", input_text, IM_ARRAYSIZE(input_text));
if (ImGui::Button("Save")) {
//save file here
std::string path = METADATA_PATH + std::string(input_text);
MetadataManager::save(path, bottom_metal.name());
}
ImGui::SameLine();
if (ImGui::Button("Load")) {
//load file here
std::string path = METADATA_PATH + std::string(input_text);
MetadataManager::load(path, bottom_metal.name());
}
*/
ImGui::End();
//Draw Window
ImGui::Begin("Draw");
int draw_mode;
ImGui::RadioButton("Realistic", &draw_mode, 0);
ImGui::RadioButton("Identification", &draw_mode, 1);
ImGui::RadioButton("Good", &draw_mode, 2);
......@@ -142,8 +183,7 @@ int main(int argc, char** argv) {
/*Draw here*/
int drawing_mode = 0;
//layer 0
//Metal layer
int selected_index = -1;
if (SelectionManager::selectedLayerName == bottom_metal.name()) {
selected_index = SelectionManager::selectedIndex;
......@@ -153,7 +193,7 @@ int main(int argc, char** argv) {
bottom_metal.draw(projection, view, model, tempDrawingMode, selected_index);
}
else {
bottom_metal.draw(projection, view, model, drawing_mode, selected_index);
bottom_metal.draw(projection, view, model, draw_mode, selected_index);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment