| 54 EditingMode mode = SelectMode; |
55 EditingMode mode = SelectMode; |
| 55 glm::mat4 mvpMatrix; |
56 glm::mat4 mvpMatrix; |
| 56 glm::mat4 gridMatrix{1}; |
57 glm::mat4 gridMatrix{1}; |
| 57 Plane gridPlane; |
58 Plane gridPlane; |
| 58 opt<glm::vec3> worldPosition; |
59 opt<glm::vec3> worldPosition; |
| |
60 CircleToolOptions circleToolOptions = { |
| |
61 .fraction = {16, 16}, |
| |
62 .type = CircularPrimitive::Circle, |
| |
63 }; |
| 59 public: |
64 public: |
| 60 explicit EditTools(QObject *parent = nullptr); |
65 explicit EditTools(QObject *parent = nullptr); |
| 61 ~EditTools() override; |
66 ~EditTools() override; |
| 62 void applyToVertices(VertexMap::ApplyFunction fn) const; |
67 void applyToVertices(VertexMap::ApplyFunction fn) const; |
| 63 const QSet<ModelId> selectedObjects() const; |
68 const QSet<ModelId> selectedObjects() const; |
| 64 EditingMode currentEditingMode() const; |
69 EditingMode currentEditingMode() const; |
| 65 Q_SLOT void setEditMode(EditingMode mode); |
70 Q_SLOT void setEditMode(EditingMode mode); |
| 66 Q_SLOT void setGridMatrix(const glm::mat4& gridMatrix); |
71 Q_SLOT void setGridMatrix(const glm::mat4& gridMatrix); |
| |
72 Q_SLOT void setCircleToolOptions(const CircleToolOptions& options); |
| 67 Q_SIGNALS: |
73 Q_SIGNALS: |
| 68 void newStatusText(const QString& newStatusText); |
74 void newStatusText(const QString& newStatusText); |
| 69 void modelAction(const ModelAction& action); |
75 void modelAction(const ModelAction& action); |
| 70 void select(const QSet<ModelId>& ids, bool retain); |
76 void select(const QSet<ModelId>& ids, bool retain); |
| 71 protected: |
77 protected: |
| 72 void mvpMatrixChanged(const glm::mat4& matrix) override; |
78 void mvpMatrixChanged(const glm::mat4& matrix) override; |
| 73 void mouseMoved(const QMouseEvent* event) override; |
79 void mouseMoved(const QMouseEvent* event) override; |
| 74 void mouseClick(const QMouseEvent* event) override; |
80 void mouseClick(const QMouseEvent* event) override; |
| 75 void overpaint(QPainter* painter) override; |
81 void overpaint(QPainter* painter) override; |
| 76 private: |
82 private: |
| 77 const std::vector<ModelAction> actions() const; |
83 const std::vector<ModelAction> modelActions() const; |
| |
84 const std::vector<ModelAction> circleModeActions() const; |
| |
85 const std::vector<ModelAction> drawModeActions() const; |
| 78 void closeShape(); |
86 void closeShape(); |
| 79 void renderPreview(QPainter* painter, const void* pensptr); |
87 void renderPreview(QPainter* painter, const void* pensptr); |
| 80 void removeLastPoint(); |
88 void removeLastPoint(); |
| 81 bool isCloseToExistingPoints() const; |
89 bool isCloseToExistingPoints() const; |
| 82 }; |
90 }; |