Visual Computing Library  devel
Loading...
Searching...
No Matches
mesh_viewer.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_QT_MESH_VIEWER_H
24#define VCL_QT_MESH_VIEWER_H
25
26#include "gui/drawable_object_vector_tree.h"
27
28#include <vclib/qt/gui/text_edit_logger.h>
29#include <vclib/qt/mesh_viewer_render_app.h>
30#include <vclib/render/drawable/drawable_object_vector.h>
31
32#include <QWidget>
33
34namespace vcl::qt {
35
36namespace Ui {
37class MeshViewer;
38} // namespace Ui
39
40class KeyFilter : public QObject
41{
42 using QObject::QObject;
43
44protected:
45 bool eventFilter(QObject* obj, QEvent* event) override;
46};
47
48class MeshViewer : public QWidget
49{
51
52 enum class RenderMode { CLASSIC = 0, PBR = 1 };
53
54 Ui::MeshViewer* mUI;
55
56 std::shared_ptr<vcl::DrawableObjectVector> mDrawableObjectVector;
57
58 std::shared_ptr<vcl::DrawableObjectVector> mListedDrawableObjects;
59 std::shared_ptr<vcl::DrawableObjectVector> mUnlistedDrawableObjects;
60
61protected:
63
64 DrawableObjectVectorTree& drawableObjectVectorTree() const;
65
66 void keyPressEvent(QKeyEvent* event) override;
67
68public:
69 explicit MeshViewer(QWidget* parent = nullptr);
71
73 const std::shared_ptr<vcl::DrawableObjectVector>& v);
74
75 void setUnlistedDrawableObjectVector(
76 const std::shared_ptr<vcl::DrawableObjectVector>& v);
77
78 uint selectedDrawableObject() const;
79
80 TextEditLogger& logger();
81
82 void setDrawVectorIconFunction(
83 const DrawableObjectVectorTree::IconFunction& f);
84
85 Camera<float> camera() const;
86
87 void setCamera(const Camera<float>& c);
88
89 void showRenderModeSelector(bool show);
90
91 bool isPBREnabled() const;
92
93 void setPBR(bool enable);
94
95 void enablePBR();
96
97 void disablePBR();
98
99public slots:
101
103
105
106 void fitScene();
107
108 void fitView();
109
110 void updateGUI();
111
112private slots:
113 void renderModeComboBoxCurrentIndexChanged(int index);
114};
115
116} // namespace vcl::qt
117
118#endif // VCL_QT_MESH_VIEWER_H
A class representing a box in N-dimensional space.
Definition box.h:46
Definition drawable_object_vector_tree.h:38
Definition mesh_viewer.h:41
Definition mesh_viewer.h:49
void renderSettingsUpdated()
Slot called every time that the MeshRenderSettingsFrame emits 'settingsUpdated()',...
Definition mesh_viewer.cpp:283
void visibilityDrawableObjectChanged()
Slot called when the user changed the visibility of an object in the DrawableObjectVectorTree.
Definition mesh_viewer.cpp:234
void selectedDrawableObjectChanged(uint i)
Slot called when the user selected a different DrawableObject in the DrawableObjectVectorFrame.
Definition mesh_viewer.cpp:256
MeshViewerRenderApp & viewer() const
Returns the MeshViewerRenderApp used by this MeshViewer.
Definition mesh_viewer.cpp:55
void setDrawableObjectVector(const std::shared_ptr< vcl::DrawableObjectVector > &v)
Sets the current DrawableObjectVector, and updates the GUI accordingly.
Definition mesh_viewer.cpp:139
Definition text_edit_logger.h:38