Voxeloop  0.1.0
Musical Loop Generation in Voxel World
Cube.hpp
Go to the documentation of this file.
1 #ifndef CORE_INCLUDE_CUBE_HPP
2 #define CORE_INCLUDE_CUBE_HPP
3 
4 // clang-format off
5 #include <glad/gl.h>
6 #include <GLFW/glfw3.h>
7 // clang-format on
8 #include <glm/glm.hpp>
9 #include <glm/gtc/matrix_transform.hpp>
10 #include <glm/gtc/type_ptr.hpp>
11 
12 #include "EBO.hpp"
13 #include "Shader.hpp"
14 #include "Texture.hpp"
15 #include "VAO.hpp"
16 #include "VBO.hpp"
17 
18 const uint32_t WinWidth = 800;
19 const uint32_t WinHeight = 800;
20 
21 const uint16_t verticesSize = 264;
22 const uint8_t indicesSize = 36;
23 
24 class Cube {
25 public:
26  Cube();
27  ~Cube();
28 
29  void setScaleUniform();
30  void setTexUinform();
31  void setMatUniform();
32  void setColorUniform();
33 
34  void scale(float s);
35  void rotate(float r);
36 
37  void move(float z);
38 
39  void activateShader();
40  void draw();
41  void toggleView();
42  void setPrespective(bool view);
43 
44 private:
48 
50 
54 
56 
57  // Model Matrix
58  glm::mat4 model;
59 
60  // View Matrix
61  glm::mat4 view;
62 
63  // Projection Matrix
64  glm::mat4 proj;
65 
66  // Light Color
67  glm::vec4 lightColor;
68 
69  // Light Position
70  glm::vec3 lightPosition;
71 
72  GLuint scaleUniID;
73 
74  float rotation = 0.0f;
75  float zmove = 0.0f;
76 
77  GLfloat xpos, ypos;
78 
79  GLfloat random();
80 };
81 
82 #endif // CORE_INCLUDE_CUBE_HPP
const uint32_t WinHeight
Definition: Cube.hpp:19
const uint16_t verticesSize
Definition: Cube.hpp:21
const uint8_t indicesSize
Definition: Cube.hpp:22
const uint32_t WinWidth
Definition: Cube.hpp:18
Definition: Cube.hpp:24
glm::mat4 view
Definition: Cube.hpp:61
void setPrespective(bool view)
Definition: Cube.cpp:146
Cube()
Definition: Cube.cpp:3
void toggleView()
Definition: Cube.cpp:136
GLfloat ypos
Definition: Cube.hpp:77
void activateShader()
Definition: Cube.cpp:134
glm::mat4 model
Definition: Cube.hpp:58
void move(float z)
Definition: Cube.cpp:179
VAO vao
Definition: Cube.hpp:51
EBO ebo
Definition: Cube.hpp:53
float rotation
Definition: Cube.hpp:74
GLuint scaleUniID
Definition: Cube.hpp:72
GLfloat random()
Definition: Cube.cpp:181
float zmove
Definition: Cube.hpp:75
void setTexUinform()
Definition: Cube.cpp:114
Texture texture
Definition: Cube.hpp:49
glm::vec3 lightPosition
Definition: Cube.hpp:70
void setMatUniform()
Definition: Cube.cpp:116
bool isPerspective
Definition: Cube.hpp:55
glm::mat4 proj
Definition: Cube.hpp:64
VBO vbo
Definition: Cube.hpp:52
GLfloat _vertices[verticesSize]
Definition: Cube.hpp:46
~Cube()
Definition: Cube.cpp:102
glm::vec4 lightColor
Definition: Cube.hpp:67
void draw()
Definition: Cube.cpp:148
void setColorUniform()
Definition: Cube.cpp:138
void rotate(float r)
Definition: Cube.cpp:132
void scale(float s)
Definition: Cube.cpp:130
GLuint _indices[indicesSize]
Definition: Cube.hpp:47
Shader shader
Definition: Cube.hpp:45
GLfloat xpos
Definition: Cube.hpp:77
void setScaleUniform()
Definition: Cube.cpp:110
Definition: EBO.hpp:6
Definition: Shader.hpp:10
Definition: Texture.hpp:6
Definition: VAO.hpp:8
Definition: VBO.hpp:6