BsCorePrerequisites.h 17 KB

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