Visual Computing Library  devel
Loading...
Searching...
No Matches
mesh_viewer_imgui_drawer.h
1/*****************************************************************************
2 * VCLib *
3 * Visual Computing Library *
4 * *
5 * Copyright(C) 2021-2025 *
6 * Visual Computing Lab *
7 * ISTI - Italian National Research Council *
8 * *
9 * All rights reserved. *
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the Mozilla Public License Version 2.0 as published *
13 * by the Mozilla Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 * This program is distributed in the hope that it will be useful, *
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
19 * Mozilla Public License Version 2.0 *
20 * (https://www.mozilla.org/en-US/MPL/2.0/) for more details. *
21 ****************************************************************************/
22
23#ifndef VCL_IMGUI_MESH_VIEWER_IMGUI_DRAWER_H
24#define VCL_IMGUI_MESH_VIEWER_IMGUI_DRAWER_H
25
26#include "imgui_helpers.h"
27
28#include <vclib/render/drawable/drawable_mesh.h>
29#include <vclib/render/drawers/trackball_viewer_drawer.h>
30
31#include <imgui.h>
32
33#include <algorithm>
34#include <iterator>
35#include <numeric>
36
37namespace vcl::imgui {
38
39template<typename DerivedRenderApp>
41 public vcl::TrackBallViewerDrawer<DerivedRenderApp>
42{
44
45 // selected mesh index
46 int mMeshIndex = 0;
47
48public:
49 using Base::Base;
50
51 virtual void onDraw(vcl::uint viewId) override
52 {
53 // draw parent
54 Base::onDraw(viewId);
55
56 // draw imgui
57 ImGui::Begin("Meshes");
58
59 // mesh table
60 {
63 ImGui::BeginChild(
64 "##ListContainer",
65 ImVec2(ImGui::GetContentRegionAvail().x, 260),
68 drawMeshList();
69 ImGui::EndChild();
70 }
71
72 // combo box for pbr mode
73 ImGui::Separator();
74 ImGui::Text("Render Mode:");
75 ImGui::SameLine();
76 const char* renderModeNames[] = {"Classic", "PBR"};
77 bool pbrMode = Base::isPBREnabled();
78 ImGui::SetNextItemWidth(80);
79 if (ImGui::BeginCombo(
80 "##ComboRenderMode",
81 pbrMode ? renderModeNames[1] : renderModeNames[0])) {
82 for (int n = 0; n < IM_ARRAYSIZE(renderModeNames); n++) {
83 bool isSelected = (pbrMode && n == 1) || (!pbrMode && n == 0);
84 if (ImGui::Selectable(renderModeNames[n], isSelected)) {
85 Base::setPBR(n == 1);
86 }
87 if (isSelected)
88 ImGui::SetItemDefaultFocus();
89 }
90 ImGui::EndCombo();
91 }
92
93 // drawable mesh info and settings for selected mesh
94 if (mMeshIndex >= 0 && mMeshIndex < Base::mDrawList->size()) {
95 auto drawable =
96 std::dynamic_pointer_cast<vcl::AbstractDrawableMesh>(
97 Base::mDrawList->at(mMeshIndex));
98 if (drawable) {
99 drawMeshSettings(*drawable);
100 }
101 }
102
103 ImGui::End();
104 }
105
106 void onMousePress(
107 MouseButton::Enum button,
108 double x,
109 double y,
110 const KeyModifiers& modifiers) override
111 {
112 if (button == MouseButton::RIGHT) {
113 this->readIdRequest(x, y, [&](uint id) {
114 if (id == UINT_NULL)
115 return;
116
117 mMeshIndex = id;
118 std::cout << "Selected ID: " << id << std::endl;
119 });
120 }
121
122 Base::onMousePress(button, x, y, modifiers);
123 }
124
125private:
126 void drawMeshList()
127 {
128 if (!Base::mDrawList || Base::mDrawList->empty()) {
129 ImGui::Text("No objects loaded");
130 return;
131 }
132
133 int meshId = 0;
135 if (ImGui::BeginTable("meshtable", 2, meshTableFlags)) {
136 ImGui::TableSetupColumn(
138 ImGui::TableSetupColumn("Name", ImGuiTableColumnFlags_WidthStretch);
139 for (auto& d : *(Base::mDrawList)) {
140 auto& drawable = *d;
141 ImGui::TableNextRow();
142
143 ImGui::PushID(meshId++);
144
145 ImGui::TableSetColumnIndex(0);
146
147 // visibility checkbox
148 ImGui::Checkbox(
149 "##Visible",
150 [&] {
151 return drawable.isVisible();
152 },
153 [&](bool vis) {
154 drawable.setVisibility(vis);
155 });
156
157 ImGui::TableSetColumnIndex(1);
158
159 // row selection
160 bool isSelected = (mMeshIndex == meshId - 1);
161 if (ImGui::Selectable(
162 drawable.name().c_str(),
163 isSelected,
165 mMeshIndex = meshId - 1;
166 }
167 // tooltip with info
168 if (!drawable.info().empty() &&
169 ImGui::IsItemHovered(ImGuiHoveredFlags_ForTooltip)) {
170 ImGui::BeginTooltip();
171 ImGui::Text("%s", drawable.info().c_str());
172 ImGui::EndTooltip();
173 }
174 ImGui::PopID();
175 }
176 ImGui::EndTable();
177 }
178 }
179
180 static void drawMeshPointSettings(
182 vcl::MeshRenderSettings& settings)
183 {
185
186 ImGui::BeginDisabled(!settings.canPoints(VISIBLE));
187
188 // visibility
189 ImGui::Checkbox(
190 "Visible",
191 [&] {
192 return settings.isPoints(VISIBLE);
193 },
194 [&](bool vis) {
195 settings.setPoints(VISIBLE, vis);
196 });
197
198 // shape
199 ImGui::Text("Shape:");
200 ImGui::SameLine();
201 ImGui::RadioButton(
202 "Circle",
203 [&] {
204 return settings.isPoints(SHAPE_CIRCLE);
205 },
206 [&](bool v) {
207 if (v)
208 settings.setPoints(SHAPE_CIRCLE);
209 });
210 ImGui::SameLine();
211 ImGui::RadioButton(
212 "Pixel",
213 [&] {
214 return settings.isPoints(SHAPE_PIXEL);
215 },
216 [&](bool v) {
217 if (v)
218 settings.setPoints(SHAPE_PIXEL);
219 });
220
221 // shading
222 ImGui::Text("Shading:");
223 ImGui::SameLine();
224 ImGui::BeginDisabled(!settings.canPoints(SHADING_VERT));
225 ImGui::RadioButton(
226 "Vertex",
227 [&] {
228 return settings.isPoints(SHADING_VERT);
229 },
230 [&](bool v) {
231 if (v)
232 settings.setPoints(SHADING_VERT);
233 });
234 ImGui::SameLine();
235 ImGui::EndDisabled();
236 ImGui::RadioButton(
237 "None",
238 [&] {
239 return settings.isPoints(SHADING_NONE);
240 },
241 [&](bool vis) {
242 if (vis)
243 settings.setPoints(SHADING_NONE);
244 });
245
246 // color
247 ImGui::Text("Color:");
248 ImGui::SameLine();
249 const char* pointColorNames[] = {"Vertex", "Mesh", "User"};
250 const std::array<bool, 3> colorSelected = {
251 settings.isPoints(COLOR_VERTEX),
252 settings.isPoints(COLOR_MESH),
253 settings.isPoints(COLOR_USER)};
254
255 assert(
256 std::accumulate(
257 std::begin(colorSelected), std::end(colorSelected), 0) == 1);
258 int idx = std::distance(
259 std::begin(colorSelected),
260 std::find(
261 std::begin(colorSelected), std::end(colorSelected), true));
262 assert(idx >= 0 && idx < 3);
263
264 ImGui::SetNextItemWidth(-40);
265 if (ImGui::BeginCombo("##ComboPointColor", pointColorNames[idx])) {
266 for (int n = 0; n < IM_ARRAYSIZE(pointColorNames); n++) {
267 const bool selected = (n == idx);
268
269 switch (n) {
270 case 0:
271 ImGui::BeginDisabled(!settings.canPoints(COLOR_VERTEX));
272 if (ImGui::Selectable(pointColorNames[n], selected))
273 settings.setPoints(COLOR_VERTEX);
274 ImGui::EndDisabled();
275 break;
276 case 1:
277 ImGui::BeginDisabled(!settings.canPoints(COLOR_MESH));
278 if (ImGui::Selectable(pointColorNames[n], selected))
279 settings.setPoints(COLOR_MESH);
280 ImGui::EndDisabled();
281 break;
282 case 2:
283 if (ImGui::Selectable(pointColorNames[n], selected))
284 settings.setPoints(COLOR_USER);
285 break;
286 default: assert(false); break;
287 }
288 if (selected)
289 ImGui::SetItemDefaultFocus();
290 }
291 ImGui::EndCombo();
292 }
293 // user color picker
294 ImGui::SameLine();
295 ImGui::BeginDisabled(!settings.isPoints(COLOR_USER));
296 ImGui::ColorEdit4(
297 "##PointColor",
298 [&] {
299 return settings.pointUserColor();
300 },
301 [&](vcl::Color c) {
302 settings.setPointsUserColor(c);
303 },
305 ImGui::EndDisabled();
306
307 // point size
308 ImGui::Text("Size:");
309 // set the width of the window minus the width of the label
310 ImGui::SameLine();
311 ImGui::SetNextItemWidth(-10);
312 ImGui::SliderFloat(
313 "##PointSize",
314 [&] {
315 return settings.pointWidth();
316 },
317 [&](float v) {
318 settings.setPointsWidth(v);
319 },
320 1.0f,
321 32.0f);
322
323 ImGui::EndDisabled();
324 }
325
326 static void drawMeshSurfaceSettings(
328 vcl::MeshRenderSettings& settings)
329 {
331
332 ImGui::BeginDisabled(!settings.canSurface(VISIBLE));
333
334 // visibility
335 ImGui::Checkbox(
336 "Visible",
337 [&] {
338 return settings.isSurface(VISIBLE);
339 },
340 [&](bool vis) {
341 settings.setSurface(VISIBLE, vis);
342 });
343
344 // shading
345 assert(
346 (settings.isSurface(SHADING_SMOOTH) +
347 settings.isSurface(SHADING_FLAT) +
348 settings.isSurface(SHADING_NONE)) == 1);
349 ImGui::Text("Shading:");
350 ImGui::SameLine();
351 ImGui::RadioButton(
352 "Smooth",
353 [&] {
354 return settings.isSurface(SHADING_SMOOTH);
355 },
356 [&](bool vis) {
357 if (vis)
358 settings.setSurface(SHADING_SMOOTH);
359 });
360 ImGui::SameLine();
361 ImGui::RadioButton(
362 "Flat",
363 [&] {
364 return settings.isSurface(SHADING_FLAT);
365 },
366 [&](bool vis) {
367 if (vis)
368 settings.setSurface(SHADING_FLAT);
369 });
370 ImGui::SameLine();
371 ImGui::RadioButton(
372 "None",
373 [&] {
374 return settings.isSurface(SHADING_NONE);
375 },
376 [&](bool vis) {
377 if (vis)
378 settings.setSurface(SHADING_NONE);
379 });
380
381 // color
382 const uint CS_COUNT =
383 toUnderlying(COUNT) - 4; // exclude shading options
384
385 ImGui::Text("Color:");
386 ImGui::SameLine();
387 const char* surfColorNames[CS_COUNT] = {
388 "Vertex", "Face", "Mesh", "PerVertexTex", "PerWedgeTex", "User"};
389
390 const std::array<bool, CS_COUNT> colorSelected = {
391 settings.isSurface(COLOR_VERTEX),
392 settings.isSurface(COLOR_FACE),
393 settings.isSurface(COLOR_MESH),
394 settings.isSurface(COLOR_VERTEX_TEX),
395 settings.isSurface(COLOR_WEDGE_TEX),
396 settings.isSurface(COLOR_USER)};
397 assert(
398 std::accumulate(
399 std::begin(colorSelected), std::end(colorSelected), 0) == 1);
400 int idx = std::distance(
401 std::begin(colorSelected),
402 std::find(
403 std::begin(colorSelected), std::end(colorSelected), true));
404 assert(idx >= 0 && idx < CS_COUNT);
405 ImGui::SetNextItemWidth(-40);
406 if (ImGui::BeginCombo("##ComboSurfColor", surfColorNames[idx])) {
407 for (int n = 0; n < CS_COUNT; n++) {
408 const bool selected = (n == idx);
409
410 switch (n) {
411 case 0:
412 ImGui::BeginDisabled(!settings.canSurface(COLOR_VERTEX));
413 if (ImGui::Selectable(surfColorNames[n], selected))
414 settings.setSurface(COLOR_VERTEX);
415 ImGui::EndDisabled();
416 break;
417 case 1:
418 ImGui::BeginDisabled(!settings.canSurface(COLOR_FACE));
419 if (ImGui::Selectable(surfColorNames[n], selected))
420 settings.setSurface(COLOR_FACE);
421 ImGui::EndDisabled();
422 break;
423 case 2:
424 ImGui::BeginDisabled(!settings.canSurface(COLOR_MESH));
425 if (ImGui::Selectable(surfColorNames[n], selected))
426 settings.setSurface(COLOR_MESH);
427 ImGui::EndDisabled();
428 break;
429 case 3:
430 ImGui::BeginDisabled(
431 !settings.canSurface(COLOR_VERTEX_TEX));
432 if (ImGui::Selectable(surfColorNames[n], selected))
433 settings.setSurface(COLOR_VERTEX_TEX);
434 ImGui::EndDisabled();
435 break;
436 case 4:
437 ImGui::BeginDisabled(!settings.canSurface(COLOR_WEDGE_TEX));
438 if (ImGui::Selectable(surfColorNames[n], selected))
439 settings.setSurface(COLOR_WEDGE_TEX);
440 ImGui::EndDisabled();
441 break;
442 case 5:
443 if (ImGui::Selectable(surfColorNames[n], selected))
444 settings.setSurface(COLOR_USER);
445 break;
446 default: assert(false); break;
447 }
448 if (selected)
449 ImGui::SetItemDefaultFocus();
450 }
451 ImGui::EndCombo();
452 }
453 // user color picker
454 ImGui::SameLine();
455 ImGui::BeginDisabled(!settings.isSurface(COLOR_USER));
456 ImGui::ColorEdit4(
457 "##SurfUserColor",
458 [&] {
459 return settings.surfaceUserColor();
460 },
461 [&](vcl::Color c) {
462 settings.setSurfaceUserColor(c);
463 },
465 ImGui::EndDisabled();
466
467 ImGui::EndDisabled();
468 }
469
470 static void drawMeshWireframeSettings(
472 vcl::MeshRenderSettings& settings)
473 {
475
476 ImGui::BeginDisabled(!settings.canWireframe(VISIBLE));
477
478 // visibility
479 ImGui::Checkbox(
480 "Visible",
481 [&] {
482 return settings.isWireframe(VISIBLE);
483 },
484 [&](bool v) {
485 settings.setWireframe(VISIBLE, v);
486 });
487
488 // shading
489 assert(
490 settings.isWireframe(SHADING_VERT) !=
491 settings.isWireframe(SHADING_NONE));
492 ImGui::Text("Shading:");
493 ImGui::SameLine();
494 ImGui::RadioButton(
495 "Vertex",
496 [&] {
497 return settings.isWireframe(SHADING_VERT);
498 },
499 [&](bool vis) {
500 if (vis)
501 settings.setWireframe(SHADING_VERT);
502 });
503 ImGui::SameLine();
504 ImGui::RadioButton(
505 "None",
506 [&] {
507 return settings.isWireframe(SHADING_NONE);
508 },
509 [&](bool vis) {
510 if (vis)
511 settings.setWireframe(SHADING_NONE);
512 });
513
514 // color
515 ImGui::Text("Color:");
516 ImGui::SameLine();
517 const char* wireColorNames[] = {"Vertex", "Mesh", "User"};
518 const std::array<bool, 3> colorSelected = {
519 settings.isWireframe(COLOR_VERTEX),
520 settings.isWireframe(COLOR_MESH),
521 settings.isWireframe(COLOR_USER)};
522 assert(
523 std::accumulate(
524 std::begin(colorSelected), std::end(colorSelected), 0) == 1);
525 int idx = std::distance(
526 std::begin(colorSelected),
527 std::find(
528 std::begin(colorSelected), std::end(colorSelected), true));
529 assert(idx >= 0 && idx < 3);
530 ImGui::SetNextItemWidth(-40);
531 if (ImGui::BeginCombo("##ComboWireColor", wireColorNames[idx])) {
532 for (int n = 0; n < IM_ARRAYSIZE(wireColorNames); n++) {
533 const bool selected = (n == idx);
534
535 switch (n) {
536 case 0:
537 ImGui::BeginDisabled(!settings.canWireframe(COLOR_VERTEX));
538 if (ImGui::Selectable(wireColorNames[n], selected))
539 settings.setWireframe(COLOR_VERTEX);
540 ImGui::EndDisabled();
541 break;
542 case 1:
543 ImGui::BeginDisabled(!settings.canWireframe(COLOR_MESH));
544 if (ImGui::Selectable(wireColorNames[n], selected))
545 settings.setWireframe(COLOR_MESH);
546 ImGui::EndDisabled();
547 break;
548 case 2:
549 if (ImGui::Selectable(wireColorNames[n], selected))
550 settings.setWireframe(COLOR_USER);
551 break;
552 default: assert(false); break;
553 }
554 if (selected)
555 ImGui::SetItemDefaultFocus();
556 }
557 ImGui::EndCombo();
558 }
559 // user color picker
560 ImGui::SameLine();
561 ImGui::BeginDisabled(!settings.isWireframe(COLOR_USER));
562 ImGui::ColorEdit4(
563 "##WireUserColor",
564 [&] {
565 return settings.wireframeUserColor();
566 },
567 [&](vcl::Color c) {
568 settings.setWireframeUserColor(c);
569 },
571 ImGui::EndDisabled();
572
573 // wireframe size
574 ImGui::Text("Size:");
575 // set the width of the window minus the width of the label
576 ImGui::SameLine();
577 ImGui::SetNextItemWidth(-10);
578 ImGui::SliderFloat(
579 "##WireframeSize",
580 [&] {
581 return settings.wireframeWidth();
582 },
583 [&](float v) {
584 settings.setWireframeWidth(v);
585 },
586 1.0f,
587 32.0f);
588
589 ImGui::EndDisabled();
590 }
591
592 static void drawMeshEdgeSettings(
594 vcl::MeshRenderSettings& settings)
595 {
597
598 ImGui::BeginDisabled(!settings.canEdges(VISIBLE));
599
600 // visibility
601 ImGui::Checkbox(
602 "Visible",
603 [&] {
604 return settings.isEdges(VISIBLE);
605 },
606 [&](bool v) {
607 settings.setEdges(VISIBLE, v);
608 });
609
610 // shading
611 assert(
612 (settings.isEdges(SHADING_SMOOTH) + settings.isEdges(SHADING_FLAT) +
613 settings.isEdges(SHADING_NONE)) == 1);
614 ImGui::Text("Shading:");
615 ImGui::SameLine();
616 ImGui::BeginDisabled(!settings.canEdges(SHADING_SMOOTH));
617 ImGui::RadioButton(
618 "Smooth",
619 [&] {
620 return settings.isEdges(SHADING_SMOOTH);
621 },
622 [&](bool v) {
623 if (v)
624 settings.setEdges(SHADING_SMOOTH);
625 });
626 ImGui::EndDisabled();
627 ImGui::SameLine();
628 ImGui::BeginDisabled(!settings.canEdges(SHADING_FLAT));
629 ImGui::RadioButton(
630 "Flat",
631 [&] {
632 return settings.isEdges(SHADING_FLAT);
633 },
634 [&](bool v) {
635 if (v)
636 settings.setEdges(SHADING_FLAT);
637 });
638 ImGui::EndDisabled();
639 ImGui::SameLine();
640 ImGui::BeginDisabled(!settings.canEdges(SHADING_NONE));
641 ImGui::RadioButton(
642 "None",
643 [&] {
644 return settings.isEdges(SHADING_NONE);
645 },
646 [&](bool vis) {
647 if (vis)
648 settings.setEdges(SHADING_NONE);
649 });
650 ImGui::EndDisabled();
651
652 // color
653 ImGui::Text("Color:");
654 ImGui::SameLine();
655 const char* edgeColorNames[] = {"Vertex", "Edge", "Mesh", "User"};
656 const std::array<bool, 4> colorSelected = {
657 settings.isEdges(COLOR_VERTEX),
658 settings.isEdges(COLOR_EDGE),
659 settings.isEdges(COLOR_MESH),
660 settings.isEdges(COLOR_USER)};
661 assert(
662 std::accumulate(
663 std::begin(colorSelected), std::end(colorSelected), 0) == 1);
664 int idx = std::distance(
665 std::begin(colorSelected),
666 std::find(
667 std::begin(colorSelected), std::end(colorSelected), true));
668 assert(idx >= 0 && idx < 4);
669 ImGui::SetNextItemWidth(-40);
670 if (ImGui::BeginCombo("##ComboEdgeColor", edgeColorNames[idx])) {
671 for (int n = 0; n < IM_ARRAYSIZE(edgeColorNames); n++) {
672 const bool selected = (n == idx);
673
674 switch (n) {
675 case 0:
676 ImGui::BeginDisabled(!settings.canEdges(COLOR_VERTEX));
677 if (ImGui::Selectable(edgeColorNames[n], selected))
678 settings.setEdges(COLOR_VERTEX);
679 ImGui::EndDisabled();
680 break;
681 case 1:
682 ImGui::BeginDisabled(!settings.canEdges(COLOR_EDGE));
683 if (ImGui::Selectable(edgeColorNames[n], selected))
684 settings.setEdges(COLOR_EDGE);
685 ImGui::EndDisabled();
686 break;
687 case 2:
688 ImGui::BeginDisabled(!settings.canEdges(COLOR_MESH));
689 if (ImGui::Selectable(edgeColorNames[n], selected))
690 settings.setEdges(COLOR_MESH);
691 ImGui::EndDisabled();
692 break;
693 case 3:
694 if (ImGui::Selectable(edgeColorNames[n], selected))
695 settings.setEdges(COLOR_USER);
696 break;
697 default: assert(false); break;
698 }
699 if (selected)
700 ImGui::SetItemDefaultFocus();
701 }
702 ImGui::EndCombo();
703 }
704 // user color picker
705 ImGui::SameLine();
706 ImGui::BeginDisabled(!settings.isEdges(COLOR_USER));
707 ImGui::ColorEdit4(
708 "##EdgeUserColor",
709 [&] {
710 return settings.edgesUserColor();
711 },
712 [&](vcl::Color c) {
713 settings.setEdgesUserColor(c);
714 },
716 ImGui::EndDisabled();
717
718 // edge size
719 ImGui::Text("Size:");
720 // set the width of the window minus the width of the label
721 ImGui::SameLine();
722 ImGui::SetNextItemWidth(-10);
723 ImGui::SliderFloat(
724 "##EdgeSize",
725 [&] {
726 return settings.edgesWidth();
727 },
728 [&](float v) {
729 settings.setEdgesWidth(v);
730 },
731 1.0f,
732 32.0f);
733
734 ImGui::EndDisabled();
735 }
736
737 static void drawMeshSettings(vcl::AbstractDrawableMesh& drawable)
738 {
739 using MRI = vcl::MeshRenderInfo;
740
741 ImGui::Separator();
742 // mesh settings
743 const auto settings = drawable.renderSettings();
744 auto newSettings = settings;
745
746 // points
748 if (ImGui::BeginTabBar("MyTabBar", tab_bar_flags)) {
749 // points
750 if (newSettings.canPoints(MRI::Points::VISIBLE) &&
751 ImGui::BeginTabItem("Points")) {
752 drawMeshPointSettings(drawable, newSettings);
753 ImGui::EndTabItem();
754 }
755
756 // surface + wireframe
757 if (newSettings.canSurface(MRI::Surface::VISIBLE)) {
758 if (ImGui::BeginTabItem("Surface")) {
759 drawMeshSurfaceSettings(drawable, newSettings);
760 ImGui::EndTabItem();
761 }
762 if (ImGui::BeginTabItem("Wireframe")) {
763 drawMeshWireframeSettings(drawable, newSettings);
764 ImGui::EndTabItem();
765 }
766 }
767
768 // edges
769 if (newSettings.canEdges(MRI::Edges::VISIBLE) &&
770 ImGui::BeginTabItem("Edges")) {
771 drawMeshEdgeSettings(drawable, newSettings);
772 ImGui::EndTabItem();
773 }
774
775 ImGui::EndTabBar();
776 }
777
778 if (newSettings != settings) {
779 drawable.setRenderSettings(newSettings);
780 }
781 }
782};
783
784} // namespace vcl::imgui
785
786#endif // VCL_IMGUI_MESH_VIEWER_IMGUI_DRAWER_H
The AbstractDrawableMesh class is the base class for all the drawable meshes in the VCLib render syst...
Definition abstract_drawable_mesh.h:41
A class representing a box in N-dimensional space.
Definition box.h:46
The Color class represents a 32 bit color.
Definition color.h:48
The MeshRenderInfo class is a collection of rendering settings for a Mesh.
Definition mesh_render_info.h:61
Wireframe
List of possible settings for the wireframe primitive.
Definition mesh_render_info.h:166
Surface
List of possible settings for the surface primitive.
Definition mesh_render_info.h:148
Edges
List of possible settings for the edges primitive.
Definition mesh_render_info.h:180
Points
List of possible settings for the points primitive.
Definition mesh_render_info.h:131
The MeshRenderSettings class allows an easy management of render settings of a Mesh....
Definition mesh_render_settings.h:70
bool isPoints(MeshRenderInfo::Points p) const
Returns whether the given points option is set.
Definition mesh_render_settings.h:225
bool canWireframe(MeshRenderInfo::Wireframe w) const
Returns the capability of a given option for the wireframe primitive.
Definition mesh_render_settings.h:177
bool setSurface(MeshRenderInfo::Surface s, bool b=true)
Sets the given shading option of the surface.
Definition mesh_render_settings.h:458
bool setEdges(MeshRenderInfo::Edges e, bool b=true)
Sets the given shading option of the edges.
Definition mesh_render_settings.h:568
bool setPoints(MeshRenderInfo::Points p, bool b=true)
Sets the given shading option of the points.
Definition mesh_render_settings.h:397
bool canSurface(MeshRenderInfo::Surface s) const
Returns the capability of a given option for the surface primitive.
Definition mesh_render_settings.h:165
bool canPoints(MeshRenderInfo::Points p) const
Returns the capability of a given option for the points primitive.
Definition mesh_render_settings.h:153
bool canEdges(MeshRenderInfo::Edges e) const
Returns the capability of a given option for the edges primitive.
Definition mesh_render_settings.h:188
bool isSurface(MeshRenderInfo::Surface s) const
Returns whether the given surface option is set.
Definition mesh_render_settings.h:250
bool isWireframe(MeshRenderInfo::Wireframe w) const
Returns whether the given wireframe option is set.
Definition mesh_render_settings.h:270
bool setWireframe(MeshRenderInfo::Wireframe w, bool b=true)
Sets the given shading option of the wireframe.
Definition mesh_render_settings.h:507
bool isEdges(MeshRenderInfo::Edges e) const
Returns whether the given edges option is set.
Definition mesh_render_settings.h:295
Definition mesh_viewer_imgui_drawer.h:42
constexpr uint UINT_NULL
The UINT_NULL value represent a null value of uint that is the maximum value that can be represented ...
Definition base.h:48