-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPBox.h
77 lines (58 loc) · 1.73 KB
/
PBox.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
#pragma once
#ifndef PBOX
#define PBOX
// Include
#include <GL\glew\glew.h>
#include <GL\GLSLFactory.h>
#include <GL\CGTextureLoader.h>
#include <CoreStructures\GUMatrix4.h>
#include <CoreStructures\GUVector2.h>
#include <CoreStructures\GUVector4.h>
// ---------------------------------------------------------------------
// PBox (Project Box) - Used to render boxes (cubes) on the map
// ---------------------------------------------------------------------
class PBox
{
// ---------------------------------------------------------------------
private:
// ATTRIBUTES
// Position and scale vectors
CoreStructures::GUVector4 pos;
CoreStructures::GUVector4 scale;
// Vertex, Index and texture coordinate data
CoreStructures::GUVector4 vertices[8];
CoreStructures::GUVector2 texcoord[8];
GLuint indices[30];
// Vertex Array Object & Vertex Buffer Objects
GLuint VAO_box;
GLuint VBO_position;
GLuint VBO_index;
GLuint VBO_texture;
// Texture
GLuint texture;
// Shader
GLuint shader;
// METHODS
void loadShader();
void loadTexture();
void setupVertexData();
void setupVertexArrayObject();
// ---------------------------------------------------------------------
public:
// Constructor / Decontructor
PBox();
~PBox();
// Overloaded Constructor to initilise Position
PBox(CoreStructures::GUVector4 position);
// Initialise
void Initialise();
// Render
void Render(const CoreStructures::GUMatrix4& T);
// Getters and Setters
CoreStructures::GUVector4 getPosition();
void setPosition(CoreStructures::GUVector4 position);
void setPosition(float x, float y, float z);
void setScale(CoreStructures::GUVector4 newScale);
void setTexture(const std::wstring filePath);
};
#endif