-
Notifications
You must be signed in to change notification settings - Fork 1
/
Floor.h
76 lines (66 loc) · 1.71 KB
/
Floor.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
#pragma once
#include "Includes.h"
#include <QOpenGLWidget>
#include "Shader.h"
///
/// \brief The FloorRenderMode enum for the color and texture
///
enum FloorRenderMode
{
FLOOR_COLOR,
FLOOR_TEXTURE
};
///
/// \brief The Floor class
/// allows the adding of colors and texture to the floor using shaders.
///
class Floor
{
QOpenGLWidget* targetWidget = nullptr;
GLfloat width = 10.0f;
GLuint floorVao = 0;
GLuint floorVbo = 0;
GLuint floorEbo = 0;
GLuint bottomFloorVao = 0;
GLuint bottomFloorVbo = 0;
GLuint bottomFloorEbo = 0;
unique_ptr<Shader> shader;
FloorRenderMode renderMode; // Wether to use color or texture to render
glm::vec3 color;
GLuint textureId;
void BufferData() const;
public:
///
/// \brief Floor creates the array buffers and the shader
/// \param targetWidget target width
/// \param width the width in floating point value
///
explicit Floor(QOpenGLWidget* targetWidget, GLfloat width);
~Floor();
///
/// \brief SetColor
/// \param color
///
void SetColor(glm::vec3 color);
///
/// \brief GetColor
/// \return
///
glm::vec3 GetColor() const { return color; }
///
/// \brief SetTexture setter for texture
/// \param textureFilePath
///
void SetTexture(string textureFilePath);
///
/// \brief GetTextureId getter for texture
/// \return
///
GLuint GetTextureId() const { return textureId; }
///
/// \brief Draw sets the color texture of the bottom and main floors
/// \param view view matrix
/// \param projection projection matrix
///
void Draw(glm::mat4 const& view, glm::mat4 const& projection) const;
};