-
Notifications
You must be signed in to change notification settings - Fork 1
/
cpglquads.h
35 lines (32 loc) · 970 Bytes
/
cpglquads.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#pragma once
#include <QtGui/QOpenGLShaderProgram>
#include <QOpenGLFunctions>
#include <vector>
#include <system.h>
struct VertexData
{
QVector3D position;
QVector3D color;
QVector2D textureCoord;
};
class CPGLQuads
{
public:
CPGLQuads();
~CPGLQuads();
// void update(std::vector<float> &positions);
void update(atomDataType *positions, unsigned long *atomType, int n, const QVector3D &offset);
void render(float lightFalloffDistance, const QMatrix4x4 &modelViewProjectionMatrix, const QMatrix4x4 &lightModelViewProjectionMatrix);
void setModelViewMatrix(QMatrix4x4& matrix);
private:
GLuint m_vboIds[2];
std::vector<VertexData> m_vertices;
std::vector<GLushort> m_indices;
QOpenGLFunctions *m_funcs;
QMatrix4x4 m_modelViewMatrix;
QOpenGLShaderProgram *m_program;
void createShaderProgram();
void generateVBOs();
void ensureInitialized();
QVector3D vectorFromColor(const QColor &color);
};