-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodelmanager.h
More file actions
58 lines (42 loc) · 1.16 KB
/
modelmanager.h
File metadata and controls
58 lines (42 loc) · 1.16 KB
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
#ifndef MODELMANAGER_H
#define MODELMANAGER_H
#include <QObject>
#include <QVector3D>
#include <QVector2D>
#include <QVector>
#include <tgaimage.h>
#include <QColor>
struct FaceData {
int vertex;
int tCoord;
int norm;
};
class ModelManager : public QObject
{
Q_OBJECT
public:
explicit ModelManager(QObject *parent = 0);
~ModelManager();
// Load model from @filename , read all data(like vertex,faces and other)
// and write data to buffer
// return true on success, false on error
bool loadModel(const QString &filename,const QString &texturePath = "");
// data getters
QVector<QVector3D> *vertexBuffer3D();
QVector<QVector<FaceData>> *facesBuffer();
QVector<QVector2D> *textureBuffer();
QColor diffuseColor(const QVector2D &coord);
QVector2D uvCoord(int face, int nvert);
bool loadTexture(const QString &path);
// return last ModelManager error;
QString errorString();
signals:
public slots:
private:
QVector<QVector3D> m_vertexBuffer;
QVector<QVector<FaceData> > m_facesBuffer;
QVector<QVector2D > m_textureBuffer;
TGAImage m_tData;
QString m_error;
};
#endif // MODELMANAGER_H