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
:
45
Shader
shader
;
46
GLfloat
_vertices
[
verticesSize
];
47
GLuint
_indices
[
indicesSize
];
48
49
Texture
texture
;
50
51
VAO
vao
;
52
VBO
vbo
;
53
EBO
ebo
;
54
55
bool
isPerspective
;
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
WinHeight
const uint32_t WinHeight
Definition:
Cube.hpp:19
verticesSize
const uint16_t verticesSize
Definition:
Cube.hpp:21
indicesSize
const uint8_t indicesSize
Definition:
Cube.hpp:22
WinWidth
const uint32_t WinWidth
Definition:
Cube.hpp:18
EBO.hpp
Shader.hpp
Texture.hpp
VAO.hpp
VBO.hpp
Cube
Definition:
Cube.hpp:24
Cube::view
glm::mat4 view
Definition:
Cube.hpp:61
Cube::setPrespective
void setPrespective(bool view)
Definition:
Cube.cpp:146
Cube::Cube
Cube()
Definition:
Cube.cpp:3
Cube::toggleView
void toggleView()
Definition:
Cube.cpp:136
Cube::ypos
GLfloat ypos
Definition:
Cube.hpp:77
Cube::activateShader
void activateShader()
Definition:
Cube.cpp:134
Cube::model
glm::mat4 model
Definition:
Cube.hpp:58
Cube::move
void move(float z)
Definition:
Cube.cpp:179
Cube::vao
VAO vao
Definition:
Cube.hpp:51
Cube::ebo
EBO ebo
Definition:
Cube.hpp:53
Cube::rotation
float rotation
Definition:
Cube.hpp:74
Cube::scaleUniID
GLuint scaleUniID
Definition:
Cube.hpp:72
Cube::random
GLfloat random()
Definition:
Cube.cpp:181
Cube::zmove
float zmove
Definition:
Cube.hpp:75
Cube::setTexUinform
void setTexUinform()
Definition:
Cube.cpp:114
Cube::texture
Texture texture
Definition:
Cube.hpp:49
Cube::lightPosition
glm::vec3 lightPosition
Definition:
Cube.hpp:70
Cube::setMatUniform
void setMatUniform()
Definition:
Cube.cpp:116
Cube::isPerspective
bool isPerspective
Definition:
Cube.hpp:55
Cube::proj
glm::mat4 proj
Definition:
Cube.hpp:64
Cube::vbo
VBO vbo
Definition:
Cube.hpp:52
Cube::_vertices
GLfloat _vertices[verticesSize]
Definition:
Cube.hpp:46
Cube::~Cube
~Cube()
Definition:
Cube.cpp:102
Cube::lightColor
glm::vec4 lightColor
Definition:
Cube.hpp:67
Cube::draw
void draw()
Definition:
Cube.cpp:148
Cube::setColorUniform
void setColorUniform()
Definition:
Cube.cpp:138
Cube::rotate
void rotate(float r)
Definition:
Cube.cpp:132
Cube::scale
void scale(float s)
Definition:
Cube.cpp:130
Cube::_indices
GLuint _indices[indicesSize]
Definition:
Cube.hpp:47
Cube::shader
Shader shader
Definition:
Cube.hpp:45
Cube::xpos
GLfloat xpos
Definition:
Cube.hpp:77
Cube::setScaleUniform
void setScaleUniform()
Definition:
Cube.cpp:110
EBO
Definition:
EBO.hpp:6
Shader
Definition:
Shader.hpp:10
Texture
Definition:
Texture.hpp:6
VAO
Definition:
VAO.hpp:8
VBO
Definition:
VBO.hpp:6
core
include
Cube.hpp
Generated by
1.9.0