Skip to main content

EngineWorld.ixx File

Aggregate world that routes typed handles to their domain-specific TypedHandleWorld. More...

Included Headers

Namespaces Index

namespacehelios
namespaceengine
namespaceruntime
namespaceworld

Classes Index

classEngineWorld

Aggregate runtime world for game objects, platform entities, and rendering domains. More...

Variables Index

template <typename T>
constexpr booltyped_false = false

Description

Aggregate world that routes typed handles to their domain-specific TypedHandleWorld.

Variables

typed_false

template <typename T>
constexpr bool typed_false = false
constexpr

Definition at line 66 of file EngineWorld.ixx.

66inline constexpr bool typed_false = false;

File Listing

The file content with the documentation metadata removed is:

1
5module;
6
7#include <imgui_internal.h>
8#include <tuple>
9#include <type_traits>
10
11export module helios.engine.runtime.world.EngineWorld;
12
13import helios.ecs;
14
15import helios.engine.runtime.world.GameObjectEntityManager;
16
17import helios.engine.platform.window.WindowEntityManager;
18import helios.engine.platform.window.concepts;
19import helios.engine.platform.window.types;
20
21import helios.engine.platform.environment.PlatformEntityManager;
22import helios.engine.platform.environment.types;
23
24import helios.engine.platform.concepts;
25import helios.engine.rendering.common.concepts;
26
27import helios.engine.rendering.shader.ShaderEntityManager;
28import helios.engine.rendering.material.MaterialEntityManager;
29import helios.engine.rendering.mesh.MeshEntityManager;
30
31import helios.engine.runtime.world.concepts.IsGameObjectHandle;
32import helios.engine.runtime.world.types.GameObjectHandle;
33
34import helios.engine.platform.window.concepts;
35import helios.engine.rendering.common.concepts.IsRenderResourceHandle;
36
37import helios.engine.rendering.common.concepts;
38
39import helios.engine.scene.SceneEntityManager;
40import helios.engine.scene.concepts;
41
42import helios.engine.rendering.viewport.ViewportEntityManager;
43import helios.engine.rendering.renderTarget.RenderTargetEntityManager;
44
45import helios.engine.core.TypedTupleCat;
46
47using namespace helios::ecs;
50using namespace helios::engine::platform::concepts;
53using namespace helios::engine::platform::window::concepts;
55using namespace helios::engine::runtime::world::concepts;
59using namespace helios::engine::rendering::common::concepts;
62using namespace helios::engine::scene;
63using namespace helios::engine::scene::concepts;
64
65template<typename T>
66inline constexpr bool typed_false = false;
67
68template<typename T>
69concept IsGameplaySystemHandle = IsGameObjectHandle<T> || helios::engine::scene::concepts::IsSceneHandle<T>;
70
71export namespace helios::engine::runtime::world {
72
77
82
87
92
97 GameObjectWorld::EntityManager_types,
98 RenderResourceWorld::EntityManager_types,
99 PlatformWorld::EntityManager_types,
100 RenderTargetWorld::EntityManager_types
101 >::type;
102
107
108 GameObjectWorld gameObjectWorld_{};
109 RenderResourceWorld renderResourceWorld_{};
110 PlatformWorld platformWorld_{};
111 RenderTargetWorld renderTargetWorld_{};
112
113 public:
114
116 return gameObjectWorld_;
117 }
118
120 return platformWorld_;
121 }
122
124 return renderResourceWorld_;
125 }
126
128 return renderTargetWorld_;
129 }
130
131 template<typename THandle>
132 [[nodiscard]] auto clone(THandle source) noexcept {
133
134 if constexpr(IsGameplaySystemHandle<THandle>) {
135 return gameObjectWorld_.cloneEntity<THandle>(source);
136 } else if constexpr(IsAnyPlatformHandle<THandle>){
137 return platformWorld_.cloneEntity<THandle>(source);
138 } else if constexpr(IsRenderResourceHandle<THandle>) {
139 return renderResourceWorld_.cloneEntity<THandle>(source);
140 } else if constexpr(IsRenderTargetHandle<THandle>) {
141 return renderTargetWorld_.cloneEntity<THandle>(source);
142 } else {
143 static_assert(typed_false<THandle>, "Unsupported handle type for cloning");
144 }
145 }
146
147
148 template<typename THandle>
149 [[nodiscard]] auto find(THandle handle) noexcept {
150 if constexpr(IsGameplaySystemHandle<THandle>) {
151 return gameObjectWorld_.findEntity<THandle>(handle);
152 } else if constexpr(IsAnyPlatformHandle<THandle>) {
153 return platformWorld_.findEntity<THandle>(handle);
154 } else if constexpr(IsRenderResourceHandle<THandle>) {
155 return renderResourceWorld_.findEntity<THandle>(handle);
156 } else if constexpr(IsRenderTargetHandle<THandle>) {
157 return renderTargetWorld_.findEntity<THandle>(handle);
158 } else {
159 static_assert(typed_false<THandle>, "Unsupported handle type for searching");
160 }
161 }
162
163 template<typename THandle>
164 [[nodiscard]] auto add(typename THandle::StrongId_type strongId = typename THandle::StrongId_type{}) {
165 if constexpr(IsGameplaySystemHandle<THandle>) {
166 return gameObjectWorld_.addEntity<THandle>(strongId);
167 } else if constexpr(IsAnyPlatformHandle<THandle>) {
168 return platformWorld_.addEntity<THandle>(strongId);
169 } else if constexpr(IsRenderResourceHandle<THandle>) {
170 return renderResourceWorld_.addEntity<THandle>(strongId);
171 } else if constexpr(IsRenderTargetHandle<THandle>) {
172 return renderTargetWorld_.addEntity<THandle>(strongId);
173 } else {
174 static_assert(typed_false<THandle>, "Unsupported handle type for adding");
175 }
176 }
177
178
179 template<typename THandle, typename... TComponents>
180 [[nodiscard]] auto view() {
181 if constexpr(IsGameplaySystemHandle<THandle>) {
182 return gameObjectWorld_.template view<THandle, TComponents...>();
183 } else if constexpr(IsAnyPlatformHandle<THandle>) {
184 return platformWorld_.template view<THandle, TComponents...>();
185 } else if constexpr(IsRenderResourceHandle<THandle>) {
186 return renderResourceWorld_.template view<THandle, TComponents...>();
187 } else if constexpr(IsRenderTargetHandle<THandle>) {
188 return renderTargetWorld_.template view<THandle, TComponents...>();
189 } else {
190 static_assert(typed_false<THandle>, "Unsupported handle type for viewing");
191 }
192
193 }
194
195 template<typename THandle>
196 [[nodiscard]] auto destroy(const THandle handle) {
197 if constexpr(IsGameplaySystemHandle<THandle>) {
198 return gameObjectWorld_.destroy<THandle>(handle);
199 } else if constexpr(IsAnyPlatformHandle<THandle>) {
200 return platformWorld_.destroy<THandle>(handle);
201 } else if constexpr(IsRenderResourceHandle<THandle>) {
202 return renderResourceWorld_.destroy<THandle>(handle);
203 } else if constexpr(IsRenderTargetHandle<THandle>) {
204 return renderTargetWorld_.destroy<THandle>(handle);
205 } else {
206 static_assert(typed_false<THandle>, "Unsupported handle type for destroying");
207 }
208
209 }
210
211
212
213 };
214
215}

Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.8.