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

Added top wafer, stack enabling, more controls, control bugfixes

parent 24cd401a
No related branches found
No related tags found
No related merge requests found
......@@ -38,14 +38,20 @@ int main(int argc, char** argv) {
//Define materials
Material mat_gold{ glm::vec4(255.f / 256.f, 215.f / 256.f, 0.f, 1.f), glm::vec4(0.f,1.f,0.f,1.f), glm::vec4(0.f,0.f,0.3f,1.f), glm::vec4(0.3f,0.f,0.0f,1.f) };
Material mat_wafer{ glm::vec4(0.561f, 0.51f, 1.0f, 1.f), glm::vec4(0.f,1.f,0.f,1.f), glm::vec4(0.f,0.f,0.3f,1.f), glm::vec4(0.3f,0.f,0.0f,1.f) };
Material mat_drum{ glm::vec4(0.804f, 0.51f, 1.0f, 1.0f), 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) };
Material mat_wafer_top{ glm::vec4(0.461f, 0.41f, 9.0f, 1.f), glm::vec4(0.f,1.f,0.f,1.f), glm::vec4(0.f,0.f,0.3f,1.f), glm::vec4(0.3f,0.f,0.0f,1.f) };
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 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);
MetadataManager::addLayer(bottom_metal);
MetadataManager::addLayer(bottom_drums);
MetadataManager::addLayer(top_metal);
MetadataManager::addLayer(top_drums);
std::cout << "Error Code: " << glGetError() << std::endl;
std::cout << "GL_NO_ERROR: " << GL_NO_ERROR << std::endl;
......@@ -62,6 +68,8 @@ int main(int argc, char** argv) {
int draw_mode = 0;
bool top_mirrored = false;
size_t count = 0;
auto start = std::chrono::high_resolution_clock::now();
while (!InputState::should_quit) {
......@@ -88,6 +96,12 @@ int main(int argc, char** argv) {
else if (SelectionManager::selectedLayerName == bottom_drums.name()) {
bottom_drums.setObjectState(SelectionManager::selectedIndex, 0);
}
else if (SelectionManager::selectedLayerName == top_metal.name()) {
top_metal.setObjectState(SelectionManager::selectedIndex, 0);
}
else if (SelectionManager::selectedLayerName == top_drums.name()) {
top_drums.setObjectState(SelectionManager::selectedIndex, 0);
}
}
}
else if (InputState::s_click) {
......@@ -100,6 +114,12 @@ int main(int argc, char** argv) {
else if (SelectionManager::selectedLayerName == bottom_drums.name()) {
bottom_drums.setObjectState(SelectionManager::selectedIndex, 1);
}
else if (SelectionManager::selectedLayerName == top_metal.name()) {
top_metal.setObjectState(SelectionManager::selectedIndex, 1);
}
else if (SelectionManager::selectedLayerName == top_drums.name()) {
top_drums.setObjectState(SelectionManager::selectedIndex, 1);
}
}
}
else if (InputState::b_click) {
......@@ -112,24 +132,44 @@ int main(int argc, char** argv) {
else if (SelectionManager::selectedLayerName == bottom_drums.name()) {
bottom_drums.setObjectState(SelectionManager::selectedIndex, 2);
}
else if (SelectionManager::selectedLayerName == top_metal.name()) {
top_metal.setObjectState(SelectionManager::selectedIndex, 2);
}
else if (SelectionManager::selectedLayerName == top_drums.name()) {
top_drums.setObjectState(SelectionManager::selectedIndex, 2);
}
}
}
else if (InputState::lmb_click) {
//select object
int selected_index = bottom_metal.selectObject(InputState::umpos_x, HEIGHT - InputState::umpos_y, projection, view, model);
int selected_index = VisibilityManager::enableTop ? top_metal.selectObject(InputState::umpos_x, HEIGHT - InputState::umpos_y, projection, view, model) : -1;
if (selected_index != -1) {
SelectionManager::selectedIndex = selected_index;
SelectionManager::selectedLayerName = bottom_metal.name();
SelectionManager::selectedLayerName = top_metal.name();
}
else {
selected_index = bottom_drums.selectObject(InputState::umpos_x, HEIGHT - InputState::umpos_y, projection, view, model);
selected_index = VisibilityManager::enableTop ? top_drums.selectObject(InputState::umpos_x, HEIGHT - InputState::umpos_y, projection, view, model) : -1;
if (selected_index != -1) {
SelectionManager::selectedIndex = selected_index;
SelectionManager::selectedLayerName = bottom_drums.name();
SelectionManager::selectedLayerName = top_drums.name();
}
else {
SelectionManager::selectedIndex = -1;
SelectionManager::selectedLayerName = "";
else{
selected_index = VisibilityManager::enableBottom ? bottom_metal.selectObject(InputState::umpos_x, HEIGHT - InputState::umpos_y, projection, view, model) : -1;
if (selected_index != -1) {
SelectionManager::selectedIndex = selected_index;
SelectionManager::selectedLayerName = bottom_metal.name();
}
else {
selected_index = VisibilityManager::enableBottom ? bottom_drums.selectObject(InputState::umpos_x, HEIGHT - InputState::umpos_y, projection, view, model) : -1;
if (selected_index != -1) {
SelectionManager::selectedIndex = selected_index;
SelectionManager::selectedLayerName = bottom_drums.name();
}
else {
SelectionManager::selectedIndex = -1;
SelectionManager::selectedLayerName = "";
}
}
}
}
#ifndef NDEBUG
......@@ -195,14 +235,26 @@ int main(int argc, char** argv) {
camera.ProcessMouseZoom(1);
}
}
SelectionManager::hoveredIndex = bottom_metal.selectObject(InputState::umpos_x, HEIGHT - InputState::umpos_y, projection, view, model);
SelectionManager::hoveredIndex = VisibilityManager::enableTop ? top_metal.selectObject(InputState::umpos_x, HEIGHT - InputState::umpos_y, projection, view, model) : -1;
if (SelectionManager::hoveredIndex != -1) {
SelectionManager::hoveredLayerName = bottom_metal.name();
SelectionManager::hoveredLayerName = top_metal.name();
}
else {
SelectionManager::hoveredIndex = bottom_drums.selectObject(InputState::umpos_x, HEIGHT - InputState::umpos_y, projection, view, model);
SelectionManager::hoveredIndex = VisibilityManager::enableTop ? top_drums.selectObject(InputState::umpos_x, HEIGHT - InputState::umpos_y, projection, view, model) : -1;
if (SelectionManager::hoveredIndex != -1) {
SelectionManager::hoveredLayerName = bottom_drums.name();
SelectionManager::hoveredLayerName = top_drums.name();
}
else {
SelectionManager::hoveredIndex = VisibilityManager::enableBottom ? bottom_metal.selectObject(InputState::umpos_x, HEIGHT - InputState::umpos_y, projection, view, model) : -1;
if (SelectionManager::hoveredIndex != -1) {
SelectionManager::hoveredLayerName = bottom_metal.name();
}
else {
SelectionManager::hoveredIndex = VisibilityManager::enableBottom ? bottom_drums.selectObject(InputState::umpos_x, HEIGHT - InputState::umpos_y, projection, view, model) : -1;
if (SelectionManager::hoveredIndex != -1) {
SelectionManager::hoveredLayerName = bottom_drums.name();
}
}
}
}
......@@ -263,6 +315,12 @@ int main(int argc, char** argv) {
else if (SelectionManager::selectedLayerName == bottom_drums.name()) {
bottom_drums.setObjectState(SelectionManager::selectedIndex, object_status);
}
else if (SelectionManager::selectedLayerName == top_metal.name()) {
top_metal.setObjectState(SelectionManager::selectedIndex, object_status);
}
else if (SelectionManager::selectedLayerName == top_drums.name()) {
top_drums.setObjectState(SelectionManager::selectedIndex, object_status);
}
}
}
ImGui::NewLine();
......@@ -279,11 +337,14 @@ int main(int argc, char** argv) {
//Layer Window
ImGui::Begin("Layers");
ImGui::NewLine();
//BOTTOM METAL
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];
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);
......@@ -297,29 +358,91 @@ int main(int argc, char** argv) {
//push data to GPU
bottom_metal.setAllObjectStates(MetadataManager::getLayerData(bottom_metal.name()));
}
ImGui::NewLine();
ImGui::Separator();
ImGui::NewLine();
//BOTTOM DRUMS
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_text2[256];
static char input_text2[256] = "";
ImGui::InputText("Metadata File ", input_text2, IM_ARRAYSIZE(input_text2));
if (ImGui::Button("Save2")) {
if (ImGui::Button("Save ")) {
std::string path = METADATA_PATH + std::string(input_text2);
MetadataManager::save(path, bottom_drums.name());
}
ImGui::SameLine();
if (ImGui::Button("Load2")) {
if (ImGui::Button("Load ")) {
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()));
}
ImGui::NewLine();
ImGui::Separator();
ImGui::Separator();
ImGui::NewLine();
//TOP METAL
text = "Layer: " + top_metal.name();
ImGui::Text(text.c_str());
text = "Objects: " + std::to_string(top_metal.numObjects());
ImGui::Text(text.c_str());
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);
MetadataManager::save(path, top_metal.name());
}
ImGui::SameLine();
if (ImGui::Button("Load ")) {
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()));
}
ImGui::NewLine();
ImGui::Separator();
ImGui::NewLine();
//TOP DRUMS
text = "Layer: " + top_drums.name();
ImGui::Text(text.c_str());
text = "Objects: " + std::to_string(top_drums.numObjects());
ImGui::Text(text.c_str());
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);
MetadataManager::save(path, top_drums.name());
}
ImGui::SameLine();
if (ImGui::Button("Load ")) {
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()));
}
ImGui::NewLine();
ImGui::Separator();
ImGui::Separator();
ImGui::NewLine();
ImGui::Text("Controls");
ImGui::NewLine();
ImGui::Text("Bottom Top");
ImGui::SliderFloat("Opacity Mixer", &VisibilityManager::opacityMixer, 0.f, 1.f);
ImGui::Checkbox("Mirror Top", &top_mirrored);
top_metal.setMirrorState(top_mirrored);
top_drums.setMirrorState(top_mirrored);
top_silicon.setMirrorState(top_mirrored);
ImGui::Checkbox("Enable Top", &VisibilityManager::enableTop);
ImGui::SameLine();
ImGui::Checkbox("Enable Bottom", &VisibilityManager::enableBottom);
ImGui::End();
//Draw Window
......@@ -342,38 +465,78 @@ int main(int argc, char** argv) {
/*Draw here*/
//Wafer
if (InputState::space_pressed) { //highlight selection
int tempDrawingMode = 7;
bottom_silicon.draw(projection, view, model, tempDrawingMode, -1, VisibilityManager::bottomOpacity());
}
else {
bottom_silicon.draw(projection, view, model, 0, -1, VisibilityManager::bottomOpacity());
}
//Drum layer
int selected_index = -1;
if (SelectionManager::selectedLayerName == bottom_drums.name()) {
selected_index = SelectionManager::selectedIndex;
}
if (InputState::space_pressed) { //highlight selection
int tempDrawingMode = 7;
bottom_drums.draw(projection, view, model, tempDrawingMode, selected_index, VisibilityManager::bottomOpacity());
}
else {
bottom_drums.draw(projection, view, model, draw_mode, selected_index, VisibilityManager::bottomOpacity());
}
//Metal layer
selected_index = -1;
if (SelectionManager::selectedLayerName == bottom_metal.name()) {
selected_index = SelectionManager::selectedIndex;
}
if (InputState::space_pressed) { //highlight selection
int tempDrawingMode = 7;
bottom_metal.draw(projection, view, model, tempDrawingMode, selected_index, VisibilityManager::bottomOpacity());
//Bottom Stack
if (VisibilityManager::enableBottom) {
//Bottom Wafer
if (InputState::space_pressed) { //highlight selection
int tempDrawingMode = 7;
bottom_silicon.draw(projection, view, model, tempDrawingMode, -1, VisibilityManager::bottomOpacity());
}
else {
bottom_silicon.draw(projection, view, model, 0, -1, VisibilityManager::bottomOpacity());
}
//Bottom Drum layer
int selected_index = -1;
if (SelectionManager::selectedLayerName == bottom_drums.name()) {
selected_index = SelectionManager::selectedIndex;
}
if (InputState::space_pressed) { //highlight selection
int tempDrawingMode = 7;
bottom_drums.draw(projection, view, model, tempDrawingMode, selected_index, VisibilityManager::bottomOpacity());
}
else {
bottom_drums.draw(projection, view, model, draw_mode, selected_index, VisibilityManager::bottomOpacity());
}
//Bottom Metal layer
selected_index = -1;
if (SelectionManager::selectedLayerName == bottom_metal.name()) {
selected_index = SelectionManager::selectedIndex;
}
if (InputState::space_pressed) { //highlight selection
int tempDrawingMode = 7;
bottom_metal.draw(projection, view, model, tempDrawingMode, selected_index, VisibilityManager::bottomOpacity());
}
else {
bottom_metal.draw(projection, view, model, draw_mode, selected_index, VisibilityManager::bottomOpacity());
}
}
else {
bottom_metal.draw(projection, view, model, draw_mode, selected_index, VisibilityManager::bottomOpacity());
//Top Stack
if (VisibilityManager::enableTop) {
//Top Drum layer
int selected_index = -1;
if (SelectionManager::selectedLayerName == top_drums.name()) {
selected_index = SelectionManager::selectedIndex;
}
if (InputState::space_pressed) { //highlight selection
int tempDrawingMode = 7;
top_drums.draw(projection, view, model, tempDrawingMode, selected_index, VisibilityManager::topOpacity());
}
else {
top_drums.draw(projection, view, model, draw_mode, selected_index, VisibilityManager::topOpacity());
}
//Top Metal layer
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());
}
//Top Wafer
if (InputState::space_pressed) { //highlight selection
int tempDrawingMode = 7;
top_silicon.draw(projection, view, model, tempDrawingMode, -1, VisibilityManager::topOpacity());
}
else {
top_silicon.draw(projection, view, model, 0, -1, VisibilityManager::topOpacity());
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment