feat: Add sketch creation with plane selection, oriented grid and labeled axes
Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
This commit is contained in:
@@ -5,17 +5,29 @@
|
||||
#include <QOpenGLFunctions>
|
||||
#include <QMatrix4x4>
|
||||
#include <QPoint>
|
||||
#include <QVector3D>
|
||||
#include <QRect>
|
||||
|
||||
class ViewCube;
|
||||
class SketchGrid;
|
||||
|
||||
class ViewportWidget : public QOpenGLWidget, protected QOpenGLFunctions
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum class SketchPlane {
|
||||
NONE,
|
||||
XY,
|
||||
XZ,
|
||||
YZ
|
||||
};
|
||||
|
||||
explicit ViewportWidget(QWidget *parent = nullptr);
|
||||
~ViewportWidget();
|
||||
|
||||
void startSketch(SketchPlane plane);
|
||||
|
||||
protected:
|
||||
void initializeGL() override;
|
||||
void paintGL() override;
|
||||
@@ -26,8 +38,13 @@ protected:
|
||||
void wheelEvent(QWheelEvent *event) override;
|
||||
|
||||
private:
|
||||
QVector3D project(const QVector3D& worldCoord, const QMatrix4x4& modelView, const QMatrix4x4& projection, const QRect& viewport);
|
||||
void drawAxisLabels(QPainter& painter, const QMatrix4x4& modelView, const QMatrix4x4& projection);
|
||||
|
||||
QMatrix4x4 projection;
|
||||
ViewCube* m_viewCube;
|
||||
SketchGrid* m_sketchGrid = nullptr;
|
||||
SketchPlane m_currentPlane = SketchPlane::NONE;
|
||||
|
||||
float xRot = 0;
|
||||
float yRot = 0;
|
||||
|
||||
Reference in New Issue
Block a user