BsCorePrerequisites.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655
  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 MultiRenderTexture;
  190. class MultiRenderTextureCore;
  191. class RenderWindow;
  192. class RenderWindowCore;
  193. class RenderTargetProperties;
  194. struct RenderOpMesh;
  195. class StringInterface;
  196. class SamplerState;
  197. class SamplerStateCore;
  198. class TextureManager;
  199. class Viewport;
  200. class VertexData;
  201. class VertexDeclaration;
  202. class Input;
  203. struct PointerEvent;
  204. class RawInputHandler;
  205. class CoreRenderer;
  206. class RendererFactory;
  207. class AsyncOp;
  208. class HardwareBufferManager;
  209. class FontManager;
  210. class DepthStencilState;
  211. class DepthStencilStateCore;
  212. class RenderStateManager;
  213. class RasterizerState;
  214. class RasterizerStateCore;
  215. class BlendState;
  216. class BlendStateCore;
  217. class GpuParamBlock;
  218. class GpuParamBlockBuffer;
  219. class GpuParams;
  220. struct GpuParamDesc;
  221. struct GpuParamDataDesc;
  222. struct GpuParamObjectDesc;
  223. struct GpuParamBlockDesc;
  224. class ShaderInclude;
  225. class TextureView;
  226. class CoreObject;
  227. class CoreObjectCore;
  228. class ImportOptions;
  229. class TextureImportOptions;
  230. class FontImportOptions;
  231. class GpuProgramImportOptions;
  232. class MeshImportOptions;
  233. struct FontBitmap;
  234. class GameObject;
  235. class GpuResourceData;
  236. struct RenderOperation;
  237. class RenderQueue;
  238. struct ProfilerReport;
  239. class VertexDataDesc;
  240. class EventQuery;
  241. class TimerQuery;
  242. class OcclusionQuery;
  243. class FrameAlloc;
  244. class FolderMonitor;
  245. class VideoMode;
  246. class VideoOutputInfo;
  247. class VideoModeInfo;
  248. class RenderableElement;
  249. class CameraCore;
  250. class MeshCoreBase;
  251. class MeshCore;
  252. struct SubMesh;
  253. class TransientMeshCore;
  254. class TextureCore;
  255. class MeshHeapCore;
  256. class VertexDeclarationCore;
  257. class GpuBufferCore;
  258. class GpuParamBlockBufferCore;
  259. class GpuParamsCore;
  260. class ShaderCore;
  261. class ViewportCore;
  262. class PassCore;
  263. class GpuParamsSetCore;
  264. class TechniqueCore;
  265. class MaterialCore;
  266. class GpuProgramCore;
  267. class IResourceListener;
  268. class TextureProperties;
  269. class IShaderIncludeHandler;
  270. class Prefab;
  271. class PrefabDiff;
  272. class RendererMeshData;
  273. class LightCore;
  274. class Light;
  275. class Win32Window;
  276. class RenderAPIFactory;
  277. class PhysicsManager;
  278. class Physics;
  279. class FCollider;
  280. class Collider;
  281. class Rigidbody;
  282. class PhysicsMaterial;
  283. class BoxCollider;
  284. class SphereCollider;
  285. class PlaneCollider;
  286. class CapsuleCollider;
  287. class MeshCollider;
  288. class CCollider;
  289. class CRigidbody;
  290. class CBoxCollider;
  291. class CSphereCollider;
  292. class CPlaneCollider;
  293. class CCapsuleCollider;
  294. class CMeshCollider;
  295. class Joint;
  296. class FixedJoint;
  297. class DistanceJoint;
  298. class HingeJoint;
  299. class SphericalJoint;
  300. class SliderJoint;
  301. class D6Joint;
  302. class CharacterController;
  303. class CJoint;
  304. class CHingeJoint;
  305. class CDistanceJoint;
  306. class CFixedJoint;
  307. class CSphericalJoint;
  308. class CSliderJoint;
  309. class CD6Joint;
  310. class CCharacterController;
  311. class ShaderDefines;
  312. class ShaderImportOptions;
  313. class AudioListener;
  314. class AudioSource;
  315. class AudioClipImportOptions;
  316. class AnimationClip;
  317. class CCamera;
  318. template <class T> class TAnimationCurve;
  319. struct AnimationCurves;
  320. class Skeleton;
  321. class Animation;
  322. class GpuParamsSet;
  323. class GpuParamsSetCore;
  324. class MaterialParamsCore;
  325. class Camera;
  326. class CameraCore;
  327. // Asset import
  328. class SpecificImporter;
  329. class Importer;
  330. // Resources
  331. class Resource;
  332. class Resources;
  333. class ResourceManifest;
  334. class Texture;
  335. class Mesh;
  336. class MeshBase;
  337. class TransientMesh;
  338. class MeshHeap;
  339. class Font;
  340. class ResourceMetaData;
  341. class OSDropTarget;
  342. class StringTable;
  343. class PhysicsMaterial;
  344. class PhysicsMesh;
  345. class AudioClip;
  346. struct CollisionData;
  347. // Scene
  348. class SceneObject;
  349. class Component;
  350. class SceneManager;
  351. // RTTI
  352. class MeshRTTI;
  353. // Desc structs
  354. struct SAMPLER_STATE_DESC;
  355. struct DEPTH_STENCIL_STATE_DESC;
  356. struct RASTERIZER_STATE_DESC;
  357. struct BLEND_STATE_DESC;
  358. struct RENDER_TARGET_BLEND_STATE_DESC;
  359. struct RENDER_TEXTURE_DESC;
  360. struct RENDER_WINDOW_DESC;
  361. struct FONT_DESC;
  362. struct CHAR_CONTROLLER_DESC;
  363. struct JOINT_DESC;
  364. struct FIXED_JOINT_DESC;
  365. struct DISTANCE_JOINT_DESC;
  366. struct HINGE_JOINT_DESC;
  367. struct SLIDER_JOINT_DESC;
  368. struct SPHERICAL_JOINT_DESC;
  369. struct D6_JOINT_DESC;
  370. struct AUDIO_CLIP_DESC;
  371. template<class T>
  372. class CoreThreadAccessor;
  373. class CommandQueueNoSync;
  374. class CommandQueueSync;
  375. }
  376. /************************************************************************/
  377. /* Typedefs */
  378. /************************************************************************/
  379. namespace BansheeEngine
  380. {
  381. typedef CoreThreadAccessor<CommandQueueNoSync> CoreAccessor;
  382. typedef CoreThreadAccessor<CommandQueueSync> SyncedCoreAccessor;
  383. }
  384. /************************************************************************/
  385. /* RTTI */
  386. /************************************************************************/
  387. namespace BansheeEngine
  388. {
  389. enum TypeID_Core
  390. {
  391. TID_Texture = 1001,
  392. TID_Mesh = 1002,
  393. TID_MeshData = 1003,
  394. TID_VertexDeclaration = 1004,
  395. TID_VertexElementData = 1005,
  396. TID_Component = 1006,
  397. TID_ResourceHandle = 1009,
  398. TID_GpuProgram = 1010,
  399. TID_ResourceHandleData = 1011,
  400. TID_CgProgram = 1012,
  401. TID_Pass = 1014,
  402. TID_Technique = 1015,
  403. TID_Shader = 1016,
  404. TID_Material = 1017,
  405. TID_SamplerState = 1021,
  406. TID_BlendState = 1023,
  407. TID_RasterizerState = 1024,
  408. TID_DepthStencilState = 1025,
  409. TID_BLEND_STATE_DESC = 1034,
  410. TID_SHADER_DATA_PARAM_DESC = 1035,
  411. TID_SHADER_OBJECT_PARAM_DESC = 1036,
  412. TID_SHADER_PARAM_BLOCK_DESC = 1047,
  413. TID_ImportOptions = 1048,
  414. TID_Font = 1051,
  415. TID_FONT_DESC = 1052,
  416. TID_CHAR_DESC = 1053,
  417. TID_FontImportOptions = 1056,
  418. TID_FontBitmap = 1057,
  419. TID_SceneObject = 1059,
  420. TID_GameObject = 1060,
  421. TID_PixelData = 1062,
  422. TID_GpuResourceData = 1063,
  423. TID_VertexDataDesc = 1064,
  424. TID_MeshBase = 1065,
  425. TID_GameObjectHandleBase = 1066,
  426. TID_ResourceManifest = 1067,
  427. TID_ResourceManifestEntry = 1068,
  428. TID_EmulatedParamBlock = 1069,
  429. TID_TextureImportOptions = 1070,
  430. TID_ResourceMetaData = 1071,
  431. TID_ShaderInclude = 1072,
  432. TID_Viewport = 1073,
  433. TID_ResourceDependencies = 1074,
  434. TID_ShaderMetaData = 1075,
  435. TID_MeshImportOptions = 1076,
  436. TID_Prefab = 1077,
  437. TID_PrefabDiff = 1078,
  438. TID_PrefabObjectDiff = 1079,
  439. TID_PrefabComponentDiff = 1080,
  440. TID_CGUIWidget = 1081,
  441. TID_ProfilerOverlay = 1082,
  442. TID_StringTable = 1083,
  443. TID_LanguageData = 1084,
  444. TID_LocalizedStringData = 1085,
  445. TID_MaterialParamColor = 1086,
  446. TID_WeakResourceHandle = 1087,
  447. TID_TextureParamData = 1088,
  448. TID_StructParamData = 1089,
  449. TID_MaterialParams = 1090,
  450. TID_MaterialRTTIParam = 1091,
  451. TID_PhysicsMaterial = 1092,
  452. TID_CCollider = 1093,
  453. TID_CBoxCollider = 1094,
  454. TID_CSphereCollider = 1095,
  455. TID_CCapsuleCollider = 1096,
  456. TID_CPlaneCollider = 1097,
  457. TID_CRigidbody = 1098,
  458. TID_PhysicsMesh = 1099,
  459. TID_CMeshCollider = 1100,
  460. TID_CJoint = 1101,
  461. TID_CFixedJoint = 1102,
  462. TID_CDistanceJoint = 1103,
  463. TID_CHingeJoint = 1104,
  464. TID_CSphericalJoint = 1105,
  465. TID_CSliderJoint = 1106,
  466. TID_CD6Joint = 1107,
  467. TID_CCharacterController = 1108,
  468. TID_FPhysicsMesh = 1109,
  469. TID_ShaderImportOptions = 1110,
  470. TID_AudioClip = 1111,
  471. TID_AudioClipImportOptions = 1112,
  472. TID_CAudioListener = 1113,
  473. TID_CAudioSource = 1114,
  474. TID_AnimationClip = 1115,
  475. TID_AnimationCurve = 1116,
  476. TID_KeyFrame = 1117,
  477. TID_NamedAnimationCurve = 1118,
  478. TID_Skeleton = 1119,
  479. TID_SkeletonBoneInfo = 1120,
  480. TID_AnimationSplitInfo = 1121,
  481. TID_CAnimation = 1122,
  482. TID_AnimationEvent = 1123,
  483. TID_ImportedAnimationEvents = 1124,
  484. TID_CBone = 1125,
  485. TID_MaterialParamData = 1126,
  486. TID_PostProcessSettings = 1127,
  487. // Moved from Engine layer
  488. TID_CCamera = 30000,
  489. TID_Camera = 30003,
  490. };
  491. }
  492. /************************************************************************/
  493. /* Resource references */
  494. /************************************************************************/
  495. #include "BsResourceHandle.h"
  496. namespace BansheeEngine
  497. {
  498. /** @addtogroup Resources
  499. * @{
  500. */
  501. typedef ResourceHandle<Resource> HResource;
  502. typedef ResourceHandle<Texture> HTexture;
  503. typedef ResourceHandle<Mesh> HMesh;
  504. typedef ResourceHandle<Material> HMaterial;
  505. typedef ResourceHandle<ShaderInclude> HShaderInclude;
  506. typedef ResourceHandle<Font> HFont;
  507. typedef ResourceHandle<Shader> HShader;
  508. typedef ResourceHandle<Prefab> HPrefab;
  509. typedef ResourceHandle<StringTable> HStringTable;
  510. typedef ResourceHandle<PhysicsMaterial> HPhysicsMaterial;
  511. typedef ResourceHandle<PhysicsMesh> HPhysicsMesh;
  512. typedef ResourceHandle<AudioClip> HAudioClip;
  513. typedef ResourceHandle<AnimationClip> HAnimationClip;
  514. /** @} */
  515. }
  516. #include "BsGameObjectHandle.h"
  517. namespace BansheeEngine
  518. {
  519. /** @addtogroup Scene
  520. * @{
  521. */
  522. // Game object handles
  523. typedef GameObjectHandle<GameObject> HGameObject;
  524. typedef GameObjectHandle<SceneObject> HSceneObject;
  525. typedef GameObjectHandle<Component> HComponent;
  526. typedef GameObjectHandle<CCamera> HCamera;
  527. typedef GameObjectHandle<CRigidbody> HRigidbody;
  528. typedef GameObjectHandle<CCollider> HCollider;
  529. typedef GameObjectHandle<CBoxCollider> HBoxCollider;
  530. typedef GameObjectHandle<CSphereCollider> HSphereCollider;
  531. typedef GameObjectHandle<CCapsuleCollider> HCapsuleCollider;
  532. typedef GameObjectHandle<CPlaneCollider> HPlaneCollider;
  533. typedef GameObjectHandle<CJoint> HJoint;
  534. typedef GameObjectHandle<CHingeJoint> HHingeJoint;
  535. typedef GameObjectHandle<CSliderJoint> HSliderJoint;
  536. typedef GameObjectHandle<CDistanceJoint> HDistanceJoint;
  537. typedef GameObjectHandle<CSphericalJoint> HSphericalJoint;
  538. typedef GameObjectHandle<CFixedJoint> HFixedJoint;
  539. typedef GameObjectHandle<CD6Joint> HD6Joint;
  540. typedef GameObjectHandle<CCharacterController> HCharacterController;
  541. /** @} */
  542. }
  543. namespace BansheeEngine
  544. {
  545. /**
  546. * Defers function execution until the next frame. If this function is called within another deferred call, then it will
  547. * be executed the same frame, but only after all existing deferred calls are done.
  548. *
  549. * @note
  550. * This method can be used for breaking dependencies among other things. If a class A depends on class B having
  551. * something done, but class B also depends in some way on class A, you can break up the initialization into two
  552. * separate steps, queuing the second step using this method.
  553. * @note
  554. * Similar situation can happen if you have multiple classes being initialized in an undefined order but some of them
  555. * depend on others. Using this method you can defer the dependent step until next frame, which will ensure everything
  556. * was initialized.
  557. *
  558. * @param[in] callback The callback.
  559. */
  560. void BS_CORE_EXPORT deferredCall(std::function<void()> callback);
  561. // Special types for use by profilers
  562. typedef std::basic_string<char, std::char_traits<char>, StdAlloc<char, ProfilerAlloc>> ProfilerString;
  563. template <typename T, typename A = StdAlloc<T, ProfilerAlloc>>
  564. using ProfilerVector = std::vector<T, A>;
  565. template <typename T, typename A = StdAlloc<T, ProfilerAlloc>>
  566. using ProfilerStack = std::stack<T, std::deque<T, A>>;
  567. /** Banshee thread policy that performs special startup/shutdown on threads managed by thread pool. */
  568. class BS_CORE_EXPORT ThreadBansheePolicy
  569. {
  570. public:
  571. static void onThreadStarted(const String& name)
  572. {
  573. MemStack::beginThread();
  574. }
  575. static void onThreadEnded(const String& name)
  576. {
  577. MemStack::endThread();
  578. }
  579. };
  580. #define BS_ALL_LAYERS 0xFFFFFFFFFFFFFFFF
  581. }
  582. #include "BsCommonTypes.h"