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

Added materials, added drums and silicon

parent b3e4570b
No related branches found
No related tags found
No related merge requests found
......@@ -34,9 +34,17 @@ int main(int argc, char** argv) {
glm::vec3 upVector(0., 1., 0.);
Camera camera (eye, lookAt, upVector);
//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,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) };
//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);
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);
MetadataManager::addLayer(bottom_metal);
MetadataManager::addLayer(bottom_drums);
std::cout << "Error Code: " << glGetError() << std::endl;
std::cout << "GL_NO_ERROR: " << GL_NO_ERROR << std::endl;
......@@ -77,8 +85,15 @@ int main(int argc, char** argv) {
SelectionManager::selectedLayerName = bottom_metal.name();
}
else {
SelectionManager::selectedIndex = -1;
SelectionManager::selectedLayerName = "";
selected_index = bottom_drums.selectObject(InputState::umpos_x, HEIGHT - InputState::umpos_y, projection, view, model);
if (selected_index != -1) {
SelectionManager::selectedIndex = selected_index;
SelectionManager::selectedLayerName = bottom_drums.name();
}
else {
SelectionManager::selectedIndex = -1;
SelectionManager::selectedLayerName = "";
}
}
#ifndef NDEBUG
std::cout << "Selected object: " << SelectionManager::selectedIndex << std::endl;
......@@ -119,6 +134,9 @@ int main(int argc, char** argv) {
if (SelectionManager::selectedLayerName == bottom_metal.name()) {
bottom_metal.setObjectState(SelectionManager::selectedIndex, object_status);
}
else if (SelectionManager::selectedLayerName == bottom_drums.name()) {
bottom_drums.setObjectState(SelectionManager::selectedIndex, object_status);
}
}
}
ImGui::End();
......@@ -143,24 +161,22 @@ int main(int argc, char** argv) {
//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("Metadata File", input_text, IM_ARRAYSIZE(input_text));
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_text);
MetadataManager::save(path, bottom_metal.name());
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_text);
MetadataManager::load(path, bottom_metal.name());
std::string path = METADATA_PATH + std::string(input_text2);
MetadataManager::load(path, bottom_drums.name());
}
*/
ImGui::End();
//Draw Window
......@@ -183,8 +199,28 @@ int main(int argc, char** argv) {
/*Draw here*/
//Metal layer
//Wafer
if (InputState::space_pressed) { //highlight selection
int tempDrawingMode = 7;
bottom_silicon.draw(projection, view, model, tempDrawingMode, -1);
}
else {
bottom_silicon.draw(projection, view, model, 0, -1);
}
//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);
}
else {
bottom_drums.draw(projection, view, model, draw_mode, selected_index);
}
//Metal layer
selected_index = -1;
if (SelectionManager::selectedLayerName == bottom_metal.name()) {
selected_index = SelectionManager::selectedIndex;
}
......
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