BsCorePrerequisites.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. #pragma once
  4. #include "BsPrerequisitesUtil.h"
  5. /** @addtogroup Layers
  6. * @{
  7. */
  8. /** @defgroup Core Core
  9. * Second lowest layer that provides core engine functionality and abstract interfaces for various systems.
  10. * @{
  11. */
  12. /** @defgroup Animation Animation
  13. * %Animation clips, skeletal and blend shape animation, animation playback, blending and other features.
  14. */
  15. /** @defgroup Application-Core Application
  16. * Entry point into the application and other general functionality.
  17. */
  18. /** @defgroup Audio Audio
  19. * %Audio clips, 3D sound and music reproduction.
  20. */
  21. /** @defgroup Components-Core Components
  22. * Built-in components (elements that may be attached to scene objects).
  23. */
  24. /** @defgroup CoreThread Core thread
  25. * Core objects and interaction with the core (rendering) thread.
  26. */
  27. /** @defgroup Importer Importer
  28. * Import of resources into engine friendly format.
  29. */
  30. /** @defgroup Input Input
  31. * %Input (mouse, keyboard, gamepad, etc.).
  32. */
  33. /** @defgroup Localization Localization
  34. * GUI localization.
  35. */
  36. /** @defgroup Material Material
  37. * Materials, shaders and related functionality.
  38. */
  39. /** @defgroup Physics Physics
  40. * %Physics system: colliders, triggers, rigidbodies, joints, scene queries, etc.
  41. */
  42. /** @defgroup Profiling Profiling
  43. * Measuring CPU and GPU execution times and memory usage.
  44. */
  45. /** @defgroup RenderAPI RenderAPI
  46. * Interface for interacting with the render API (DirectX, OpenGL, etc.).
  47. */
  48. /** @defgroup Renderer Renderer
  49. * Abstract interface and helper functionality for rendering scene objects.
  50. */
  51. /** @defgroup Resources Resources
  52. * Core resource types and resource management functionality (loading, saving, etc.).
  53. */
  54. /** @cond RTTI */
  55. /** @defgroup RTTI-Impl-Core RTTI types
  56. * RTTI implementations for classes within the core layer.
  57. */
  58. /** @endcond */
  59. /** @defgroup Scene Scene
  60. * Managing scene objects and their hierarchy.
  61. */
  62. /** @defgroup Text Text
  63. * Generating text geometry.
  64. */
  65. /** @defgroup Utility-Core Utility
  66. * Various utility methods and types used by the core layer.
  67. */
  68. /** @} */
  69. /** @} */
  70. /** @addtogroup Internals
  71. * @{
  72. */
  73. /** @defgroup Internal-Core Core
  74. * Second lowest layer that provides core engine functionality and abstract interfaces for various systems.
  75. * @{
  76. */
  77. /** @defgroup Animation-Internal Animation
  78. * Animation clips, skeletal and blend shape animation, animation playback, blending and other features.
  79. */
  80. /** @defgroup Audio-Internal Audio
  81. * Audio clips, 3D sound and music reproduction.
  82. */
  83. /** @defgroup CoreThread-Internal Core thread
  84. * Core objects and interaction with the core (rendering) thread.
  85. */
  86. /** @defgroup Importer-Internal Importer
  87. * Import of resources into engine friendly format.
  88. */
  89. /** @defgroup Input-Internal Input
  90. * Input (mouse, keyboard, gamepad, etc.).
  91. */
  92. /** @defgroup Localization-Internal Localization
  93. * GUI localization.
  94. */
  95. /** @defgroup Material-Internal Material
  96. * Materials, shaders and related functionality.
  97. */
  98. /** @defgroup Physics-Internal Physics
  99. * Physics system: colliders, triggers, rigidbodies, joints, scene queries, etc.
  100. */
  101. /** @defgroup Platform-Internal Platform
  102. * Interface for interacting with the platform (OS).
  103. */
  104. /** @defgroup Profiling-Internal Profiling
  105. * Measuring CPU and GPU execution times and memory usage.
  106. */
  107. /** @defgroup RenderAPI-Internal RenderAPI
  108. * Interface for interacting with the render API (DirectX, OpenGL, etc.).
  109. */
  110. /** @defgroup Renderer-Internal Renderer
  111. * Abstract interface and helper functionality for rendering scene objects.
  112. */
  113. /** @defgroup Resources-Internal Resources
  114. * Core resource types and resource management functionality (loading, saving, etc.).
  115. */
  116. /** @defgroup Scene-Internal Scene
  117. * Managing scene objects and their hierarchy.
  118. */
  119. /** @defgroup Text-Internal Text
  120. * Generating text geometry.
  121. */
  122. /** @defgroup Utility-Core-Internal Utility
  123. * Various utility methods and types used by the core layer.
  124. */
  125. /** @} */
  126. /** @} */
  127. /** Maximum number of color surfaces that can be attached to a multi render target. */
  128. #define BS_MAX_MULTIPLE_RENDER_TARGETS 8
  129. #define BS_FORCE_SINGLETHREADED_RENDERING 0
  130. // Windows Settings
  131. #if BS_PLATFORM == BS_PLATFORM_WIN32
  132. // If we're not including this from a client build, specify that the stuff
  133. // should get exported. Otherwise, import it.
  134. # if defined(BS_STATIC_LIB)
  135. // Linux compilers don't have symbol import/export directives.
  136. # define BS_CORE_EXPORT
  137. # else
  138. # if defined(BS_CORE_EXPORTS)
  139. # define BS_CORE_EXPORT __declspec( dllexport )
  140. # else
  141. # if defined( __MINGW32__ )
  142. # define BS_CORE_EXPORT
  143. # else
  144. # define BS_CORE_EXPORT __declspec( dllimport )
  145. # endif
  146. # endif
  147. # endif
  148. #endif
  149. // Linux/Apple Settings
  150. #if BS_PLATFORM == BS_PLATFORM_LINUX || BS_PLATFORM == BS_PLATFORM_OSX
  151. // Enable GCC symbol visibility
  152. # if defined( BS_GCC_VISIBILITY )
  153. # define BS_CORE_EXPORT __attribute__ ((visibility("default")))
  154. # define BS_HIDDEN __attribute__ ((visibility("hidden")))
  155. # else
  156. # define BS_CORE_EXPORT
  157. # define BS_HIDDEN
  158. # endif
  159. #endif
  160. #include "BsHString.h"
  161. namespace BansheeEngine
  162. {
  163. static const StringID RenderAPIAny = "AnyRenderAPI";
  164. static const StringID RendererAny = "AnyRenderer";
  165. class Color;
  166. class GpuProgram;
  167. class GpuProgramManager;
  168. class IndexBuffer;
  169. class IndexBufferCore;
  170. class OcclusionQuery;
  171. class VertexBuffer;
  172. class VertexBufferCore;
  173. class PixelBuffer;
  174. class GpuBuffer;
  175. class HighLevelGpuProgram;
  176. class GpuProgramManager;
  177. class GpuProgramFactory;
  178. class IndexData;
  179. class Pass;
  180. class Technique;
  181. class Shader;
  182. class Material;
  183. class RenderAPICore;
  184. class RenderAPICapabilities;
  185. class RenderTarget;
  186. class RenderTargetCore;
  187. class RenderTexture;
  188. class RenderTextureCore;
  189. class RenderWindow;
  190. class RenderWindowCore;
  191. class RenderTargetProperties;
  192. struct RenderOpMesh;
  193. class StringInterface;
  194. class SamplerState;
  195. class SamplerStateCore;
  196. class TextureManager;
  197. class Viewport;
  198. class VertexData;
  199. class VertexDeclaration;
  200. class Input;
  201. struct PointerEvent;
  202. class RawInputHandler;
  203. class CoreRenderer;
  204. class RendererFactory;
  205. class AsyncOp;
  206. class HardwareBufferManager;
  207. class FontManager;
  208. class DepthStencilState;
  209. class DepthStencilStateCore;
  210. class RenderStateManager;
  211. class RasterizerState;
  212. class RasterizerStateCore;
  213. class BlendState;
  214. class BlendStateCore;
  215. class GpuParamBlock;
  216. class GpuParamBlockBuffer;
  217. class GpuParams;
  218. struct GpuParamDesc;
  219. struct GpuParamDataDesc;
  220. struct GpuParamObjectDesc;
  221. struct GpuParamBlockDesc;
  222. class ShaderInclude;
  223. class TextureView;
  224. class CoreObject;
  225. class CoreObjectCore;
  226. class ImportOptions;
  227. class TextureImportOptions;
  228. class FontImportOptions;
  229. class GpuProgramImportOptions;
  230. class MeshImportOptions;
  231. struct FontBitmap;
  232. class GameObject;
  233. class GpuResourceData;
  234. struct RenderOperation;
  235. class RenderQueue;
  236. struct ProfilerReport;
  237. class VertexDataDesc;
  238. class EventQuery;
  239. class TimerQuery;
  240. class OcclusionQuery;
  241. class FrameAlloc;
  242. class FolderMonitor;
  243. class VideoMode;
  244. class VideoOutputInfo;
  245. class VideoModeInfo;
  246. class RenderableElement;
  247. class CameraCore;
  248. class MeshCoreBase;
  249. class MeshCore;
  250. struct SubMesh;
  251. class TransientMeshCore;
  252. class TextureCore;
  253. class MeshHeapCore;
  254. class VertexDeclarationCore;
  255. class GpuBufferCore;
  256. class GpuParamBlockBufferCore;
  257. class GpuParamsCore;
  258. class ShaderCore;
  259. class ViewportCore;
  260. class PassCore;
  261. class GpuParamsSetCore;
  262. class TechniqueCore;
  263. class MaterialCore;
  264. class GpuProgramCore;
  265. class IResourceListener;
  266. class TextureProperties;
  267. class IShaderIncludeHandler;
  268. class Prefab;
  269. class PrefabDiff;
  270. class RendererMeshData;
  271. class LightCore;
  272. class Light;
  273. class Win32Window;
  274. class RenderAPIFactory;
  275. class PhysicsManager;
  276. class Physics;
  277. class FCollider;
  278. class Collider;
  279. class Rigidbody;
  280. class PhysicsMaterial;
  281. class BoxCollider;
  282. class SphereCollider;
  283. class PlaneCollider;
  284. class CapsuleCollider;
  285. class MeshCollider;
  286. class CCollider;
  287. class CRigidbody;
  288. class CBoxCollider;
  289. class CSphereCollider;
  290. class CPlaneCollider;
  291. class CCapsuleCollider;
  292. class CMeshCollider;
  293. class Joint;
  294. class FixedJoint;
  295. class DistanceJoint;
  296. class HingeJoint;
  297. class SphericalJoint;
  298. class SliderJoint;
  299. class D6Joint;
  300. class CharacterController;
  301. class CJoint;
  302. class CHingeJoint;
  303. class CDistanceJoint;
  304. class CFixedJoint;
  305. class CSphericalJoint;
  306. class CSliderJoint;
  307. class CD6Joint;
  308. class CCharacterController;
  309. class ShaderDefines;
  310. class ShaderImportOptions;
  311. class AudioListener;
  312. class AudioSource;
  313. class AudioClipImportOptions;
  314. class AnimationClip;
  315. class CCamera;
  316. template <class T> class TAnimationCurve;
  317. struct AnimationCurves;
  318. class Skeleton;
  319. class Animation;
  320. class GpuParamsSet;
  321. class GpuParamsSetCore;
  322. class MaterialParamsCore;
  323. class Camera;
  324. class CameraCore;
  325. class MorphShapes;
  326. class MorphShape;
  327. class MorphChannel;
  328. class CommandBuffer;
  329. class GpuPipelineState;
  330. class GpuPipelineStateCore;
  331. // Asset import
  332. class SpecificImporter;
  333. class Importer;
  334. // Resources
  335. class Resource;
  336. class Resources;
  337. class ResourceManifest;
  338. class Texture;
  339. class Mesh;
  340. class MeshBase;
  341. class TransientMesh;
  342. class MeshHeap;
  343. class Font;
  344. class ResourceMetaData;
  345. class OSDropTarget;
  346. class StringTable;
  347. class PhysicsMaterial;
  348. class PhysicsMesh;
  349. class AudioClip;
  350. struct CollisionData;
  351. // Scene
  352. class SceneObject;
  353. class Component;
  354. class SceneManager;
  355. // RTTI
  356. class MeshRTTI;
  357. // Desc structs
  358. struct SAMPLER_STATE_DESC;
  359. struct DEPTH_STENCIL_STATE_DESC;
  360. struct RASTERIZER_STATE_DESC;
  361. struct BLEND_STATE_DESC;
  362. struct RENDER_TARGET_BLEND_STATE_DESC;
  363. struct RENDER_TEXTURE_DESC;
  364. struct RENDER_WINDOW_DESC;
  365. struct FONT_DESC;
  366. struct CHAR_CONTROLLER_DESC;
  367. struct JOINT_DESC;
  368. struct FIXED_JOINT_DESC;
  369. struct DISTANCE_JOINT_DESC;
  370. struct HINGE_JOINT_DESC;
  371. struct SLIDER_JOINT_DESC;
  372. struct SPHERICAL_JOINT_DESC;
  373. struct D6_JOINT_DESC;
  374. struct AUDIO_CLIP_DESC;
  375. template<class T>
  376. class CoreThreadAccessor;
  377. class CommandQueueNoSync;
  378. class CommandQueueSync;
  379. }
  380. /************************************************************************/
  381. /* Typedefs */
  382. /************************************************************************/
  383. namespace BansheeEngine
  384. {
  385. typedef CoreThreadAccessor<CommandQueueNoSync> CoreAccessor;
  386. typedef CoreThreadAccessor<CommandQueueSync> SyncedCoreAccessor;
  387. }
  388. /************************************************************************/
  389. /* RTTI */
  390. /************************************************************************/
  391. namespace BansheeEngine
  392. {
  393. enum TypeID_Core
  394. {
  395. TID_Texture = 1001,
  396. TID_Mesh = 1002,
  397. TID_MeshData = 1003,
  398. TID_VertexDeclaration = 1004,
  399. TID_VertexElementData = 1005,
  400. TID_Component = 1006,
  401. TID_ResourceHandle = 1009,
  402. TID_GpuProgram = 1010,
  403. TID_ResourceHandleData = 1011,
  404. TID_CgProgram = 1012,
  405. TID_Pass = 1014,
  406. TID_Technique = 1015,
  407. TID_Shader = 1016,
  408. TID_Material = 1017,
  409. TID_SamplerState = 1021,
  410. TID_BlendState = 1023,
  411. TID_RasterizerState = 1024,
  412. TID_DepthStencilState = 1025,
  413. TID_BLEND_STATE_DESC = 1034,
  414. TID_SHADER_DATA_PARAM_DESC = 1035,
  415. TID_SHADER_OBJECT_PARAM_DESC = 1036,
  416. TID_SHADER_PARAM_BLOCK_DESC = 1047,
  417. TID_ImportOptions = 1048,
  418. TID_Font = 1051,
  419. TID_FONT_DESC = 1052,
  420. TID_CHAR_DESC = 1053,
  421. TID_FontImportOptions = 1056,
  422. TID_FontBitmap = 1057,
  423. TID_SceneObject = 1059,
  424. TID_GameObject = 1060,
  425. TID_PixelData = 1062,
  426. TID_GpuResourceData = 1063,
  427. TID_VertexDataDesc = 1064,
  428. TID_MeshBase = 1065,
  429. TID_GameObjectHandleBase = 1066,
  430. TID_ResourceManifest = 1067,
  431. TID_ResourceManifestEntry = 1068,
  432. TID_EmulatedParamBlock = 1069,
  433. TID_TextureImportOptions = 1070,
  434. TID_ResourceMetaData = 1071,
  435. TID_ShaderInclude = 1072,
  436. TID_Viewport = 1073,
  437. TID_ResourceDependencies = 1074,
  438. TID_ShaderMetaData = 1075,
  439. TID_MeshImportOptions = 1076,
  440. TID_Prefab = 1077,
  441. TID_PrefabDiff = 1078,
  442. TID_PrefabObjectDiff = 1079,
  443. TID_PrefabComponentDiff = 1080,
  444. TID_CGUIWidget = 1081,
  445. TID_ProfilerOverlay = 1082,
  446. TID_StringTable = 1083,
  447. TID_LanguageData = 1084,
  448. TID_LocalizedStringData = 1085,
  449. TID_MaterialParamColor = 1086,
  450. TID_WeakResourceHandle = 1087,
  451. TID_TextureParamData = 1088,
  452. TID_StructParamData = 1089,
  453. TID_MaterialParams = 1090,
  454. TID_MaterialRTTIParam = 1091,
  455. TID_PhysicsMaterial = 1092,
  456. TID_CCollider = 1093,
  457. TID_CBoxCollider = 1094,
  458. TID_CSphereCollider = 1095,
  459. TID_CCapsuleCollider = 1096,
  460. TID_CPlaneCollider = 1097,
  461. TID_CRigidbody = 1098,
  462. TID_PhysicsMesh = 1099,
  463. TID_CMeshCollider = 1100,
  464. TID_CJoint = 1101,
  465. TID_CFixedJoint = 1102,
  466. TID_CDistanceJoint = 1103,
  467. TID_CHingeJoint = 1104,
  468. TID_CSphericalJoint = 1105,
  469. TID_CSliderJoint = 1106,
  470. TID_CD6Joint = 1107,
  471. TID_CCharacterController = 1108,
  472. TID_FPhysicsMesh = 1109,
  473. TID_ShaderImportOptions = 1110,
  474. TID_AudioClip = 1111,
  475. TID_AudioClipImportOptions = 1112,
  476. TID_CAudioListener = 1113,
  477. TID_CAudioSource = 1114,
  478. TID_AnimationClip = 1115,
  479. TID_AnimationCurve = 1116,
  480. TID_KeyFrame = 1117,
  481. TID_NamedAnimationCurve = 1118,
  482. TID_Skeleton = 1119,
  483. TID_SkeletonBoneInfo = 1120,
  484. TID_AnimationSplitInfo = 1121,
  485. TID_CAnimation = 1122,
  486. TID_AnimationEvent = 1123,
  487. TID_ImportedAnimationEvents = 1124,
  488. TID_CBone = 1125,
  489. TID_MaterialParamData = 1126,
  490. TID_PostProcessSettings = 1127,
  491. TID_MorphShape = 1128,
  492. TID_MorphShapes = 1129,
  493. TID_MorphChannel = 1130,
  494. // Moved from Engine layer
  495. TID_CCamera = 30000,
  496. TID_Camera = 30003,
  497. };
  498. }
  499. /************************************************************************/
  500. /* Resource references */
  501. /************************************************************************/
  502. #include "BsResourceHandle.h"
  503. namespace BansheeEngine
  504. {
  505. /** @addtogroup Resources
  506. * @{
  507. */
  508. typedef ResourceHandle<Resource> HResource;
  509. typedef ResourceHandle<Texture> HTexture;
  510. typedef ResourceHandle<Mesh> HMesh;
  511. typedef ResourceHandle<Material> HMaterial;
  512. typedef ResourceHandle<ShaderInclude> HShaderInclude;
  513. typedef ResourceHandle<Font> HFont;
  514. typedef ResourceHandle<Shader> HShader;
  515. typedef ResourceHandle<Prefab> HPrefab;
  516. typedef ResourceHandle<StringTable> HStringTable;
  517. typedef ResourceHandle<PhysicsMaterial> HPhysicsMaterial;
  518. typedef ResourceHandle<PhysicsMesh> HPhysicsMesh;
  519. typedef ResourceHandle<AudioClip> HAudioClip;
  520. typedef ResourceHandle<AnimationClip> HAnimationClip;
  521. /** @} */
  522. }
  523. #include "BsGameObjectHandle.h"
  524. namespace BansheeEngine
  525. {
  526. /** @addtogroup Scene
  527. * @{
  528. */
  529. // Game object handles
  530. typedef GameObjectHandle<GameObject> HGameObject;
  531. typedef GameObjectHandle<SceneObject> HSceneObject;
  532. typedef GameObjectHandle<Component> HComponent;
  533. typedef GameObjectHandle<CCamera> HCamera;
  534. typedef GameObjectHandle<CRigidbody> HRigidbody;
  535. typedef GameObjectHandle<CCollider> HCollider;
  536. typedef GameObjectHandle<CBoxCollider> HBoxCollider;
  537. typedef GameObjectHandle<CSphereCollider> HSphereCollider;
  538. typedef GameObjectHandle<CCapsuleCollider> HCapsuleCollider;
  539. typedef GameObjectHandle<CPlaneCollider> HPlaneCollider;
  540. typedef GameObjectHandle<CJoint> HJoint;
  541. typedef GameObjectHandle<CHingeJoint> HHingeJoint;
  542. typedef GameObjectHandle<CSliderJoint> HSliderJoint;
  543. typedef GameObjectHandle<CDistanceJoint> HDistanceJoint;
  544. typedef GameObjectHandle<CSphericalJoint> HSphericalJoint;
  545. typedef GameObjectHandle<CFixedJoint> HFixedJoint;
  546. typedef GameObjectHandle<CD6Joint> HD6Joint;
  547. typedef GameObjectHandle<CCharacterController> HCharacterController;
  548. /** @} */
  549. }
  550. namespace BansheeEngine
  551. {
  552. /**
  553. * Defers function execution until the next frame. If this function is called within another deferred call, then it will
  554. * be executed the same frame, but only after all existing deferred calls are done.
  555. *
  556. * @note
  557. * This method can be used for breaking dependencies among other things. If a class A depends on class B having
  558. * something done, but class B also depends in some way on class A, you can break up the initialization into two
  559. * separate steps, queuing the second step using this method.
  560. * @note
  561. * Similar situation can happen if you have multiple classes being initialized in an undefined order but some of them
  562. * depend on others. Using this method you can defer the dependent step until next frame, which will ensure everything
  563. * was initialized.
  564. *
  565. * @param[in] callback The callback.
  566. */
  567. void BS_CORE_EXPORT deferredCall(std::function<void()> callback);
  568. // Special types for use by profilers
  569. typedef std::basic_string<char, std::char_traits<char>, StdAlloc<char, ProfilerAlloc>> ProfilerString;
  570. template <typename T, typename A = StdAlloc<T, ProfilerAlloc>>
  571. using ProfilerVector = std::vector<T, A>;
  572. template <typename T, typename A = StdAlloc<T, ProfilerAlloc>>
  573. using ProfilerStack = std::stack<T, std::deque<T, A>>;
  574. /** Banshee thread policy that performs special startup/shutdown on threads managed by thread pool. */
  575. class BS_CORE_EXPORT ThreadBansheePolicy
  576. {
  577. public:
  578. static void onThreadStarted(const String& name)
  579. {
  580. MemStack::beginThread();
  581. }
  582. static void onThreadEnded(const String& name)
  583. {
  584. MemStack::endThread();
  585. }
  586. };
  587. #define BS_ALL_LAYERS 0xFFFFFFFFFFFFFFFF
  588. }
  589. #include "BsCommonTypes.h"