3#include "Components/Core/AnimationComponent.h"
4#include "Components/Core/AssetComponent.h"
5#include "Components/Core/BillboardComponent.h"
6#include "Components/Core/CameraComponent.h"
7#include "Components/Core/CameraArrayComponent.h"
8#include "Components/Core/ClipShapeComponent.h"
9#include "Components/Core/EnvironmentComponent.h"
10#include "Components/Core/FogComponent.h"
11#include "Components/Core/InstancedMeshRenderComponent.h"
12#include "Components/Core/InstancedModelComponent.h"
13#include "Components/Core/LightComponent.h"
14#include "Components/Core/LodComponent.h"
15#include "Components/Core/MeshComponent.h"
16#include "Components/Core/MeshRenderComponent.h"
17#include "Components/Core/ModelComponent.h"
18#include "Components/Core/MotionComponent.h"
19#include "Components/Core/NearLimitComponent.h"
20#include "Components/Core/OverlayComponent.h"
21#include "Components/Core/PropertiesComponent.h"
22#include "Components/Core/RenderComponent.h"
23#include "Components/Core/SceneComponent.h"
24#include "Components/Core/ScriptComponent.h"
25#include "Components/Core/SpriteRenderComponent.h"
26#include "Components/Core/StaticModelComponent.h"
27#include "Components/Core/SubMeshRenderComponent.h"
28#include "Components/Core/SwitchComponent.h"
29#include "Components/Core/TextComponent.h"
30#include "Components/Core/Text3DComponent.h"
31#include "Components/Core/TransformComponent.h"
33#include "Components/Data/DataSetComponent.h"
34#include "Components/Data/TrajectoryComponent.h"
36#include "Components/Geometry/ExtrusionComponent.h"
37#include "Components/Geometry/ShapeComponent.h"
38#include "Components/Geometry/VariableExtrusionComponent.h"
39#include "Components/Geometry/MeshGeneratorComponent.h"
40#include "Components/Geometry/AdaptivePlanarGridComponent.h"
41#include "Components/Geometry/MarkerPointSetComponent.h"
43#include "Components/Appearance/MaterialComponent.h"
44#include "Components/Appearance/ScreenSizeComponent.h"
45#include "Components/Appearance/TextureGeneratorComponent.h"
46#include "Components/Appearance/FontSelectorComponent.h"
47#include "Components/Appearance/BasicOceanComponent.h"
48#include "Components/Appearance/BasicTerrainComponent.h"
50#include "Components/Layout/TrajectoryLayoutComponent.h"
52#include "Components/Behavior/TrajectoryAlignedComponent.h"
53#include "Components/Behavior/ReflectionComponent.h"
54#include "Components/Behavior/CurvedEarthPositionComponent.h"
55#include "Components/Behavior/ExpressionComponent.h"
56#include "Components/Behavior/FPSNavigationComponent.h"
57#include "Components/Behavior/OrbitingCameraController.h"
58#include "Components/Behavior/TeleportNavigationComponent.h"
59#include "Components/Behavior/PickingBeamComponent.h"
61#include "../Extensions/Components/FollowComponent.h"
63#include "Generators/MeshGenerator.h"
64#include "Generators/TextureGenerator.h"
65#include "Services/PipelineService.h"
67#include "Resources/ResourceFlags.h"
69#include "Input/InputDeviceType.h"
71#include "Renderer/IRenderer.h"
73#include "Foundation/Platform/Keyboard.h"
74#include "Foundation/Platform/Gestures.h"
78template<>
Cogs::StringView getName<Cogs::Core::EntityFind>() {
return "EntityFind"; }
79template<>
Cogs::StringView getName<Cogs::Core::RenderMode>() {
return "RenderMode"; }
80template<>
Cogs::StringView getName<Cogs::Core::InputDeviceType>() {
return "InputDeviceType"; }
82void Cogs::Core::initializeTypes()
89 Field vec2Fields[] = {
98 TypeDatabase::createType<glm::vec2>().setFields(vec2Fields);
100 Field vec3Fields[] = {
109 TypeDatabase::createType<glm::vec3>().setFields(vec3Fields);
111 Field vec4Fields[] = {
122 TypeDatabase::createType<glm::vec4>().setFields(vec4Fields);
124 TypeDatabase::createType<glm::quat>().setFields(vec4Fields);;
125 TypeDatabase::createType<glm::mat4>();
127 TypeDatabase::createType<glm::dvec2>();
128 TypeDatabase::createType<glm::dvec3>();
129 TypeDatabase::createType<glm::dvec4>();
130 TypeDatabase::createType<glm::dquat>();
131 TypeDatabase::createType<glm::dmat4>();
133 Field ivec2Fields[] = {
139 TypeDatabase::createType<glm::ivec2>().setFields(ivec2Fields);
140 Field ivec3Fields[] = {
148 TypeDatabase::createType<glm::ivec3>().setFields(ivec3Fields);
149 Field ivec4Fields[] = {
159 TypeDatabase::createType<glm::ivec4>().setFields(ivec4Fields);
160 Field uvec2Fields[] = {
166 TypeDatabase::createType<glm::uvec2>().setFields(uvec2Fields);
167 Field uvec3Fields[] = {
175 TypeDatabase::createType<glm::uvec3>().setFields(uvec3Fields);
176 Field uvec4Fields[] = {
186 TypeDatabase::createType<glm::uvec4>().setFields(uvec4Fields);
188 TypeDatabase::createType<std::vector<glm::vec2>>();
189 TypeDatabase::createType<std::vector<glm::vec3>>();
190 TypeDatabase::createType<std::vector<glm::vec4>>();
191 TypeDatabase::createType<std::vector<glm::mat4>>();
192 TypeDatabase::createType<std::vector<glm::quat>>();
194 TypeDatabase::createType<std::vector<glm::dvec2>>();
195 TypeDatabase::createType<std::vector<glm::dvec3>>();
196 TypeDatabase::createType<std::vector<glm::dvec4>>();
197 TypeDatabase::createType<std::vector<glm::dmat4>>();
198 TypeDatabase::createType<std::vector<glm::dquat>>();
200 TypeDatabase::createType<EntityPtr>();
201 TypeDatabase::createType<WeakEntityPtr>();
202 TypeDatabase::createType<std::vector<EntityPtr>>();
203 TypeDatabase::createType<std::vector<WeakEntityPtr>>();
205 TypeDatabase::createType<ResourceBufferHandle>();
206 TypeDatabase::createType<MeshHandle>();
207 TypeDatabase::createType<ModelHandle>();
208 TypeDatabase::createType<MaterialHandle>();
209 TypeDatabase::createType<MaterialInstanceHandle>();
210 TypeDatabase::createType<FontHandle>();
211 TypeDatabase::createType<TextureHandle>();
212 TypeDatabase::createType<AnimationHandle>();
213 TypeDatabase::createType<GuiDocumentHandle>();
214 TypeDatabase::createType<AssetHandle>();
216 TypeDatabase::createType<std::vector<TextureHandle>>();
217 TypeDatabase::createType<std::vector<MaterialHandle>>();
218 TypeDatabase::createType<std::vector<MaterialInstanceHandle>>();
220 TypeDatabase::createType<BufferView<uint32_t>>();
221 TypeDatabase::createType<BufferView<float>>();
222 TypeDatabase::createType<BufferView<glm::vec3>>();
223 TypeDatabase::createType<BufferView<glm::vec4>>();
226 {
"A", Cogs::Key::A },
227 {
"B", Cogs::Key::B },
228 {
"C", Cogs::Key::C },
229 {
"D", Cogs::Key::D },
230 {
"E", Cogs::Key::E },
231 {
"F", Cogs::Key::F },
232 {
"G", Cogs::Key::G },
233 {
"H", Cogs::Key::H },
234 {
"I", Cogs::Key::I },
235 {
"J", Cogs::Key::J },
236 {
"K", Cogs::Key::K },
237 {
"L", Cogs::Key::L },
238 {
"M", Cogs::Key::M },
239 {
"N", Cogs::Key::N },
240 {
"O", Cogs::Key::O },
241 {
"P", Cogs::Key::P },
242 {
"Q", Cogs::Key::Q },
243 {
"R", Cogs::Key::R },
244 {
"S", Cogs::Key::S },
245 {
"T", Cogs::Key::T },
246 {
"U", Cogs::Key::U },
247 {
"V", Cogs::Key::V },
248 {
"W", Cogs::Key::W },
249 {
"X", Cogs::Key::X },
250 {
"Y", Cogs::Key::Y },
251 {
"Z", Cogs::Key::Z },
252 {
"Zero", Cogs::Key::Zero },
253 {
"One", Cogs::Key::One },
254 {
"Two", Cogs::Key::Two },
255 {
"Three", Cogs::Key::Three },
256 {
"Four", Cogs::Key::Four },
257 {
"Five", Cogs::Key::Five },
258 {
"Six", Cogs::Key::Six },
259 {
"Seven", Cogs::Key::Seven },
260 {
"Eight", Cogs::Key::Eight },
261 {
"Nine", Cogs::Key::Nine },
262 {
"Left", Cogs::Key::Left },
263 {
"Right", Cogs::Key::Right },
264 {
"Up", Cogs::Key::Up },
265 {
"Down", Cogs::Key::Down },
266 {
"Shift", Cogs::Key::Shift },
267 {
"LeftShift", Cogs::Key::LeftShift },
268 {
"RightShift", Cogs::Key::RightShift },
269 {
"Control", Cogs::Key::Control },
270 {
"LeftControl", Cogs::Key::LeftControl },
271 {
"RightControl", Cogs::Key::RightControl },
272 {
"Alt", Cogs::Key::Alt },
273 {
"LeftAlt", Cogs::Key::LeftAlt },
274 {
"RightAlt", Cogs::Key::RightAlt },
275 {
"CapsLock", Cogs::Key::CapsLock },
276 {
"Tab", Cogs::Key::Tab },
277 {
"Escape", Cogs::Key::Escape },
278 {
"Enter", Cogs::Key::Enter },
279 {
"Space", Cogs::Key::Space },
280 {
"Insert", Cogs::Key::Insert },
281 {
"Delete", Cogs::Key::Delete },
282 {
"Backspace", Cogs::Key::Backspace },
283 {
"Home", Cogs::Key::Home },
284 {
"End", Cogs::Key::End },
285 {
"PageUp", Cogs::Key::PageUp },
286 {
"PageDown", Cogs::Key::PageDown },
287 {
"F1", Cogs::Key::F1 },
288 {
"F2", Cogs::Key::F2 },
289 {
"F3", Cogs::Key::F3 },
290 {
"F4", Cogs::Key::F4 },
291 {
"F5", Cogs::Key::F5 },
292 {
"F6", Cogs::Key::F6 },
293 {
"F7", Cogs::Key::F7 },
294 {
"F8", Cogs::Key::F8 },
295 {
"F9", Cogs::Key::F9 },
296 {
"F10", Cogs::Key::F10 },
297 {
"F11", Cogs::Key::F11 },
298 {
"F12", Cogs::Key::F12 },
299 {
"None", Cogs::Key::None },
301 static_assert(std::size(keys) ==
static_cast<size_t>(Cogs::Key::Count) + 1);
302 TypeDatabase::createType<Cogs::Key>().setEnumerators(keys);
305 {
"Touch", Cogs::PointerType::Touch },
306 {
"Mouse", Cogs::PointerType::Mouse },
308 static_assert(std::size(pointerTypes) ==
static_cast<size_t>(Cogs::PointerType::Count));
309 TypeDatabase::createType<Cogs::PointerType>().setEnumerators(pointerTypes);
312 {
"Left", Cogs::MouseButton::Left },
313 {
"Right", Cogs::MouseButton::Right },
314 {
"Middle", Cogs::MouseButton::Middle },
316 static_assert(std::size(mouseButtons) ==
static_cast<size_t>(Cogs::MouseButton::Count));
317 TypeDatabase::createType<Cogs::MouseButton>().setEnumerators(mouseButtons);
320 {
"None", InputDeviceType::None },
321 {
"Keyboard", InputDeviceType::Keyboard },
322 {
"Mouse", InputDeviceType::Mouse },
324 TypeDatabase::createType<Cogs::Core::InputDeviceType>().setEnumerators(inputDeviceTypes).setEnumFlags();
329 {
"Mirror", SamplerState::AddressMode::Mirror },
330 {
"Border", SamplerState::AddressMode::Border },
332 static_assert(std::size(addressModes) ==
static_cast<size_t>(Cogs::SamplerState::AddressMode::AddressMode_Size));
333 TypeDatabase::createType<Cogs::SamplerState::AddressMode>().setEnumerators(addressModes);
336 {
"MinMagMipPoint", SamplerState::FilterMode::MinMagMipPoint },
337 {
"MinMagMipLinear", SamplerState::FilterMode::MinMagMipLinear },
338 {
"ComparisonMinMagMipPoint", SamplerState::FilterMode::ComparisonMinMagMipPoint },
339 {
"ComparisonMinMagMipLinear", SamplerState::FilterMode::ComparisonMinMagMipLinear },
341 static_assert(std::size(filterModes) ==
static_cast<size_t>(Cogs::SamplerState::FilterMode::FilterMode_Size));
342 TypeDatabase::createType<Cogs::SamplerState::FilterMode>().setEnumerators(filterModes);
345 {
"None", Cogs::FileContentsHints::None },
349 TypeDatabase::createType<Cogs::FileContentsHints>().setEnumerators(fileContentHints);
351 registerResourceFlagTypes();
353 MeshComponent::registerType();
354 TransformComponent::registerType();
355 SceneComponent::registerType();
356 RenderComponent::registerType();
357 MeshRenderComponent::registerType();
358 SubMeshRenderComponent::registerType();
359 InstancedMeshRenderComponent::registerType();
360 SpriteRenderComponent::registerType();
361 TextComponent::registerType();
362 Text3DComponent::registerType();
363 BillboardComponent::registerType();
364 OverlayComponent::registerType();
365 LightComponent::registerType();
366 CameraComponent::registerType();
367 CameraArrayComponent::registerType();
368 ClipShapeComponent::registerType();
369 ClipShapeRefComponent::registerType();
370 FogComponent::registerType();
371 LodComponent::registerType();
372 ScriptComponent::registerType();
373 EnvironmentComponent::registerType();
374 AnimationComponent::registerType();
375 AssetComponent::registerType();
376 PropertiesComponent::registerType();
378 MeshGeneratorComponent::registerType();
379 ScreenSizeComponent::registerType();
380 TextureGeneratorComponent::registerType();
381 TrajectoryComponent::registerType();
382 ExtrusionComponent::registerType();
383 MaterialComponent::registerType();
384 ShapeComponent::registerType();
385 ModelComponent::registerType();
386 InstancedModelComponent::registerType();
387 StaticModelComponent::registerType();
388 TrajectoryLayoutComponent::registerType();
389 DataSetComponent::registerType();
390 VariableExtrusionComponent::registerType();
391 AdaptivePlanarGridComponent::registerType();
394 DynamicComponent::registerType();
395 MotionComponent::registerType();
396 SwitchComponent::registerType();
397 FollowComponent::registerType();
398 MarkerPointSetComponent::registerType();
399 BasicTerrainComponent::registerType();
401 TrajectoryAlignedComponent::registerType();
402 FPSNavigationComponent::registerType();
403 OrbitingCameraController::registerType();
404 TeleportNavigationComponent::registerType();
405 PickingBeamComponent::registerType();
406 CurvedEarthPositionComponent::registerType();
407 ReflectionComponent::registerType();
408 NearLimitComponent::registerType();
409 ExpressionComponent::registerType();
411 FontSelectorComponent::registerType();
412 BasicOceanComponent::registerType();
414 Reflection::TypeDatabase::createType<MeshGenerator>();
415 Reflection::TypeDatabase::createType<TextureGenerator>();
416 Reflection::TypeDatabase::createType<PipelineService>();
419 {
"Default", GraphicsDeviceType::Default },
420 {
"Default", GraphicsDeviceType::Unknown },
421 {
"Direct3D11", GraphicsDeviceType::Direct3D11 },
422 {
"Direct3D12", GraphicsDeviceType::Direct3D12 },
423 {
"Vulkan", GraphicsDeviceType::Vulkan },
424 {
"OpenGL20", GraphicsDeviceType::OpenGL20 },
425 {
"OpenGLES30", GraphicsDeviceType::OpenGLES30 },
426 {
"WebGPU", GraphicsDeviceType::WebGPU },
427 {
"Null", GraphicsDeviceType::Null },
430 Reflection::TypeDatabase::createType<GraphicsDeviceType>().setEnumerators(enums);
433 {
"Default", EntityFind::Default },
434 {
"PartialNameMatch", EntityFind::PartialNameMatch },
435 {
"NonRecursive", EntityFind::NonRecursive },
437 Reflection::TypeDatabase::createType<EntityFind>().setEnumerators(entityFindEnums).
441 {
"Normal", RenderMode::Normal },
442 {
"Wireframe", RenderMode::Wireframe },
443 {
"Box", RenderMode::Box },
445 Reflection::TypeDatabase::createType<RenderMode>().setEnumerators(renderModeEnums);
448 {
"Less", DepthFunc::Less },
449 {
"LessOrEqual", DepthFunc::LessOrEqual },
450 {
"Always", DepthFunc::Always },
451 {
"NotEqual", DepthFunc::NotEqual },
452 {
"Equal", DepthFunc::Equal },
454 Reflection::TypeDatabase::createType<DepthFunc>().setEnumerators(depthFuncEnums);
458void Cogs::Core::cleanupTypes() {
459 Reflection::TypeDatabase::clear();
static COGSFOUNDATION_API void registerType()
Register the Component type in the global type database.
static void registerType()
Register the Entity type in the global type database.
Field definition describing a single data member of a data structure.
static void initializeBaseTypes()
Initialize the set of types describing built in C++ types like int, float etc.
Provides a weakly referenced view over the contents of a string.
Contains reflection support.
@ BrotliDecompress
A hint that the contents are Brotli (Google) compressed and is allowed to be decompressed during tran...
@ ZStdDecompress
A hint that the contents are Zstandard (Facebook) compressed and is allowed to be decompressed during...
Represents an unique name.
@ Clamp
Texture coordinates are clamped to the [0, 1] range.
@ Wrap
Texture coordinates automatically wrap around to [0, 1] range.