~janisozaur/janisozaur-inz/ogl_viewer

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
#ifndef MODEL_H
#define MODEL_H

#define GL_GLEXT_PROTOTYPES
#define TEX_XSIZE 1024
#define TEX_YSIZE 1024

#include <QString>
#include <QMap>
#include <QVector>
#include <QVector3D>
#include <GL/gl.h>

struct Triangle
{
	QVector3D vertices[3];
};

struct Lib3dsFile;
struct TextureInfo;

class Model
{
public:
	Model(QString filename);
	void draw();
	void createDisplayList(GLfloat scale = 1);
	void loadTextures();
	QVector<Triangle> getFaces(GLfloat scale = 1);
	~Model();

protected:
	unsigned int countFaces();
	unsigned int mTotalFaces;
	Lib3dsFile *mModel;
	GLuint mVertexVBO, mNormalVBO;
	QMap<QString, TextureInfo *> mTexturesMap;
};

#endif // MODEL_H