-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScene.hpp
More file actions
117 lines (99 loc) · 3.17 KB
/
Copy pathScene.hpp
File metadata and controls
117 lines (99 loc) · 3.17 KB
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#pragma once
#include <GL/glew.h>
#include "../../view/SceneObject/SceneObject.hpp"
#include "../../utils/SceneSettings.hpp"
#include "../../model/Camera/Camera.hpp"
#include "../../model/UniqId.hpp"
#include <vector>
#include <memory>
class SceneObject;
class Camera;
class Scene
{
public:
/**
* @brief Construct a new Scene object.
*
* @param sceneSettings : A pointer to the sceneSettings object.
*/
Scene(std::shared_ptr<SceneSettings> sceneSettings, GLFWwindow *window);
/** Delete copy constructor. */
Scene(const Scene &) = delete;
/**
* @brief Destroy the Scene object.
*
*/
~Scene() = default;
/**
* @brief Add an object in the scene. This function updates the object's uniq-id.
* With this function, we can only add newly created object, adding the same object
* twice will lead to an early return -1.
*
* @param object : The new SceneObject to add to the scene.
* @param active=true : True if the object is active by default, false to set it directly inactive.
* @param isChild=false : If true, the object will not be added at the root is the scene because it is a child of another
* object. If false, the object will be added in the Scene's root object list.
* @return T : The object newly added to the scene.
*/
// template<typename T>
std::shared_ptr<SceneObject> Add(std::shared_ptr<SceneObject> object, bool active = true, bool isChild = false);
/**
* @brief Get a SceneObject from it's id.
*
* @param id : The id of the SceneObject to get.
* @return std::shared_ptr<SceneObject> : The SceneObject if it exist, nullptr otherwise.
*/
std::shared_ptr<SceneObject> Get(int id);
// template<typename T>
std::vector<std::shared_ptr<SceneObject>> GetAll(SceneObjectTypes type);
/**
* @brief Remove an object from the scene.
*
* @param id
*/
void Remove(int id);
/**
* @brief Render all active elements in the scene.
*/
void RenderAll();
/**
* @brief Get the currently active camera.
*
* @return const Camera& : A constant ref to the active camera.
*/
std::shared_ptr<Camera> GetActiveCam();
std::shared_ptr<Camera> GetDefaultCam();
std::vector<std::shared_ptr<SceneObject>> &GetSceneObjects();
GLFWwindow *GetWindow();
std::shared_ptr<SceneSettings> GetSceneSettings();
private:
/**
* @brief The scene's settings object.
*
*/
std::shared_ptr<SceneSettings> m_sceneSettings;
/**
* @brief Current Window.
*
*/
GLFWwindow *m_window;
/**
* @brief A manager that handle uniq-ids.
*/
std::shared_ptr<UniqId> m_uniqIdManager;
/**
* @brief The main camera is the default that is used to
* visualise the scene.
*/
std::shared_ptr<Camera> m_mainCamera;
/**
* @brief The active camera is a pointer to another camera.
* By default it points to the mainCamera, but it can point
* to another camera.
*/
std::shared_ptr<Camera> m_activeCamera;
/**
* @brief The list of objects in the scene.
*/
std::vector<std::shared_ptr<SceneObject>> m_objects;
};