Visual Computing Library  devel
Loading...
Searching...
No Matches
mesh_viewer.h
1/*****************************************************************************
2 * VCLib *
3 * Visual Computing Library *
4 * *
5 * Copyright(C) 2021-2026 *
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#include <vclib/render/settings/pbr_viewer_settings.h>
32
33#include <QWidget>
34
35namespace vcl::qt {
36
37namespace Ui {
38class MeshViewer;
39} // namespace Ui
40
41class KeyFilter : public QObject
42{
43 using QObject::QObject;
44
45protected:
46 bool eventFilter(QObject* obj, QEvent* event) override;
47};
48
49class MeshViewer : public QWidget
50{
52
53 enum class RenderMode { CLASSIC = 0, PBR = 1 };
54
55 Ui::MeshViewer* mUI;
56
57 std::shared_ptr<vcl::DrawableObjectVector> mDrawableObjectVector;
58
59 std::shared_ptr<vcl::DrawableObjectVector> mListedDrawableObjects;
60 std::shared_ptr<vcl::DrawableObjectVector> mUnlistedDrawableObjects;
61
62protected:
64
65 DrawableObjectVectorTree& drawableObjectVectorTree() const;
66
67 void keyPressEvent(QKeyEvent* event) override;
68
69public:
70 explicit MeshViewer(QWidget* parent = nullptr);
72
74 const std::shared_ptr<vcl::DrawableObjectVector>& v);
75
76 void setUnlistedDrawableObjectVector(
77 const std::shared_ptr<vcl::DrawableObjectVector>& v);
78
79 uint selectedDrawableObject() const;
80
81 TextEditLogger& logger();
82
83 void setDrawVectorIconFunction(
84 const DrawableObjectVectorTree::IconFunction& f);
85
86 Camera<float> camera() const;
87
88 void setCamera(const Camera<float>& c);
89
90 // void showRenderModeSelector(bool show);
91
92 void setPbrSettings(const PBRViewerSettings& settings);
93
94 const PBRViewerSettings& pbrSettings() const;
95
96 void setPanorama(const std::string& panorama);
97
98public slots:
100
102
104
105 void fitScene();
106
107 void fitView();
108
109 void updateGUI();
110};
111
112} // namespace vcl::qt
113
114#endif // VCL_QT_MESH_VIEWER_H
The RenderApp class is a template class that combines a canvas, a window manager, and a set of drawer...
Definition render_app.h:67
A class representing a line segment in n-dimensional space. The class is parameterized by a PointConc...
Definition segment.h:41
Definition drawable_object_vector_tree.h:40
Definition mesh_viewer.h:42
Definition mesh_viewer.h:50
void renderSettingsUpdated()
Slot called every time that the MeshRenderSettingsFrame emits 'settingsUpdated()',...
Definition mesh_viewer.cpp:271
void visibilityDrawableObjectChanged()
Slot called when the user changed the visibility of an object in the DrawableObjectVectorTree.
Definition mesh_viewer.cpp:221
void selectedDrawableObjectChanged(uint i)
Slot called when the user selected a different DrawableObject in the DrawableObjectVectorFrame.
Definition mesh_viewer.cpp:243
MeshViewerRenderApp & viewer() const
Returns the MeshViewerRenderApp used by this MeshViewer.
Definition mesh_viewer.cpp:56
void setDrawableObjectVector(const std::shared_ptr< vcl::DrawableObjectVector > &v)
Sets the current DrawableObjectVector, and updates the GUI accordingly.
Definition mesh_viewer.cpp:136
Definition text_edit_logger.h:38
Definition pbr_viewer_settings.h:31