-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathssphere3d.h
62 lines (52 loc) · 1.31 KB
/
ssphere3d.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#ifndef SSPHERE3D_H
#define SSPHERE3D_H
#include <QObject>
#include <QVector3D>
#include <QColor>
#include <QGLBuffer>
#include <QGLShaderProgram>
#include <QGLWidget>
#include <QMatrix4x4>
#include "sutils.h"
class SSphere3D : public QObject
{
Q_OBJECT
public:
explicit SSphere3D(QObject *parent = 0);
~SSphere3D();
void draw();
bool loadObj();
bool loadShader();
bool createBuffer();
void dumpPoints();
void setProjectionAndViewMatrix(const QMatrix4x4 &pm, const QMatrix4x4 &vm);
void setTexture(QGLWidget * widget);
void loadTexture();
void setAxialTilt(double angle);
void rotate(double angle);
signals:
public slots:
private:
bool loadPoints(const char * filename);
bool loadFaces(const char * filename);
bool loadNormals(const char * filename);
QVector3D center;
double radius;
QColor color;
NM_SUtils::Points points;
NM_SUtils::Points normals;
QList<int> indexFace3v;
QList<int> indexFace3n;
QList<int> indexFace4v;
QList<int> indexFace4n;
QGLBuffer mVertexBuffer;
QGLBuffer mNormalBuffer;
QGLShaderProgram mShader;
QGLBuffer mIndexBuffer;
QMatrix4x4 mProjectionMatrix;
QMatrix4x4 mViewMatrix;
QMatrix4x4 mModelMatrix;
double m_axialTilt;
GLuint m_texture;
};
#endif // SSPHERE3D_H