sculpto
scene.h
Go to the documentation of this file.
1/*!****************************************************************//*!*
2 * \file scene.h
3 * \brief Scene class defintion module.
4 *
5 * \author Sabitov Kirill
6 * \date 02 July 2022
7 *********************************************************************/
8
9#pragma once
10
11#include <entt.hpp>
12#include "base.h"
13
14namespace scl
15{
17 class event;
18 class scene_object;
19 class frame_buffer;
20 class shader;
21 class mesh;
22
23 using scene_object_handle = entt::entity;
24
26 class scene
27 {
28 friend class scene_object;
29 friend class scene_serializer;
31
32 private:
33 entt::registry Registry {};
37 int ViewportId { 30 };
38 int ViewportWidth { 16 };
39 int ViewportHeight { 16 };
40 vec3 EnviromentAmbient { 0.1f };
41 float UpdateDelay {};
43 public:
45 int GetViewportId() const { return ViewportId; }
47 const vec3 &GetEnviromentAmbient() const { return EnviromentAmbient; }
48
50 void SetViewportId(int ViewportId) { this->ViewportId = ViewportId; }
52 void SetEnviromentAmbient(const vec3 &EnviromentAmbient) { this->EnviromentAmbient = EnviromentAmbient; }
53
54 private:
55 /*!*
56 * Perform scene scripts OnUpdate functions calls function.
57 *
58 * \param None.
59 * \return None.
60 */
61 void CallUpdate();
62
63 public:
65 scene();
66
68 ~scene();
69
70 /*!*
71 * Perform scene rendering function.
72 *
73 * \param None.
74 * \return None.
75 */
76 void Render();
77
78 /*!*
79 * Scene update function.
80 *
81 * \param None.
82 * \return None.
83 */
84 void Update();
85
86 /*!*
87 * Create scene object function.
88 *
89 * \param Name - object name (mainly for debug purpose).
90 * \return created object.
91 */
92 scene_object CreateObject(const std::string &Name = "");
93
94 /*!*
95 * Get first scene object with specified name (ordered by creating time) or create new, if nothing found function.
96 *
97 * \param Name - name of getting/creating object.
98 * \return found/created scene object.
99 */
100 scene_object CreaetOrGetObject(const std::string &Name);
101
102 /*!*
103 * Get scene object by its handle function.
104 *
105 * \param SceneObjectEntity - handle of getting scene object.
106 * \return scene object.
107 */
109
110 void RemoveObject(scene_object &Object);
111 };
112}
Topology object basis class for mesh creating implementation module.
void Update()
Definition: scene.cpp:63
scene_object CreateObject(const std::string &Name="")
Definition: scene.cpp:107
int GetViewportId() const
Definition: scene.h:45
~scene()
Definition: scene.cpp:41
void SetEnviromentAmbient(const vec3 &EnviromentAmbient)
Definition: scene.h:52
void RemoveObject(scene_object &Object)
Definition: scene.cpp:126
void Render()
Definition: scene.cpp:71
scene_object GetSceneObject(scene_object_handle SceneObjectHandle)
Definition: scene.cpp:121
scene_object CreaetOrGetObject(const std::string &Name)
Definition: scene.cpp:114
const vec3 & GetEnviromentAmbient() const
Definition: scene.h:47
void SetViewportId(int ViewportId)
Definition: scene.h:50
Definition: base.h:33
entt::entity scene_object_handle
Definition: scene.h:23
math::vec3< float > vec3
Definition: base.h:38