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/CaptureComponent.h"
9#include "Components/Core/ClipShapeComponent.h"
10#include "Components/Core/EnvironmentComponent.h"
11#include "Components/Core/FogComponent.h"
12#include "Components/Core/InstancedMeshRenderComponent.h"
13#include "Components/Core/InstancedModelComponent.h"
14#include "Components/Core/LightComponent.h"
15#include "Components/Core/LodComponent.h"
16#include "Components/Core/MeshComponent.h"
17#include "Components/Core/MeshRenderComponent.h"
18#include "Components/Core/ModelComponent.h"
19#include "Components/Core/MotionComponent.h"
20#include "Components/Core/NearLimitComponent.h"
21#include "Components/Core/OverlayComponent.h"
22#include "Components/Core/PropertiesComponent.h"
23#include "Components/Core/RenderComponent.h"
24#include "Components/Core/SceneComponent.h"
25#include "Components/Core/ScriptComponent.h"
26#include "Components/Core/SpriteRenderComponent.h"
27#include "Components/Core/StaticModelComponent.h"
28#include "Components/Core/SubMeshRenderComponent.h"
29#include "Components/Core/SwitchComponent.h"
30#include "Components/Core/TextComponent.h"
31#include "Components/Core/Text3DComponent.h"
32#include "Components/Core/TransformComponent.h"
34#include "Components/Data/DataSetComponent.h"
35#include "Components/Data/TrajectoryComponent.h"
37#include "Components/Geometry/ExtrusionComponent.h"
38#include "Components/Geometry/ShapeComponent.h"
39#include "Components/Geometry/VariableExtrusionComponent.h"
40#include "Components/Geometry/MeshGeneratorComponent.h"
41#include "Components/Geometry/AdaptivePlanarGridComponent.h"
42#include "Components/Geometry/MarkerPointSetComponent.h"
44#include "Components/Appearance/MaterialComponent.h"
45#include "Components/Appearance/ScreenSizeComponent.h"
46#include "Components/Appearance/TextureGeneratorComponent.h"
47#include "Components/Appearance/FontSelectorComponent.h"
48#include "Components/Appearance/BasicOceanComponent.h"
49#include "Components/Appearance/BasicTerrainComponent.h"
51#include "Components/Layout/TrajectoryLayoutComponent.h"
53#include "Components/Behavior/TrajectoryAlignedComponent.h"
54#include "Components/Behavior/ReflectionComponent.h"
55#include "Components/Behavior/CurvedEarthPositionComponent.h"
56#include "Components/Behavior/ExpressionComponent.h"
57#include "Components/Behavior/FPSNavigationComponent.h"
58#include "Components/Behavior/OrbitingCameraController.h"
59#include "Components/Behavior/TeleportNavigationComponent.h"
60#include "Components/Behavior/PickingBeamComponent.h"
62#include "../Extensions/Components/FollowComponent.h"
64#include "Generators/MeshGenerator.h"
65#include "Generators/TextureGenerator.h"
66#include "Services/PipelineService.h"
68#include "Resources/ResourceFlags.h"
70#include "Input/InputDeviceType.h"
72#include "Renderer/IRenderer.h"
74#include "Foundation/Platform/Keyboard.h"
75#include "Foundation/Platform/Gestures.h"
79template<>
Cogs::StringView getName<Cogs::Core::EntityFind>() {
return "EntityFind"; }
80template<>
Cogs::StringView getName<Cogs::Core::RenderMode>() {
return "RenderMode"; }
81template<>
Cogs::StringView getName<Cogs::Core::InputDeviceType>() {
return "InputDeviceType"; }
83void Cogs::Core::initializeTypes()
90 Field vec2Fields[] = {
99 TypeDatabase::createType<glm::vec2>().setFields(vec2Fields);
101 Field vec3Fields[] = {
110 TypeDatabase::createType<glm::vec3>().setFields(vec3Fields);
112 Field vec4Fields[] = {
123 TypeDatabase::createType<glm::vec4>().setFields(vec4Fields);
125 TypeDatabase::createType<glm::quat>().setFields(vec4Fields);;
126 TypeDatabase::createType<glm::mat4>();
128 TypeDatabase::createType<glm::dvec2>();
129 TypeDatabase::createType<glm::dvec3>();
130 TypeDatabase::createType<glm::dvec4>();
131 TypeDatabase::createType<glm::dquat>();
132 TypeDatabase::createType<glm::dmat4>();
134 Field ivec2Fields[] = {
140 TypeDatabase::createType<glm::ivec2>().setFields(ivec2Fields);
141 Field ivec3Fields[] = {
149 TypeDatabase::createType<glm::ivec3>().setFields(ivec3Fields);
150 Field ivec4Fields[] = {
160 TypeDatabase::createType<glm::ivec4>().setFields(ivec4Fields);
161 Field uvec2Fields[] = {
167 TypeDatabase::createType<glm::uvec2>().setFields(uvec2Fields);
168 Field uvec3Fields[] = {
176 TypeDatabase::createType<glm::uvec3>().setFields(uvec3Fields);
177 Field uvec4Fields[] = {
187 TypeDatabase::createType<glm::uvec4>().setFields(uvec4Fields);
189 TypeDatabase::createType<std::vector<glm::vec2>>();
190 TypeDatabase::createType<std::vector<glm::vec3>>();
191 TypeDatabase::createType<std::vector<glm::vec4>>();
192 TypeDatabase::createType<std::vector<glm::mat4>>();
193 TypeDatabase::createType<std::vector<glm::quat>>();
195 TypeDatabase::createType<std::vector<glm::dvec2>>();
196 TypeDatabase::createType<std::vector<glm::dvec3>>();
197 TypeDatabase::createType<std::vector<glm::dvec4>>();
198 TypeDatabase::createType<std::vector<glm::dmat4>>();
199 TypeDatabase::createType<std::vector<glm::dquat>>();
201 TypeDatabase::createType<EntityPtr>();
202 TypeDatabase::createType<WeakEntityPtr>();
203 TypeDatabase::createType<std::vector<EntityPtr>>();
204 TypeDatabase::createType<std::vector<WeakEntityPtr>>();
206 TypeDatabase::createType<ResourceBufferHandle>();
207 TypeDatabase::createType<MeshHandle>();
208 TypeDatabase::createType<ModelHandle>();
209 TypeDatabase::createType<MaterialHandle>();
210 TypeDatabase::createType<MaterialInstanceHandle>();
211 TypeDatabase::createType<FontHandle>();
212 TypeDatabase::createType<TextureHandle>();
213 TypeDatabase::createType<AnimationHandle>();
214 TypeDatabase::createType<GuiDocumentHandle>();
215 TypeDatabase::createType<AssetHandle>();
217 TypeDatabase::createType<std::vector<TextureHandle>>();
218 TypeDatabase::createType<std::vector<MaterialHandle>>();
219 TypeDatabase::createType<std::vector<MaterialInstanceHandle>>();
221 TypeDatabase::createType<BufferView<uint32_t>>();
222 TypeDatabase::createType<BufferView<float>>();
223 TypeDatabase::createType<BufferView<glm::vec3>>();
224 TypeDatabase::createType<BufferView<glm::vec4>>();
227 {
"A", Cogs::Key::A },
228 {
"B", Cogs::Key::B },
229 {
"C", Cogs::Key::C },
230 {
"D", Cogs::Key::D },
231 {
"E", Cogs::Key::E },
232 {
"F", Cogs::Key::F },
233 {
"G", Cogs::Key::G },
234 {
"H", Cogs::Key::H },
235 {
"I", Cogs::Key::I },
236 {
"J", Cogs::Key::J },
237 {
"K", Cogs::Key::K },
238 {
"L", Cogs::Key::L },
239 {
"M", Cogs::Key::M },
240 {
"N", Cogs::Key::N },
241 {
"O", Cogs::Key::O },
242 {
"P", Cogs::Key::P },
243 {
"Q", Cogs::Key::Q },
244 {
"R", Cogs::Key::R },
245 {
"S", Cogs::Key::S },
246 {
"T", Cogs::Key::T },
247 {
"U", Cogs::Key::U },
248 {
"V", Cogs::Key::V },
249 {
"W", Cogs::Key::W },
250 {
"X", Cogs::Key::X },
251 {
"Y", Cogs::Key::Y },
252 {
"Z", Cogs::Key::Z },
253 {
"Zero", Cogs::Key::Zero },
254 {
"One", Cogs::Key::One },
255 {
"Two", Cogs::Key::Two },
256 {
"Three", Cogs::Key::Three },
257 {
"Four", Cogs::Key::Four },
258 {
"Five", Cogs::Key::Five },
259 {
"Six", Cogs::Key::Six },
260 {
"Seven", Cogs::Key::Seven },
261 {
"Eight", Cogs::Key::Eight },
262 {
"Nine", Cogs::Key::Nine },
263 {
"Left", Cogs::Key::Left },
264 {
"Right", Cogs::Key::Right },
265 {
"Up", Cogs::Key::Up },
266 {
"Down", Cogs::Key::Down },
267 {
"Shift", Cogs::Key::Shift },
268 {
"LeftShift", Cogs::Key::LeftShift },
269 {
"RightShift", Cogs::Key::RightShift },
270 {
"Control", Cogs::Key::Control },
271 {
"LeftControl", Cogs::Key::LeftControl },
272 {
"RightControl", Cogs::Key::RightControl },
273 {
"Alt", Cogs::Key::Alt },
274 {
"LeftAlt", Cogs::Key::LeftAlt },
275 {
"RightAlt", Cogs::Key::RightAlt },
276 {
"CapsLock", Cogs::Key::CapsLock },
277 {
"Tab", Cogs::Key::Tab },
278 {
"Escape", Cogs::Key::Escape },
279 {
"Enter", Cogs::Key::Enter },
280 {
"Space", Cogs::Key::Space },
281 {
"Insert", Cogs::Key::Insert },
282 {
"Delete", Cogs::Key::Delete },
283 {
"Backspace", Cogs::Key::Backspace },
284 {
"Home", Cogs::Key::Home },
285 {
"End", Cogs::Key::End },
286 {
"PageUp", Cogs::Key::PageUp },
287 {
"PageDown", Cogs::Key::PageDown },
288 {
"F1", Cogs::Key::F1 },
289 {
"F2", Cogs::Key::F2 },
290 {
"F3", Cogs::Key::F3 },
291 {
"F4", Cogs::Key::F4 },
292 {
"F5", Cogs::Key::F5 },
293 {
"F6", Cogs::Key::F6 },
294 {
"F7", Cogs::Key::F7 },
295 {
"F8", Cogs::Key::F8 },
296 {
"F9", Cogs::Key::F9 },
297 {
"F10", Cogs::Key::F10 },
298 {
"F11", Cogs::Key::F11 },
299 {
"F12", Cogs::Key::F12 },
300 {
"None", Cogs::Key::None },
302 static_assert(std::size(keys) ==
static_cast<size_t>(Cogs::Key::Count) + 1);
303 TypeDatabase::createType<Cogs::Key>().setEnumerators(keys);
306 {
"Touch", Cogs::PointerType::Touch },
307 {
"Mouse", Cogs::PointerType::Mouse },
309 static_assert(std::size(pointerTypes) ==
static_cast<size_t>(Cogs::PointerType::Count));
310 TypeDatabase::createType<Cogs::PointerType>().setEnumerators(pointerTypes);
313 {
"Left", Cogs::MouseButton::Left },
314 {
"Right", Cogs::MouseButton::Right },
315 {
"Middle", Cogs::MouseButton::Middle },
317 static_assert(std::size(mouseButtons) ==
static_cast<size_t>(Cogs::MouseButton::Count));
318 TypeDatabase::createType<Cogs::MouseButton>().setEnumerators(mouseButtons);
321 {
"None", InputDeviceType::None },
322 {
"Keyboard", InputDeviceType::Keyboard },
323 {
"Mouse", InputDeviceType::Mouse },
325 TypeDatabase::createType<Cogs::Core::InputDeviceType>().setEnumerators(inputDeviceTypes).setEnumFlags();
330 {
"Mirror", SamplerState::AddressMode::Mirror },
331 {
"Border", SamplerState::AddressMode::Border },
333 static_assert(std::size(addressModes) ==
static_cast<size_t>(Cogs::SamplerState::AddressMode::AddressMode_Size));
334 TypeDatabase::createType<Cogs::SamplerState::AddressMode>().setEnumerators(addressModes);
337 {
"MinMagMipPoint", SamplerState::FilterMode::MinMagMipPoint },
338 {
"MinMagMipLinear", SamplerState::FilterMode::MinMagMipLinear },
339 {
"ComparisonMinMagMipPoint", SamplerState::FilterMode::ComparisonMinMagMipPoint },
340 {
"ComparisonMinMagMipLinear", SamplerState::FilterMode::ComparisonMinMagMipLinear },
342 static_assert(std::size(filterModes) ==
static_cast<size_t>(Cogs::SamplerState::FilterMode::FilterMode_Size));
343 TypeDatabase::createType<Cogs::SamplerState::FilterMode>().setEnumerators(filterModes);
346 {
"None", Cogs::FileContentsHints::None },
350 TypeDatabase::createType<Cogs::FileContentsHints>().setEnumerators(fileContentHints);
352 registerResourceFlagTypes();
354 MeshComponent::registerType();
355 TransformComponent::registerType();
356 SceneComponent::registerType();
357 RenderComponent::registerType();
358 MeshRenderComponent::registerType();
359 SubMeshRenderComponent::registerType();
360 InstancedMeshRenderComponent::registerType();
361 SpriteRenderComponent::registerType();
362 TextComponent::registerType();
363 Text3DComponent::registerType();
364 BillboardComponent::registerType();
365 OverlayComponent::registerType();
366 LightComponent::registerType();
367 CameraComponent::registerType();
368 CameraArrayComponent::registerType();
369 ClipShapeComponent::registerType();
370 ClipShapeRefComponent::registerType();
371 FogComponent::registerType();
372 LodComponent::registerType();
373 ScriptComponent::registerType();
374 EnvironmentComponent::registerType();
375 AnimationComponent::registerType();
376 AssetComponent::registerType();
377 PropertiesComponent::registerType();
378 CaptureComponent::registerType();
380 MeshGeneratorComponent::registerType();
381 ScreenSizeComponent::registerType();
382 TextureGeneratorComponent::registerType();
383 TrajectoryComponent::registerType();
384 ExtrusionComponent::registerType();
385 MaterialComponent::registerType();
386 ShapeComponent::registerType();
387 ModelComponent::registerType();
388 InstancedModelComponent::registerType();
389 StaticModelComponent::registerType();
390 TrajectoryLayoutComponent::registerType();
391 DataSetComponent::registerType();
392 VariableExtrusionComponent::registerType();
393 AdaptivePlanarGridComponent::registerType();
396 DynamicComponent::registerType();
397 MotionComponent::registerType();
398 SwitchComponent::registerType();
399 FollowComponent::registerType();
400 MarkerPointSetComponent::registerType();
401 BasicTerrainComponent::registerType();
403 TrajectoryAlignedComponent::registerType();
404 FPSNavigationComponent::registerType();
405 OrbitingCameraController::registerType();
406 TeleportNavigationComponent::registerType();
407 PickingBeamComponent::registerType();
408 CurvedEarthPositionComponent::registerType();
409 ReflectionComponent::registerType();
410 NearLimitComponent::registerType();
411 ExpressionComponent::registerType();
413 FontSelectorComponent::registerType();
414 BasicOceanComponent::registerType();
416 Reflection::TypeDatabase::createType<MeshGenerator>();
417 Reflection::TypeDatabase::createType<TextureGenerator>();
418 Reflection::TypeDatabase::createType<PipelineService>();
421 {
"Default", GraphicsDeviceType::Default },
422 {
"Default", GraphicsDeviceType::Unknown },
423 {
"Direct3D11", GraphicsDeviceType::Direct3D11 },
424 {
"Direct3D12", GraphicsDeviceType::Direct3D12 },
425 {
"Vulkan", GraphicsDeviceType::Vulkan },
426 {
"OpenGL20", GraphicsDeviceType::OpenGL20 },
427 {
"OpenGLES30", GraphicsDeviceType::OpenGLES30 },
428 {
"WebGPU", GraphicsDeviceType::WebGPU },
429 {
"Null", GraphicsDeviceType::Null },
432 Reflection::TypeDatabase::createType<GraphicsDeviceType>().setEnumerators(enums);
435 {
"Default", EntityFind::Default },
436 {
"PartialNameMatch", EntityFind::PartialNameMatch },
437 {
"NonRecursive", EntityFind::NonRecursive },
439 Reflection::TypeDatabase::createType<EntityFind>().setEnumerators(entityFindEnums).
443 {
"Normal", RenderMode::Normal },
444 {
"Wireframe", RenderMode::Wireframe },
445 {
"Box", RenderMode::Box },
447 Reflection::TypeDatabase::createType<RenderMode>().setEnumerators(renderModeEnums);
450 {
"Less", DepthFunc::Less },
451 {
"LessOrEqual", DepthFunc::LessOrEqual },
452 {
"Always", DepthFunc::Always },
453 {
"NotEqual", DepthFunc::NotEqual },
454 {
"Equal", DepthFunc::Equal },
456 Reflection::TypeDatabase::createType<DepthFunc>().setEnumerators(depthFuncEnums);
460void Cogs::Core::cleanupTypes() {
461 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.