refactor: Migrate ViewCube to shader-based rendering
Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user