Skylicht Engine
Loading...
Searching...
No Matches
CScene.h
1/*
2!@
3MIT License
4
5Copyright (c) 2019 Skylicht Technology CO., LTD
6
7Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files
8(the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify,
9merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
10subject to the following conditions:
11
12The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
13
14THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
15INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
16IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
17WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19
20This file is part of the "Skylicht Engine".
21https://github.com/skylicht-lab/skylicht-engine
22!#
23*/
24
25#pragma once
26
27#include "GameObject/CZone.h"
28#include "Entity/CEntityManager.h"
29#include "EventManager/CEventManager.h"
30
31#include "RenderPipeline/CForwardRP.h"
32#include "RenderPipeline/CDeferredRP.h"
33
34namespace Skylicht
35{
40
102 class SKYLICHT_API CScene : public IEventReceiver
103 {
104 protected:
105
106 std::wstring m_name;
107 std::string m_namec;
108
109 ArrayZone m_zones;
110
111 CEntityManager* m_entityManager;
112
113 typedef std::pair<std::string, IEventReceiver*> eventType;
114 std::vector<eventType> m_eventReceivers;
115
116 public:
117 CScene();
118 virtual ~CScene();
119
120 void releaseScene();
121
122 inline void setName(const wchar_t* lpName)
123 {
124 m_name = lpName;
125 }
126
127 void setName(const char* lpName);
128
129 const char* getNameA();
130
131 inline const wchar_t* getName()
132 {
133 return m_name.c_str();
134 }
135
136 void setVisibleAllZone(bool b);
137
138 void updateAddRemoveObject();
139
140 void updateIndexSearchObject();
141
142 virtual CGameObject* searchObjectInChild(const wchar_t* name);
143
144 virtual CGameObject* searchObjectInChildByID(const char* id);
145
146 virtual CEntity* searchEntityInChildByID(const char* id);
147
148 u32 searchObjectByCullingLayer(ArrayGameObject& result, u32 mask);
149
150 virtual CZone* createZone();
151
152 virtual void removeZone(CGameObject* zone);
153
154 inline CEntityManager* getEntityManager()
155 {
156 return m_entityManager;
157 }
158
159 inline int getZoneCount()
160 {
161 return (int)m_zones.size();
162 }
163
164 inline CZone* getZone(int i)
165 {
166 return m_zones[i];
167 }
168
169 inline ArrayZone* getAllZone()
170 {
171 return &m_zones;
172 }
173
174 void bringToNext(CZone* object, CZone* target, bool behind);
175
176 CZone* getZoneBefore(CZone* object);
177
178 void registerEvent(const char* name, IEventReceiver* pEvent);
179
180 void unRegisterEvent(IEventReceiver* pEvent);
181
182 virtual bool OnEvent(const SEvent& event);
183
184 virtual void update();
185
186 CObjectSerializable* createSerializable();
187
188 void loadSerializable(CObjectSerializable* object);
189
190 DECLARE_GETTYPENAME(CScene)
191 };
192}
This is the object class that describes an entity.
Definition CEntity.h:58
This object class manages all entities within a scene.
Definition CEntityManager.h:89
This object class stores information for a GameObject.
Definition CGameObject.h:52
Definition CObjectSerializable.h:36
virtual bool OnEvent(const SEvent &event)
Called if an event happened.
It's the primary container object for the CScene; all CGameObject have a CZone as their root parent.
Definition CZone.h:37
Interface of an object which can receive events.
Definition IEventReceiver.h:474
Everything in the Skylicht Engine. You can start by looking at the topics.
Definition AudioDebugLog.h:29
unsigned int u32
32 bit unsigned variable.
Definition irrTypes.h:58
SEvents hold information about an event. See irr::IEventReceiver for details on event handling.
Definition IEventReceiver.h:273