feat: Add animated home button to view cube to reset camera

Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
This commit is contained in:
2026-02-17 16:56:25 -07:00
parent 405e151f12
commit c28c080009
5 changed files with 122 additions and 4 deletions

View File

@@ -9,6 +9,8 @@
class QOpenGLShaderProgram;
class QOpenGLTexture;
class QPainter;
class QSvgRenderer;
class ViewCube : protected QOpenGLFunctions
{
@@ -18,6 +20,8 @@ public:
void initializeGL();
void paintGL(QOpenGLShaderProgram* simpleShader, int simpleShaderColorLoc, const QMatrix4x4& viewMatrix, int width, int height, const QPoint& mousePos);
void paint2D(QPainter& painter, int widgetWidth, int widgetHeight);
bool handleMousePress(const QPoint& pos, int widgetWidth, int widgetHeight);
private:
void createFaceTextures();
@@ -26,6 +30,10 @@ private:
void drawViewCube(const QMatrix4x4& projection, const QMatrix4x4& view, float opacity);
void drawAxes(QOpenGLShaderProgram* simpleShader, int colorLoc, const QMatrix4x4& projection, const QMatrix4x4& view);
bool m_isHovered = false;
QRect m_homeButtonRect;
QSvgRenderer* m_homeButtonRenderer = nullptr;
QOpenGLTexture* m_faceTextures[6];
QOpenGLShaderProgram* m_textureShaderProgram = nullptr;