-
Notifications
You must be signed in to change notification settings - Fork 1
/
Room.h
76 lines (65 loc) · 2.29 KB
/
Room.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 <memory>
#include <vector>
#include "Wall.h"
class ModelContainer;
class Floor;
class QOpenGLWidget;
///
/// \brief The Room class
/// A room with 3 walls, allow setting the color and texture ,binding of models to floor and wall
///
class Room
{
GLfloat width;
QOpenGLWidget* targetWidget = nullptr;
unique_ptr<Floor> floor;
vector<shared_ptr<Wall>> walls;
// Color for wall and floor
glm::vec3 wallColor, floorColor;
// Texture file path for wall and floor
string wallTexture, floorTexture;
public:
///
/// \brief Room Creates the room with specific widths and colors
/// \param targetWidget target width
/// \param roomWidth room width
/// \param wallColor wall color
/// \param floorColor floor color
///
Room(QOpenGLWidget* targetWidget, GLfloat roomWidth, glm::vec3 wallColor, glm::vec3 floorColor);
~Room();
Floor* GetFloor() const { return floor.get(); }
vector<shared_ptr<Wall>> GetWalls() const { return walls; }
// Getters and setters for colors
void SetWallColor(glm::vec3 wallColor);
glm::vec3 GetWallColor() const { return wallColor; }
void SetFloorColor(glm::vec3 floorColor);
glm::vec3 GetFloorColor() const { return floorColor; }
// Getters and setters for textures
void SetWallTexture(string wallTexture);
string GetWallTexture() const { return wallTexture; }
void SetFloorTexture(string floorTexture);
string GetFloorTexture() const { return floorTexture; }
glm::vec3 GetMinimumCoordinates() const;
glm::vec3 GetMaximumCoordinates() const;
///
/// \brief Draw Draws the room floor and walls
/// \param view view matrix
/// \param projection projection matrix
///
void Draw(glm::mat4 const& view, glm::mat4 const& projection) const;
///
/// \brief BindToFloor binds the specific model container to the floor y axis and allows movement in xz plane
/// \param container
///
void BindToFloor(ModelContainer* container);
///
/// \brief BindToWall binds the specific model container to the wall
/// \param container
/// \param wallLocation
///
void BindToWall(ModelContainer* container, Location wallLocation);
bool IsAttached(ModelContainer* container, Location wallLocation);
};