-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmodel.h
86 lines (72 loc) · 2.34 KB
/
model.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#ifndef MODEL_H
#define MODEL_H
#include <QtOpenGL>
#include <QOpenGLWidget>
#include <QOpenGLExtraFunctions>
#include <QTextStream>
#include <QFile>
#include <fstream>
#include <limits>
#include <iostream>
#include <memory>
#include "material.h"
#include "trackball.h"
class Model : public QOpenGLExtraFunctions
{
public :
Model(QOpenGLWidget *_glWidget);
Model();
void inicializa(QOpenGLWidget *_glWidget);
~Model();
std::unique_ptr <QVector4D[]> vertices ;
std::unique_ptr <unsigned int[]> indices ;
std::unique_ptr <QVector3D[]> normals ;
std::unique_ptr < QVector2D [] > texCoords ;
std::vector <GLuint> shaderProgram ;
QOpenGLWidget * glWidget ;
unsigned int numVertices ;
unsigned int numFaces ;
Material material ;
int shaderIndex = 0;
int numShaders ;
GLuint vao = 0;
GLuint vboVertices = 0;
GLuint vboIndices = 0;
GLuint vboNormals = 0;
GLuint vboTexCoords = 0;
GLuint vboCoordText = 0;
GLuint textureID = 0;
GLuint texturas[2];
QMatrix4x4 modelMatrix ;
QVector3D midPoint ;
double invDiag ;
TrackBall trackBall ;
void createVBOs () ;
void createShaders () ;
void destroyVBOs () ;
void destroyShaders () ;
void readOFFFile ( const QString &fileName ) ;
void loadTextures () ;
void drawModel () ;
void giraX(int x);
void giraY(int y);
void giraZ(int z);
void criaInimigo();
void criaPersonagem();
void createNormals();
void createTexCoords () ;
//verifica se está inicializado
bool inicializado(QOpenGLWidget *_glWidget);
int personagem = 0; //0 = principal, 1 = inimigo
//posição do objeto
double mX = 0;
double mY = 0;
double mZ = 0;
bool colidiu = false;
private:
int x = 0;
int y = 0;
int z = 0;
const QString *fileName = NULL;
};
# endif // MODEL_H