src/layers/edittools.h

changeset 374
75efc3ba5a56
parent 333
07e65a4c6611
child 379
8d88adffb779
equal deleted inserted replaced
373:e34d6a30b96d 374:75efc3ba5a56
23 #include "src/model.h" 23 #include "src/model.h"
24 #include "src/vertexmap.h" 24 #include "src/vertexmap.h"
25 #include "src/gl/common.h" 25 #include "src/gl/common.h"
26 #include "src/inputvertices.h" 26 #include "src/inputvertices.h"
27 27
28 enum EditingMode 28 enum class editing_mode_e
29 { 29 {
30 SelectMode, 30 select,
31 DrawMode, 31 draw,
32 CircleMode 32 circle
33 }; 33 };
34 34
35 Q_DECLARE_METATYPE(EditingMode) 35 Q_DECLARE_METATYPE(editing_mode_e)
36 36
37 Q_DECLARE_METATYPE(ModelAction) 37 Q_DECLARE_METATYPE(ModelAction)
38 38
39 class EditTools final : public QObject, public RenderLayer 39 class EditTools final : public QObject, public RenderLayer
40 { 40 {
41 Q_OBJECT 41 Q_OBJECT
42 InputVertices inputPolygon; 42 InputVertices inputPolygon;
43 EditingMode mode = SelectMode; 43 editing_mode_e mode = editing_mode_e::select;
44 glm::mat4 mvpMatrix; 44 glm::mat4 mvpMatrix;
45 glm::mat4 gridMatrix{1}; 45 glm::mat4 gridMatrix{1};
46 Plane gridPlane; 46 Plane gridPlane;
47 QPointF localPosition; 47 QPointF localPosition;
48 opt<glm::vec3> worldPosition; 48 opt<glm::vec3> worldPosition;
53 public: 53 public:
54 explicit EditTools(QObject *parent = nullptr); 54 explicit EditTools(QObject *parent = nullptr);
55 ~EditTools() override; 55 ~EditTools() override;
56 void applyToVertices(VertexMap::ApplyFunction fn) const; 56 void applyToVertices(VertexMap::ApplyFunction fn) const;
57 [[nodiscard]] const QSet<ModelId> selectedObjects() const; 57 [[nodiscard]] const QSet<ModelId> selectedObjects() const;
58 [[nodiscard]] EditingMode currentEditingMode() const; 58 [[nodiscard]] editing_mode_e currentEditingMode() const;
59 Q_SLOT void setEditMode(EditingMode mode); 59 Q_SLOT void setEditMode(editing_mode_e mode);
60 Q_SLOT void setGridMatrix(const glm::mat4& gridMatrix); 60 Q_SLOT void setGridMatrix(const glm::mat4& gridMatrix);
61 Q_SLOT void setCircleToolOptions(const CircleToolOptions& options); 61 Q_SLOT void setCircleToolOptions(const CircleToolOptions& options);
62 Q_SIGNALS: 62 Q_SIGNALS:
63 void newStatusText(const QString& newStatusText); 63 void newStatusText(const QString& newStatusText);
64 void modelAction(const ModelAction& action); 64 void modelAction(const ModelAction& action);

mercurial