refactor: Migrate ViewportWidget to shader-based OpenGL rendering (FFP disabled)

Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
This commit is contained in:
2026-02-15 13:03:37 -07:00
parent af121ce6eb
commit 0f43715c6b
5 changed files with 223 additions and 146 deletions

View File

@@ -9,6 +9,9 @@
#include <QRect>
#include <gp_Pnt.hxx>
#include <QMap>
#include <QOpenGLShaderProgram>
#include <QOpenGLVertexArrayObject>
#include <QOpenGLBuffer>
class QSvgRenderer;
class ViewCube;
@@ -56,6 +59,7 @@ protected:
void keyPressEvent(QKeyEvent *event) override;
private:
void initShaders();
QVector3D project(const QVector3D& worldCoord, const QMatrix4x4& modelView, const QMatrix4x4& projection, const QRect& viewport);
QVector3D unproject(const QPoint& screenPos, SketchPlane plane);
void drawAxisLabels(QPainter& painter, const QMatrix4x4& modelView, const QMatrix4x4& projection);
@@ -64,6 +68,14 @@ private:
ViewportWidget::SketchPlane checkPlaneSelection(const QPoint& screenPos);
QMatrix4x4 projection;
QOpenGLShaderProgram* m_shaderProgram = nullptr;
QOpenGLVertexArrayObject m_vao;
QOpenGLBuffer m_vbo;
// Shader uniform locations
int m_projMatrixLoc = -1;
int m_mvMatrixLoc = -1;
int m_colorLoc = -1;
Camera* m_camera = nullptr;
ViewCube* m_viewCube;
SketchGrid* m_sketchGrid = nullptr;