-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathelement.h
More file actions
78 lines (67 loc) · 1.86 KB
/
element.h
File metadata and controls
78 lines (67 loc) · 1.86 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#ifndef GAMEELEMENT_H
#define GAMEELEMENT_H
# ifdef WIN32
# include <windows.h>
# include <wingdi.h>
# endif /* WIN32 */
# ifdef __APPLE__
# include <GLUT/glew.h>
# include <GLUT/glut.h>
# else
# include <GL/glew.h>
# include <GL/glut.h>
# endif
#include <vector>
#include <iostream>
#include <string>
#include <string.h>
#include <cstdio>
#include <math.h>
using namespace std;
typedef struct {
GLfloat x;
GLfloat y;
GLfloat z;
} vec3;
typedef struct {
GLfloat x;
GLfloat y;
} vec2;
typedef struct{
vector<vec2> point;
vec2 center;
GLfloat R;
} boundary;
class Element {
private:
vector<GLfloat> vertices;
vector<GLuint> indices;
vector<GLfloat> texCoords;
vector<GLfloat> normals;
vector<boundary> boundaryBox;
int textureId;
public:
Element();
~Element();
void render(GLuint textures[]);
bool move(GLfloat x, GLfloat y, GLfloat z, vector< vector<boundary> > box, bool force);
void printVector(vector<GLfloat> value, int numberOfCoords);
void printVector(vector<GLuint> value, int numberOfCoords);
void GenerateSide(int coords[], int i, int j, int count, int orientation, float sizeX, float sizeY, float sizeZ, bool isBoundary);
bool load(const char *filename, bool isTexture);
vector<GLfloat> getVertices() const;
void setVertices(const vector<GLfloat> &value);
vector<GLuint> getIndices() const;
void setIndices(const vector<GLuint> &value);
vector<GLfloat> getTexCoords() const;
void setTexCoords(const vector<GLfloat> &value);
vector<GLfloat> getNormals() const;
void setNormals(const vector<GLfloat> &value);
int getTextureId() const;
void setTextureId(int value);
void calculate();
void setBoundary();
vector<boundary> getBoundaryBox() const;
void setBoundaryBox(const vector<boundary> &value);
};
#endif // GAMEELEMENT_H