refactor: Migrate ViewCube to shader-based rendering

Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
This commit is contained in:
2026-02-15 13:11:14 -07:00
parent 6843a85135
commit e155c9551c
5 changed files with 192 additions and 93 deletions

View File

@@ -3,22 +3,37 @@
#include <QOpenGLFunctions>
#include <QMatrix4x4>
#include <qopengl.h> // For GLuint
#include <QOpenGLVertexArrayObject>
#include <QOpenGLBuffer>
class QOpenGLShaderProgram;
class QOpenGLTexture;
class ViewCube : protected QOpenGLFunctions
{
public:
ViewCube();
~ViewCube();
void initializeGL();
void paintGL(const QMatrix4x4& viewMatrix, int width, int height);
void paintGL(QOpenGLShaderProgram* simpleShader, int simpleShaderColorLoc, const QMatrix4x4& viewMatrix, int width, int height);
private:
void createFaceTextures();
void drawViewCube();
void drawAxes();
void initShaders();
void setupBuffers();
void drawViewCube(const QMatrix4x4& projection, const QMatrix4x4& view);
void drawAxes(QOpenGLShaderProgram* simpleShader, int colorLoc, const QMatrix4x4& projection, const QMatrix4x4& view);
GLuint faceTextures[6];
QOpenGLTexture* m_faceTextures[6];
QOpenGLShaderProgram* m_textureShaderProgram = nullptr;
QOpenGLVertexArrayObject m_cubeVao;
QOpenGLBuffer m_cubeVbo;
QOpenGLVertexArrayObject m_axesVao;
QOpenGLBuffer m_axesVbo;
};
#endif // VIEWCUBE_H