1//************************************ bs::framework - Copyright 2018 Marko Pintera **************************************//
2//*********** Licensed under the MIT license. See LICENSE.md for full terms. This notice is not to be removed. ***********//
3#pragma once
4
5#include "Prerequisites/BsPrerequisitesUtil.h"
6
7/** @addtogroup Layers
8 * @{
9 */
10
11/** @defgroup Core Core
12 * Second lowest layer that provides core engine functionality and abstract interfaces for various systems.
13 * @{
14 */
15
16/** @defgroup Animation Animation
17 * %Animation clips, skeletal and blend shape animation, animation playback, blending and other features.
18 */
19
20/** @defgroup Application-Core Application
21 * Entry point into the application and other general functionality.
22 */
23
24/** @defgroup Audio Audio
25 * %Audio clips, 3D sound and music reproduction.
26 */
27
28/** @defgroup Components-Core Components
29 * Built-in components (elements that may be attached to scene objects).
30 */
31
32/** @defgroup CoreThread Core thread
33 * Core objects and interaction with the core (rendering) thread.
34 */
35
36/** @defgroup Importer Importer
37 * Import of resources into engine friendly format.
38 */
39
40/** @defgroup Input Input
41 * %Input (mouse, keyboard, gamepad, etc.).
42 */
43
44/** @defgroup Localization Localization
45 * GUI localization.
46 */
47
48/** @defgroup Material Material
49 * Materials, shaders and related functionality.
50 */
51
52/** @defgroup Physics Physics
53 * %Physics system: colliders, triggers, rigidbodies, joints, scene queries, etc.
54 */
55
56 /** @defgroup Profiling Profiling
57 * Measuring CPU and GPU execution times and memory usage.
58 */
59
60/** @defgroup RenderAPI RenderAPI
61 * Interface for interacting with the render API (DirectX, OpenGL, etc.).
62 */
63
64/** @defgroup Renderer Renderer
65 * Abstract interface and helper functionality for rendering scene objects.
66 */
67
68/** @defgroup Resources Resources
69 * Core resource types and resource management functionality (loading, saving, etc.).
70 */
71
72/** @defgroup Particles Particles
73 * Emission, updates and rendering of particles in the particle system.
74 */
75
76/** @defgroup Network Network
77 * Sending and receiving data over the network.
78 */
79
80/** @cond RTTI */
81/** @defgroup RTTI-Impl-Core RTTI types
82 * RTTI implementations for classes within the core layer.
83 */
84/** @endcond */
85
86/** @defgroup Scene Scene
87 * Managing scene objects and their hierarchy.
88 */
89
90/** @defgroup Text Text
91 * Generating text geometry.
92 */
93
94/** @defgroup Utility-Core Utility
95 * Various utility methods and types used by the core layer.
96 */
97
98/** @} */
99/** @} */
100
101/** @addtogroup Internals
102 * @{
103 */
104
105/** @defgroup Internal-Core Core
106 * Second lowest layer that provides core engine functionality and abstract interfaces for various systems.
107 * @{
108 */
109
110/** @defgroup Animation-Internal Animation
111 * Animation clips, skeletal and blend shape animation, animation playback, blending and other features.
112 */
113
114/** @defgroup Audio-Internal Audio
115 * Audio clips, 3D sound and music reproduction.
116 */
117
118/** @defgroup CoreThread-Internal Core thread
119 * Core objects and interaction with the core (rendering) thread.
120 */
121
122/** @defgroup Importer-Internal Importer
123 * Import of resources into engine friendly format.
124 */
125
126/** @defgroup Input-Internal Input
127 * Input (mouse, keyboard, gamepad, etc.).
128 */
129
130/** @defgroup Localization-Internal Localization
131 * GUI localization.
132 */
133
134/** @defgroup Material-Internal Material
135 * Materials, shaders and related functionality.
136 */
137
138/** @defgroup Particles-Internal Particles
139 * Emission, updates and rendering of particles in the particle system.
140 */
141
142/** @defgroup Network-Internal Network
143 * Sending and receiving data over the network.
144 */
145
146/** @defgroup Physics-Internal Physics
147 * Physics system: colliders, triggers, rigidbodies, joints, scene queries, etc.
148 */
149
150/** @defgroup Platform-Internal Platform
151 * Interface for interacting with the platform (OS).
152 */
153
154 /** @defgroup Profiling-Internal Profiling
155 * Measuring CPU and GPU execution times and memory usage.
156 */
157
158/** @defgroup RenderAPI-Internal RenderAPI
159 * Interface for interacting with the render API (DirectX, OpenGL, etc.).
160 */
161
162/** @defgroup Renderer-Internal Renderer
163 * Abstract interface and helper functionality for rendering scene objects.
164 */
165
166/** @defgroup Resources-Internal Resources
167 * Core resource types and resource management functionality (loading, saving, etc.).
168 */
169
170/** @defgroup Scene-Internal Scene
171 * Managing scene objects and their hierarchy.
172 */
173
174/** @defgroup Text-Internal Text
175 * Generating text geometry.
176 */
177
178/** @defgroup Utility-Core-Internal Utility
179 * Various utility methods and types used by the core layer.
180 */
181
182/** @} */
183/** @} */
184
185/** Maximum number of color surfaces that can be attached to a multi render target. */
186#define BS_MAX_MULTIPLE_RENDER_TARGETS 8
187#define BS_FORCE_SINGLETHREADED_RENDERING 0
188
189/** Maximum number of individual GPU queues, per type. */
190#define BS_MAX_QUEUES_PER_TYPE 8
191
192/** Maximum number of hardware devices usable at once. */
193#define BS_MAX_DEVICES 5U
194
195/** Maximum number of devices one resource can exist at the same time. */
196#define BS_MAX_LINKED_DEVICES 4U
197
198// DLL export
199#if BS_PLATFORM == BS_PLATFORM_WIN32 // Windows
200# if BS_COMPILER == BS_COMPILER_MSVC
201# if defined(BS_STATIC_LIB)
202# define BS_CORE_EXPORT
203# else
204# if defined(BS_CORE_EXPORTS)
205# define BS_CORE_EXPORT __declspec(dllexport)
206# else
207# define BS_CORE_EXPORT __declspec(dllimport)
208# endif
209# endif
210# else
211# if defined(BS_STATIC_LIB)
212# define BS_CORE_EXPORT
213# else
214# if defined(BS_CORE_EXPORTS)
215# define BS_CORE_EXPORT __attribute__ ((dllexport))
216# else
217# define BS_CORE_EXPORT __attribute__ ((dllimport))
218# endif
219# endif
220# endif
221# define BS_CORE_HIDDEN
222#else // Linux/Mac settings
223# define BS_CORE_EXPORT __attribute__ ((visibility ("default")))
224# define BS_CORE_HIDDEN __attribute__ ((visibility ("hidden")))
225#endif
226
227#include "Localization/BsHString.h"
228#include "String/BsStringID.h"
229
230namespace bs
231{
232 // Core objects
233 template<class T>
234 struct CoreThreadType
235 { };
236
237#define CORE_OBJECT_FORWARD_DECLARE(TYPE) \
238 class TYPE; \
239 namespace ct { class TYPE; } \
240 template<> struct CoreThreadType<TYPE> { typedef ct::TYPE Type; };
241
242 CORE_OBJECT_FORWARD_DECLARE(IndexBuffer)
243 CORE_OBJECT_FORWARD_DECLARE(VertexBuffer)
244 CORE_OBJECT_FORWARD_DECLARE(GpuBuffer)
245 CORE_OBJECT_FORWARD_DECLARE(GpuProgram)
246 CORE_OBJECT_FORWARD_DECLARE(Pass)
247 CORE_OBJECT_FORWARD_DECLARE(Technique)
248 CORE_OBJECT_FORWARD_DECLARE(Shader)
249 CORE_OBJECT_FORWARD_DECLARE(Material)
250 CORE_OBJECT_FORWARD_DECLARE(RenderTarget)
251 CORE_OBJECT_FORWARD_DECLARE(RenderTexture)
252 CORE_OBJECT_FORWARD_DECLARE(RenderWindow)
253 CORE_OBJECT_FORWARD_DECLARE(SamplerState)
254 CORE_OBJECT_FORWARD_DECLARE(Viewport)
255 CORE_OBJECT_FORWARD_DECLARE(VertexDeclaration)
256 CORE_OBJECT_FORWARD_DECLARE(DepthStencilState)
257 CORE_OBJECT_FORWARD_DECLARE(RasterizerState)
258 CORE_OBJECT_FORWARD_DECLARE(BlendState)
259 CORE_OBJECT_FORWARD_DECLARE(GpuParamBlockBuffer)
260 CORE_OBJECT_FORWARD_DECLARE(GpuParams)
261 CORE_OBJECT_FORWARD_DECLARE(GpuParamsSet)
262 CORE_OBJECT_FORWARD_DECLARE(MaterialParams)
263 CORE_OBJECT_FORWARD_DECLARE(Light)
264 CORE_OBJECT_FORWARD_DECLARE(Camera)
265 CORE_OBJECT_FORWARD_DECLARE(Renderable)
266 CORE_OBJECT_FORWARD_DECLARE(GraphicsPipelineState)
267 CORE_OBJECT_FORWARD_DECLARE(ComputePipelineState)
268 CORE_OBJECT_FORWARD_DECLARE(ReflectionProbe)
269 CORE_OBJECT_FORWARD_DECLARE(ParticleSystem)
270 CORE_OBJECT_FORWARD_DECLARE(Texture)
271 CORE_OBJECT_FORWARD_DECLARE(SpriteTexture)
272 CORE_OBJECT_FORWARD_DECLARE(Mesh)
273 CORE_OBJECT_FORWARD_DECLARE(VectorField)
274 CORE_OBJECT_FORWARD_DECLARE(Skybox)
275 CORE_OBJECT_FORWARD_DECLARE(Decal)
276
277 class Collider;
278 class Rigidbody;
279 class BoxCollider;
280 class SphereCollider;
281 class PlaneCollider;
282 class CapsuleCollider;
283 class MeshCollider;
284 class Joint;
285 class FixedJoint;
286 class DistanceJoint;
287 class HingeJoint;
288 class SphericalJoint;
289 class SliderJoint;
290 class D6Joint;
291 class CharacterController;
292 class AudioListener;
293 class AudioSource;
294 class Animation;
295 class Bone;
296 class LightProbeVolume;
297
298 // Components
299 template<class T>
300 struct ComponentType
301 { };
302
303#define COMPONENT_FORWARD_DECLARE(TYPE) \
304 class C##TYPE; \
305 template<> struct ComponentType<TYPE> { typedef C##TYPE Type; };
306
307 COMPONENT_FORWARD_DECLARE(Collider)
308 COMPONENT_FORWARD_DECLARE(Rigidbody)
309 COMPONENT_FORWARD_DECLARE(BoxCollider)
310 COMPONENT_FORWARD_DECLARE(SphereCollider)
311 COMPONENT_FORWARD_DECLARE(PlaneCollider)
312 COMPONENT_FORWARD_DECLARE(CapsuleCollider)
313 COMPONENT_FORWARD_DECLARE(MeshCollider)
314 COMPONENT_FORWARD_DECLARE(Joint)
315 COMPONENT_FORWARD_DECLARE(HingeJoint)
316 COMPONENT_FORWARD_DECLARE(DistanceJoint)
317 COMPONENT_FORWARD_DECLARE(FixedJoint)
318 COMPONENT_FORWARD_DECLARE(SphericalJoint)
319 COMPONENT_FORWARD_DECLARE(SliderJoint)
320 COMPONENT_FORWARD_DECLARE(D6Joint)
321 COMPONENT_FORWARD_DECLARE(CharacterController)
322 COMPONENT_FORWARD_DECLARE(Camera)
323 COMPONENT_FORWARD_DECLARE(Renderable)
324 COMPONENT_FORWARD_DECLARE(Light)
325 COMPONENT_FORWARD_DECLARE(Animation)
326 COMPONENT_FORWARD_DECLARE(Bone)
327 COMPONENT_FORWARD_DECLARE(AudioSource)
328 COMPONENT_FORWARD_DECLARE(AudioListener)
329 COMPONENT_FORWARD_DECLARE(ReflectionProbe)
330 COMPONENT_FORWARD_DECLARE(Skybox)
331 COMPONENT_FORWARD_DECLARE(LightProbeVolume)
332 COMPONENT_FORWARD_DECLARE(ParticleSystem)
333 COMPONENT_FORWARD_DECLARE(Decal)
334
335 class Color;
336 class GpuProgramManager;
337 class GpuProgramManager;
338 class GpuProgramFactory;
339 class IndexData;
340 class RenderAPICapabilities;
341 class RenderTargetProperties;
342 class TextureManager;
343 class Input;
344 struct PointerEvent;
345 class RendererFactory;
346 class HardwareBufferManager;
347 class FontManager;
348 class RenderStateManager;
349 class GpuParamBlock;
350 struct GpuParamDesc;
351 struct GpuParamDataDesc;
352 struct GpuParamObjectDesc;
353 struct GpuParamBlockDesc;
354 class ShaderInclude;
355 class CoreObject;
356 class ImportOptions;
357 class TextureImportOptions;
358 class FontImportOptions;
359 class GpuProgramImportOptions;
360 class MeshImportOptions;
361 struct FontBitmap;
362 class GameObject;
363 class GpuResourceData;
364 struct RenderOperation;
365 class RenderQueue;
366 struct ProfilerReport;
367 class VertexDataDesc;
368 class FrameAlloc;
369 class FolderMonitor;
370 class VideoMode;
371 class VideoOutputInfo;
372 class VideoModeInfo;
373 struct SubMesh;
374 class IResourceListener;
375 class TextureProperties;
376 class IShaderIncludeHandler;
377 class Prefab;
378 class PrefabDiff;
379 class RendererMeshData;
380 class Win32Window;
381 class RenderAPIFactory;
382 class PhysicsManager;
383 class Physics;
384 class FCollider;
385 class PhysicsMaterial;
386 class ShaderDefines;
387 class ShaderImportOptions;
388 class AudioClipImportOptions;
389 class AnimationClip;
390 class GpuPipelineParamInfo;
391 template <class T> class TAnimationCurve;
392 struct AnimationCurves;
393 class Skeleton;
394 class MorphShapes;
395 class MorphShape;
396 class MorphChannel;
397 class Transform;
398 class SceneActor;
399 class CoreObjectManager;
400 struct CollisionData;
401 // Asset import
402 class SpecificImporter;
403 class Importer;
404 // Resources
405 class Resource;
406 class Resources;
407 class ResourceManifest;
408 class MeshBase;
409 class TransientMesh;
410 class MeshHeap;
411 class Font;
412 class ResourceMetaData;
413 class DropTarget;
414 class StringTable;
415 class PhysicsMaterial;
416 class PhysicsMesh;
417 class AudioClip;
418 // Scene
419 class SceneObject;
420 class Component;
421 class SceneManager;
422 class SceneInstance;
423 // RTTI
424 class MeshRTTI;
425 // Desc structs
426 struct SAMPLER_STATE_DESC;
427 struct DEPTH_STENCIL_STATE_DESC;
428 struct RASTERIZER_STATE_DESC;
429 struct BLEND_STATE_DESC;
430 struct RENDER_TARGET_BLEND_STATE_DESC;
431 struct RENDER_TEXTURE_DESC;
432 struct RENDER_WINDOW_DESC;
433 struct FONT_DESC;
434 struct CHAR_CONTROLLER_DESC;
435 struct JOINT_DESC;
436 struct FIXED_JOINT_DESC;
437 struct DISTANCE_JOINT_DESC;
438 struct HINGE_JOINT_DESC;
439 struct SLIDER_JOINT_DESC;
440 struct SPHERICAL_JOINT_DESC;
441 struct D6_JOINT_DESC;
442 struct AUDIO_CLIP_DESC;
443
444 template<class T>
445 class TCoreThreadQueue;
446 class CommandQueueNoSync;
447 class CommandQueueSync;
448
449 namespace ct
450 {
451 class Renderer;
452 class VertexData;
453 class RenderAPI;
454 class CoreObject;
455 class MeshBase;
456 class TransientMesh;
457 class MeshHeap;
458 class GpuPipelineParamInfo;
459 class CommandBuffer;
460 class EventQuery;
461 class TimerQuery;
462 class OcclusionQuery;
463 class TextureView;
464 class RenderElement;
465 class RenderWindowManager;
466 class RenderStateManager;
467 class HardwareBufferManager;
468 }
469}
470
471/************************************************************************/
472/* RTTI */
473/************************************************************************/
474namespace bs
475{
476 enum TypeID_Core
477 {
478 TID_Texture = 1001,
479 TID_Mesh = 1002,
480 TID_MeshData = 1003,
481 TID_VertexDeclaration = 1004,
482 TID_VertexElementData = 1005,
483 TID_Component = 1006,
484 TID_ResourceHandle = 1009,
485 TID_GpuProgram = 1010,
486 TID_ResourceHandleData = 1011,
487 TID_CgProgram = 1012,
488 TID_Pass = 1014,
489 TID_Technique = 1015,
490 TID_Shader = 1016,
491 TID_Material = 1017,
492 TID_SamplerState = 1021,
493 TID_BlendState = 1023,
494 TID_RasterizerState = 1024,
495 TID_DepthStencilState = 1025,
496 TID_BLEND_STATE_DESC = 1034,
497 TID_SHADER_DATA_PARAM_DESC = 1035,
498 TID_SHADER_OBJECT_PARAM_DESC = 1036,
499 TID_SHADER_PARAM_BLOCK_DESC = 1047,
500 TID_ImportOptions = 1048,
501 TID_Font = 1051,
502 TID_FONT_DESC = 1052,
503 TID_CHAR_DESC = 1053,
504 TID_FontImportOptions = 1056,
505 TID_FontBitmap = 1057,
506 TID_SceneObject = 1059,
507 TID_GameObject = 1060,
508 TID_PixelData = 1062,
509 TID_GpuResourceData = 1063,
510 TID_VertexDataDesc = 1064,
511 TID_MeshBase = 1065,
512 TID_GameObjectHandleBase = 1066,
513 TID_ResourceManifest = 1067,
514 TID_ResourceManifestEntry = 1068,
515 TID_EmulatedParamBlock = 1069,
516 TID_TextureImportOptions = 1070,
517 TID_ResourceMetaData = 1071,
518 TID_ShaderInclude = 1072,
519 TID_Viewport = 1073,
520 TID_ResourceDependencies = 1074,
521 TID_ShaderMetaData = 1075,
522 TID_MeshImportOptions = 1076,
523 TID_Prefab = 1077,
524 TID_PrefabDiff = 1078,
525 TID_PrefabObjectDiff = 1079,
526 TID_PrefabComponentDiff = 1080,
527 TID_CGUIWidget = 1081,
528 /// TID_ProfilerOverlay = 1082,
529 TID_StringTable = 1083,
530 TID_LanguageData = 1084,
531 TID_LocalizedStringData = 1085,
532 TID_MaterialParamColor = 1086,
533 TID_WeakResourceHandle = 1087,
534 TID_TextureParamData = 1088,
535 TID_StructParamData = 1089,
536 TID_MaterialParams = 1090,
537 TID_MaterialRTTIParam = 1091,
538 TID_PhysicsMaterial = 1092,
539 TID_CCollider = 1093,
540 TID_CBoxCollider = 1094,
541 TID_CSphereCollider = 1095,
542 TID_CCapsuleCollider = 1096,
543 TID_CPlaneCollider = 1097,
544 TID_CRigidbody = 1098,
545 TID_PhysicsMesh = 1099,
546 TID_CMeshCollider = 1100,
547 TID_CJoint = 1101,
548 TID_CFixedJoint = 1102,
549 TID_CDistanceJoint = 1103,
550 TID_CHingeJoint = 1104,
551 TID_CSphericalJoint = 1105,
552 TID_CSliderJoint = 1106,
553 TID_CD6Joint = 1107,
554 TID_CCharacterController = 1108,
555 TID_FPhysicsMesh = 1109,
556 TID_ShaderImportOptions = 1110,
557 TID_AudioClip = 1111,
558 TID_AudioClipImportOptions = 1112,
559 TID_CAudioListener = 1113,
560 TID_CAudioSource = 1114,
561 TID_AnimationClip = 1115,
562 TID_AnimationCurve = 1116,
563 TID_KeyFrame = 1117,
564 TID_NamedAnimationCurve = 1118,
565 TID_Skeleton = 1119,
566 TID_SkeletonBoneInfo = 1120,
567 TID_AnimationSplitInfo = 1121,
568 TID_CAnimation = 1122,
569 TID_AnimationEvent = 1123,
570 TID_ImportedAnimationEvents = 1124,
571 TID_CBone = 1125,
572 TID_MaterialParamData = 1126,
573 TID_RenderSettings = 1127,
574 TID_MorphShape = 1128,
575 TID_MorphShapes = 1129,
576 TID_MorphChannel = 1130,
577 TID_ReflectionProbe = 1131,
578 TID_CReflectionProbe = 1132,
579 TID_CachedTextureData = 1133,
580 TID_Skybox = 1134,
581 TID_CSkybox = 1135,
582 TID_LightProbeVolume = 1136,
583 TID_SavedLightProbeInfo = 1137,
584 TID_CLightProbeVolume = 1138,
585 TID_Transform = 1139,
586 TID_SceneActor = 1140,
587 TID_AudioListener = 1141,
588 TID_AudioSource = 1142,
589 TID_ShaderVariationParam = 1143,
590 TID_ShaderVariation = 1144,
591 TID_GpuProgramBytecode = 1145,
592 TID_GpuParamBlockDesc = 1146,
593 TID_GpuParamDataDesc = 1147,
594 TID_GpuParamObjectDesc = 1148,
595 TID_GpuParamDesc = 1149,
596 TID_BlendStateDesc = 1150,
597 TID_RasterizerStateDesc = 1151,
598 TID_DepthStencilStateDesc = 1152,
599 TID_SerializedGpuProgramData = 1153,
600 TID_SubShader = 1154,
601 TID_ParticleSystem = 1155,
602 TID_ColorDistribution = 1156,
603 TID_TDistribution = 1157,
604 TID_SHADER_PARAM_ATTRIBUTE = 1158,
605 TID_DataParamInfo = 1159,
606 TID_SpriteSheetGridAnimation = 1160,
607 TID_ParticleEmitter = 1161,
608 TID_ParticleEmitterConeShape = 1162,
609 TID_ParticleEmitterSphereShape = 1163,
610 TID_ParticleEmitterHemisphereShape = 1164,
611 TID_ParticleEmitterBoxShape = 1165,
612 TID_ParticleEmitterCircleShape = 1166,
613 TID_ParticleEmitterRectShape = 1167,
614 TID_ParticleEmitterLineShape = 1168,
615 TID_ParticleEmitterStaticMeshShape = 1169,
616 TID_ParticleEmitterSkinnedMeshShape = 1170,
617 TID_ParticleTextureAnimation = 1171,
618 TID_ParticleCollisions = 1172,
619 TID_ParticleOrbit = 1173,
620 TID_ParticleVelocity = 1174,
621 TID_ParticleSystemSettings = 1175,
622 TID_ParticleSystemEmitters = 1176,
623 TID_ParticleSystemEvolvers = 1177,
624 TID_CParticleSystem = 1178,
625 TID_ParticleGravity = 1179,
626 TID_VectorField = 1180,
627 TID_ParticleVectorFieldSettings = 1181,
628 TID_ParticleGpuSimulationSettings = 1182,
629 TID_ParticleDepthCollisionSettings = 1183,
630 TID_BloomSettings = 1184,
631 TID_ParticleBurst = 1185,
632 TID_CoreSerializationContext = 1186,
633 TID_ParticleForce = 1187,
634 TID_ParticleSize = 1188,
635 TID_ParticleColor = 1189,
636 TID_ParticleRotation = 1190,
637 TID_Decal = 1191,
638 TID_CDecal = 1192,
639 TID_RenderTarget = 1193,
640 TID_RenderTexture = 1194,
641 TID_RenderWindow = 1195,
642 TID_ShaderVariationParamInfo = 1196,
643 TID_ShaderVariationParamValue = 1197,
644
645 // Moved from Engine layer
646 TID_CCamera = 30000,
647 TID_Camera = 30003,
648 TID_CRenderable = 30001,
649 TID_SpriteTexture = 30002,
650 TID_Renderable = 30004,
651 TID_Light = 30011,
652 TID_CLight = 30012,
653 TID_AutoExposureSettings = 30016,
654 TID_TonemappingSettings = 30017,
655 TID_WhiteBalanceSettings = 30018,
656 TID_ColorGradingSettings = 30019,
657 TID_DepthOfFieldSettings = 30020,
658 TID_AmbientOcclusionSettings = 30021,
659 TID_ScreenSpaceReflectionsSettings = 30022,
660 TID_ShadowSettings = 30023,
661 };
662}
663
664/************************************************************************/
665/* Resource references */
666/************************************************************************/
667
668#include "Resources/BsResourceHandle.h"
669
670namespace bs
671{
672 /** @addtogroup Resources
673 * @{
674 */
675
676 typedef ResourceHandle<Resource> HResource;
677 typedef ResourceHandle<Texture> HTexture;
678 typedef ResourceHandle<Mesh> HMesh;
679 typedef ResourceHandle<Material> HMaterial;
680 typedef ResourceHandle<ShaderInclude> HShaderInclude;
681 typedef ResourceHandle<Font> HFont;
682 typedef ResourceHandle<Shader> HShader;
683 typedef ResourceHandle<Prefab> HPrefab;
684 typedef ResourceHandle<StringTable> HStringTable;
685 typedef ResourceHandle<PhysicsMaterial> HPhysicsMaterial;
686 typedef ResourceHandle<PhysicsMesh> HPhysicsMesh;
687 typedef ResourceHandle<AudioClip> HAudioClip;
688 typedef ResourceHandle<AnimationClip> HAnimationClip;
689 typedef ResourceHandle<SpriteTexture> HSpriteTexture;
690 typedef ResourceHandle<VectorField> HVectorField;
691
692 /** @} */
693}
694
695#include "Scene/BsGameObjectHandle.h"
696
697namespace bs
698{
699 /** @addtogroup Scene
700 * @{
701 */
702
703 // Game object handles
704 typedef GameObjectHandle<GameObject> HGameObject;
705 typedef GameObjectHandle<SceneObject> HSceneObject;
706 typedef GameObjectHandle<Component> HComponent;
707 typedef GameObjectHandle<CCamera> HCamera;
708 typedef GameObjectHandle<CRenderable> HRenderable;
709 typedef GameObjectHandle<CLight> HLight;
710 typedef GameObjectHandle<CAnimation> HAnimation;
711 typedef GameObjectHandle<CBone> HBone;
712 typedef GameObjectHandle<CRigidbody> HRigidbody;
713 typedef GameObjectHandle<CCollider> HCollider;
714 typedef GameObjectHandle<CBoxCollider> HBoxCollider;
715 typedef GameObjectHandle<CSphereCollider> HSphereCollider;
716 typedef GameObjectHandle<CCapsuleCollider> HCapsuleCollider;
717 typedef GameObjectHandle<CPlaneCollider> HPlaneCollider;
718 typedef GameObjectHandle<CMeshCollider> HMeshCollider;
719 typedef GameObjectHandle<CJoint> HJoint;
720 typedef GameObjectHandle<CHingeJoint> HHingeJoint;
721 typedef GameObjectHandle<CSliderJoint> HSliderJoint;
722 typedef GameObjectHandle<CDistanceJoint> HDistanceJoint;
723 typedef GameObjectHandle<CSphericalJoint> HSphericalJoint;
724 typedef GameObjectHandle<CFixedJoint> HFixedJoint;
725 typedef GameObjectHandle<CD6Joint> HD6Joint;
726 typedef GameObjectHandle<CCharacterController> HCharacterController;
727 typedef GameObjectHandle<CReflectionProbe> HReflectionProbe;
728 typedef GameObjectHandle<CSkybox> HSkybox;
729 typedef GameObjectHandle<CLightProbeVolume> HLightProbeVolume;
730 typedef GameObjectHandle<CAudioSource> HAudioSource;
731 typedef GameObjectHandle<CAudioListener> HAudioListener;
732 typedef GameObjectHandle<CParticleSystem> HParticleSystem;
733 typedef GameObjectHandle<CDecal> HDecal;
734
735 /** @} */
736}
737
738namespace bs
739{
740 /**
741 * Defers function execution until the next frame. If this function is called within another deferred call, then it will
742 * be executed the same frame, but only after all existing deferred calls are done.
743 *
744 * @note
745 * This method can be used for breaking dependencies among other things. If a class A depends on class B having
746 * something done, but class B also depends in some way on class A, you can break up the initialization into two
747 * separate steps, queuing the second step using this method.
748 * @note
749 * Similar situation can happen if you have multiple classes being initialized in an undefined order but some of them
750 * depend on others. Using this method you can defer the dependent step until next frame, which will ensure everything
751 * was initialized.
752 *
753 * @param[in] callback The callback.
754 */
755 void BS_CORE_EXPORT deferredCall(std::function<void()> callback);
756
757 // Special types for use by profilers
758 typedef std::basic_string<char, std::char_traits<char>, StdAlloc<char, ProfilerAlloc>> ProfilerString;
759
760 template <typename T, typename A = StdAlloc<T, ProfilerAlloc>>
761 using ProfilerVector = std::vector<T, A>;
762
763 template <typename T, typename A = StdAlloc<T, ProfilerAlloc>>
764 using ProfilerStack = std::stack<T, std::deque<T, A>>;
765
766 /** Default thread policy for the framework. Performs special startup/shutdown on threads managed by thread pool. */
767 class BS_CORE_EXPORT ThreadDefaultPolicy
768 {
769 public:
770 static void onThreadStarted(const String& name)
771 {
772 MemStack::beginThread();
773 }
774
775 static void onThreadEnded(const String& name)
776 {
777 MemStack::endThread();
778 }
779 };
780
781 #define BS_ALL_LAYERS 0xFFFFFFFFFFFFFFFF
782
783 /** Used for marking a CoreObject dependency as dirty. */
784 static constexpr INT32 DIRTY_DEPENDENCY_MASK = 1 << 31;
785
786 template<class T, bool Core>
787 struct CoreVariant { };
788
789 template<class T>
790 struct CoreVariant<T, false> { typedef T Type; };
791
792 template<class T> struct CoreVariant<T, true> { typedef typename CoreThreadType<T>::Type Type; };
793
794 /**
795 * Allows a simple way to define a member that can be both CoreObject variants depending on the Core template
796 * parameter.
797 */
798 template<class T, bool Core>
799 using CoreVariantType = typename CoreVariant<T, Core>::Type;
800
801 template<class T, bool Core>
802 struct CoreVariantHandle { };
803
804 template<class T>
805 struct CoreVariantHandle<T, false> { typedef ResourceHandle<T> Type; };
806
807 template<class T> struct CoreVariantHandle<T, true> { typedef SPtr<typename CoreThreadType<T>::Type> Type; };
808
809 /**
810 * Allows a simple way to define a member that can be both CoreObject variants depending on the Core template
811 * parameter. Sim thread type is wrapped in as a resource handle while the core thread variant is wrapped in a shared
812 * pointer.
813 */
814 template<class T, bool Core>
815 using CoreVariantHandleType = typename CoreVariantHandle<T, Core>::Type;
816
817 /** Flags that are provided to the serialization system to control serialization/deserialization. */
818 enum SerializationFlags
819 {
820 /**
821 * Used when deserializing resources. Lets the system know not to discard any intermediate resource data that might
822 * be required if the resource needs to be serialized.
823 */
824 SF_KeepResourceSourceData = 1
825 };
826
827 /** Helper type that can contain either a component or scene actor version of an object. */
828 template<class T>
829 struct ComponentOrActor
830 {
831 using ComponentType = typename ComponentType<T>::Type;
832 using HandleType = GameObjectHandle<ComponentType>;
833
834 ComponentOrActor() = default;
835
836 ComponentOrActor(const GameObjectHandle<ComponentType>& component)
837 :mComponent(component)
838 { }
839
840 ComponentOrActor(const SPtr<T>& actor)
841 :mActor(actor)
842 { }
843
844 /** Returns true if both the component and the actor fields are not assigned. */
845 bool empty() const
846 {
847 return !mActor && !mComponent;
848 }
849
850 /** Returns the assigned value as a scene actor. */
851 SPtr<T> getActor() const
852 {
853 if(mActor)
854 return mActor;
855
856 return mComponent->_getInternal();
857 }
858
859 /** Returns the assigned value as a component. */
860 HandleType getComponent() const
861 {
862 return mComponent;
863 }
864
865 private:
866 GameObjectHandle<ComponentType> mComponent;
867 SPtr<T> mActor;
868 };
869}
870
871#include "Utility/BsCommonTypes.h"
872