MCPcopy Create free account
hub / github.com/RenderKit/embree / drawGUI

Method drawGUI

tutorials/forest/forest.cpp:79–138  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

77#if defined(USE_GLFW)
78
79 void drawGUI() override
80 {
81 if (ImGui::Button("Rebuild")) {
82 mode = 0;
83 g_rebuild = true;
84 }
85 #if defined(RTC_GEOMETRY_INSTANCE_ARRAY)
86 if (ImGui::Checkbox("Use instance arrays", &g_use_instance_array)) {
87 mode = 0;
88 g_rebuild = true;
89 }
90 #endif
91 mode = g_animate ? 1 : 0;
92 ImGui::Checkbox("Animate", &g_animate);
93
94 if (ImGui::SliderInt("Zoom", &focal_length, 24, 120)) {
95 camera.fov = 90.f / std::pow(((float)focal_length) / 24.f, 2.f);
96 }
97
98 ImGui::Text("Build quality:");
99 if (ImGui::RadioButton("Low", &g_build_quality, 0)) { g_build_quality = 0; g_rebuild = true; mode = 0; };
100 ImGui::SameLine();
101 if (ImGui::RadioButton("Medium", &g_build_quality, 1)) { g_build_quality = 1; g_rebuild = true; mode = 0; };
102 ImGui::SameLine();
103 if (ImGui::RadioButton("High", &g_build_quality, 2)) { g_build_quality = 2; g_rebuild = true; mode = 0; };
104
105 ImGui::Text("Samples per pixel:");
106 if (ImGui::RadioButton("1", &g_spp, 1)) { g_spp = 1; };
107 ImGui::SameLine();
108 if (ImGui::RadioButton("4", &g_spp, 2)) { g_spp = 2; };
109 ImGui::SameLine();
110 if (ImGui::RadioButton("9", &g_spp, 3)) { g_spp = 3; };
111
112 ImGui::Text("Number of trees/instances:");
113 if (ImGui::RadioButton("250k", &g_complexity, 0)) { g_complexity = 0; g_rebuild = true; mode = 0; };
114 ImGui::SameLine();
115 if (ImGui::RadioButton("500k", &g_complexity, 1)) { g_complexity = 1; g_rebuild = true; mode = 0; };
116 ImGui::SameLine();
117 if (ImGui::RadioButton("1000k", &g_complexity, 2)) { g_complexity = 2; g_rebuild = true; mode = 0; };
118 ImGui::SameLine();
119 if (ImGui::RadioButton("4000k", &g_complexity, 3)) { g_complexity = 3; g_rebuild = true; mode = 0; };
120
121 const char* types[] = { "Tree1", "Tree2", "Tree3", "Tree4", "Tree5", "Tree6" };
122 ImGui::Text("Trees:");
123 if (ImGui::Combo("Slot 1", &g_trees[0], types, IM_ARRAYSIZE(types))) { g_trees_changed = true; mode = 1; };
124 if (ImGui::Combo("Slot 2", &g_trees[1], types, IM_ARRAYSIZE(types))) { g_trees_changed = true; mode = 1; };
125 if (ImGui::Combo("Slot 3", &g_trees[2], types, IM_ARRAYSIZE(types))) { g_trees_changed = true; mode = 1; };
126 if (ImGui::Combo("Slot 4", &g_trees[3], types, IM_ARRAYSIZE(types))) { g_trees_changed = true; mode = 1; };
127 if (ImGui::Combo("Slot 5", &g_trees[4], types, IM_ARRAYSIZE(types))) { g_trees_changed = true; mode = 1; };
128 if (ImGui::Combo("Slot 6", &g_trees[5], types, IM_ARRAYSIZE(types))) { g_trees_changed = true; mode = 1; };
129
130 ImGui::Text("%s", ("Memory consumption: " + std::to_string(g_memory_consumed/1024/1024) + " MB").c_str());
131 if (mode == 0) ImGui::Text("Build timings:");
132 else ImGui::Text("Update timings:");
133 ImGui::Text(" Scene Data %d ms", get_milliseconds(g_cycles_objects));
134 ImGui::Text(" Embree Data %d ms", get_milliseconds(g_cycles_embree_objects));
135 ImGui::Text(" Embree BVH %d ms", get_milliseconds(g_cycles_embree_bvh_build));
136 if (mode == 0) ImGui::Text(" Cleanup old scene data %d ms", get_milliseconds(g_cycles_cleanup));

Callers

nothing calls this directly

Calls 4

get_millisecondsFunction · 0.85
powFunction · 0.50
to_stringFunction · 0.50
c_strMethod · 0.45

Tested by

no test coverage detected