manage data in vectors
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
#include <QOpenGLShaderProgram>
|
||||
#include <QOpenGLBuffer>
|
||||
#include <QOpenGLTexture>
|
||||
#include <QVector>
|
||||
|
||||
class GeometryEngine : protected QOpenGLFunctions
|
||||
{
|
||||
@@ -11,15 +12,15 @@ public:
|
||||
GeometryEngine();
|
||||
virtual ~GeometryEngine();
|
||||
|
||||
void drawGeometry(QOpenGLShaderProgram *program);
|
||||
|
||||
private:
|
||||
QOpenGLBuffer m_arrayBuf;
|
||||
QOpenGLBuffer m_indexBuf;
|
||||
QVector<QOpenGLTexture*> m_textures;
|
||||
|
||||
void initCubeGeometry();
|
||||
void initTexture();
|
||||
|
||||
QOpenGLBuffer arrayBuf;
|
||||
QOpenGLBuffer indexBuf;
|
||||
|
||||
QOpenGLTexture *texture;
|
||||
public:
|
||||
void drawGeometry(QOpenGLShaderProgram *program);
|
||||
};
|
||||
|
||||
|
@@ -21,6 +21,19 @@ public:
|
||||
explicit OglViewerWidget(QWidget *parent = 0);
|
||||
~OglViewerWidget();
|
||||
|
||||
private:
|
||||
struct {
|
||||
bool left = false;
|
||||
bool right = false;
|
||||
QVector2D position;
|
||||
} m_mouse;
|
||||
|
||||
QOpenGLShaderProgram m_program;
|
||||
GeometryEngine *m_dataEngine;
|
||||
|
||||
QMatrix4x4 m_projection;
|
||||
QQuaternion m_rotation;
|
||||
|
||||
protected:
|
||||
void mousePressEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
|
||||
void mouseReleaseEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
|
||||
@@ -34,17 +47,6 @@ protected:
|
||||
private:
|
||||
void initShaders();
|
||||
|
||||
private:
|
||||
struct {
|
||||
bool left = false;
|
||||
bool right = false;
|
||||
QVector2D position;
|
||||
} m_mouse;
|
||||
|
||||
QOpenGLShaderProgram m_program;
|
||||
GeometryEngine *m_dataEngine;
|
||||
|
||||
QMatrix4x4 m_projection;
|
||||
QQuaternion m_rotation;
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user