From 43e971588e08db4ed407e4fa00f37edf659f17c0 Mon Sep 17 00:00:00 2001 From: Pascal <engelerp@phys.ethz.ch> Date: Tue, 15 Aug 2023 16:15:51 +0200 Subject: [PATCH] Top layer drawing, tooltip opacity, bottom electrode assignment displaying --- gui/src/main.cpp | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/gui/src/main.cpp b/gui/src/main.cpp index f6036b5..d00627b 100644 --- a/gui/src/main.cpp +++ b/gui/src/main.cpp @@ -49,6 +49,7 @@ int main(int argc, char** argv) { 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); MetadataManager::addLayer(bottom_metal); + MetadataManager::markBottomMetal(bottom_metal.name()); MetadataManager::addLayer(bottom_drums); MetadataManager::addLayer(top_metal); MetadataManager::addLayer(top_drums); @@ -60,6 +61,7 @@ int main(int argc, char** argv) { std::cout << "GL_INVALID_OPERATION: " << GL_INVALID_OPERATION << std::endl; std::cout << "GL_INVALID_FRAMEBUFFER_OPERATION: " << GL_INVALID_FRAMEBUFFER_OPERATION << std::endl; std::cout << "GL_OUT_OF_MEMORY: " << GL_OUT_OF_MEMORY << std::endl; + std::cout << "GL_MAX_TEXTURE_SIZE: " << GL_MAX_TEXTURE_SIZE << std::endl; glm::mat4 projection = glm::perspective(glm::radians(45.f), static_cast<float>(WIDTH) / static_cast<float>(HEIGHT), 0.1f, 200.0f); @@ -140,6 +142,9 @@ int main(int argc, char** argv) { } } } + else if (InputState::t_click) { + VisibilityManager::enableTop = !VisibilityManager::enableTop; + } else if (InputState::lmb_click) { //select object int selected_index = VisibilityManager::enableTop ? top_metal.selectObject(InputState::umpos_x, HEIGHT - InputState::umpos_y, projection, view, model) : -1; @@ -265,6 +270,7 @@ int main(int argc, char** argv) { /*Hover Tooltip*/ if (SelectionManager::hoveredIndex != -1) { + ImGui::SetNextWindowBgAlpha(0.5); ImGui::BeginTooltip(); std::string tool_tip_str = "Layer: " + SelectionManager::hoveredLayerName + "\n"; tool_tip_str += "Index: " + std::to_string(SelectionManager::hoveredIndex) + "\n"; @@ -297,7 +303,11 @@ int main(int argc, char** argv) { text = "Selected Object: " + std::to_string(SelectionManager::selectedIndex); ImGui::Text(text.c_str()); if (SelectionManager::selectedIndex != -1) { - int object_status = MetadataManager::getData(SelectionManager::selectedLayerName, SelectionManager::selectedIndex).status; + ObjectMetadata metaDataObj = MetadataManager::getData(SelectionManager::selectedLayerName, SelectionManager::selectedIndex); + ImGui::Text("Assignment:"); + ImGui::Text(metaDataObj.info.c_str()); + ImGui::NewLine(); + int object_status = metaDataObj.status; text = "Status: "; ImGui::Text(text.c_str()); ImGui::SameLine(); @@ -337,7 +347,6 @@ int main(int argc, char** argv) { //Layer Window ImGui::Begin("Layers"); - ImGui::NewLine(); //BOTTOM METAL text = "Layer: " + bottom_metal.name(); @@ -448,11 +457,15 @@ int main(int argc, char** argv) { //Draw Window ImGui::Begin("Draw"); ImGui::RadioButton("Realistic", &draw_mode, 0); + ImGui::SameLine(); ImGui::RadioButton("Identification", &draw_mode, 1); ImGui::RadioButton("Good", &draw_mode, 2); + ImGui::SameLine(); ImGui::RadioButton("Bad", &draw_mode, 3); + ImGui::SameLine(); ImGui::RadioButton("Sketch", &draw_mode, 4); ImGui::RadioButton("Good-Bad-Sketch", &draw_mode, 5); + ImGui::SameLine(); ImGui::RadioButton("Normal-Bad", &draw_mode, 6); ImGui::RadioButton("Highlight", &draw_mode, 7); ImGui::End(); @@ -535,6 +548,20 @@ int main(int argc, char** argv) { else { top_silicon.draw(projection, view, model, 0, -1, VisibilityManager::topOpacity()); } + //Top Metal layer, draw on top if not mirrored + if (!top_mirrored) { + selected_index = -1; + if (SelectionManager::selectedLayerName == top_metal.name()) { + selected_index = SelectionManager::selectedIndex; + } + if (InputState::space_pressed) { //highlight selection + int tempDrawingMode = 7; + top_metal.draw(projection, view, model, tempDrawingMode, selected_index, VisibilityManager::topOpacity()); + } + else { + top_metal.draw(projection, view, model, draw_mode, selected_index, VisibilityManager::topOpacity()); + } + } } -- GitLab