CmPrerequisites.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  1. /*-------------------------------------------------------------------------
  2. This source file is a part of OGRE
  3. (Object-oriented Graphics Rendering Engine)
  4. For the latest info, see http://www.ogre3d.org/
  5. Copyright (c) 2000-2011 Torus Knot Software Ltd
  6. Permission is hereby granted, free of charge, to any person obtaining a copy
  7. of this software and associated documentation files (the "Software"), to deal
  8. in the Software without restriction, including without limitation the rights
  9. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  10. copies of the Software, and to permit persons to whom the Software is
  11. furnished to do so, subject to the following conditions:
  12. The above copyright notice and this permission notice shall be included in
  13. all copies or substantial portions of the Software.
  14. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20. THE SOFTWARE
  21. -------------------------------------------------------------------------*/
  22. #ifndef __OgrePrerequisites_H__
  23. #define __OgrePrerequisites_H__
  24. #include "CmPrerequisitesUtil.h"
  25. #define CM_MAX_MULTIPLE_RENDER_TARGETS 8
  26. #define CM_FORCE_SINGLETHREADED_RENDERING 0
  27. //----------------------------------------------------------------------------
  28. // Windows Settings
  29. #if CM_PLATFORM == CM_PLATFORM_WIN32
  30. // If we're not including this from a client build, specify that the stuff
  31. // should get exported. Otherwise, import it.
  32. # if defined( CM_STATIC_LIB )
  33. // Linux compilers don't have symbol import/export directives.
  34. # define CM_EXPORT
  35. # else
  36. # if defined( CM_EXPORTS )
  37. # define CM_EXPORT __declspec( dllexport )
  38. # else
  39. # if defined( __MINGW32__ )
  40. # define CM_EXPORT
  41. # else
  42. # define CM_EXPORT __declspec( dllimport )
  43. # endif
  44. # endif
  45. # endif
  46. // Win32 compilers use _DEBUG for specifying debug builds.
  47. // for MinGW, we set DEBUG
  48. # if defined(_DEBUG) || defined(DEBUG)
  49. # define CM_DEBUG_MODE 1
  50. # else
  51. # define CM_DEBUG_MODE 0
  52. # endif
  53. #endif // CM_PLATFORM == CM_PLATFORM_WIN32
  54. // Linux/Apple Settings
  55. #if CM_PLATFORM == CM_PLATFORM_LINUX || CM_PLATFORM == CM_PLATFORM_APPLE
  56. // Enable GCC symbol visibility
  57. # if defined( CM_GCC_VISIBILITY )
  58. # define CM_EXPORT __attribute__ ((visibility("default")))
  59. # define CM_HIDDEN __attribute__ ((visibility("hidden")))
  60. # else
  61. # define CM_EXPORT
  62. # define CM_HIDDEN
  63. # endif
  64. // A quick define to overcome different names for the same function
  65. # define stricmp strcasecmp
  66. # ifdef DEBUG
  67. # define CM_DEBUG_MODE 1
  68. # else
  69. # define CM_DEBUG_MODE 0
  70. # endif
  71. #endif
  72. #include "CmMemAllocCategories.h"
  73. namespace CamelotFramework {
  74. // Pre-declare classes
  75. // Allows use of pointers in header files without including individual .h
  76. // so decreases dependencies between files
  77. class Color;
  78. class GpuProgram;
  79. class GpuProgramManager;
  80. class IndexBuffer;
  81. class OcclusionQuery;
  82. class VertexBuffer;
  83. class PixelBuffer;
  84. class GpuBuffer;
  85. class HighLevelGpuProgram;
  86. class HighLevelGpuProgramManager;
  87. class HighLevelGpuProgramFactory;
  88. class IndexData;
  89. class Pass;
  90. class Technique;
  91. class Shader;
  92. class Material;
  93. class RenderSystem;
  94. class RenderSystemCapabilities;
  95. class RenderTarget;
  96. class RenderTexture;
  97. class MultiRenderTexture;
  98. class RenderWindow;
  99. class RenderOperation;
  100. class StringInterface;
  101. class SamplerState;
  102. class TextureManager;
  103. class Viewport;
  104. class VertexData;
  105. class VertexDeclaration;
  106. class Input;
  107. class InputHandler;
  108. class Renderer;
  109. class RendererFactory;
  110. class WorkQueue;
  111. class PassParameters;
  112. class AsyncOp;
  113. class HardwareBufferManager;
  114. class FontManager;
  115. class DepthStencilState;
  116. class RenderStateManager;
  117. class RasterizerState;
  118. class BlendState;
  119. class GpuParamBlock;
  120. class GpuParamBlockBuffer;
  121. class GpuParams;
  122. struct GpuParamDesc;
  123. struct GpuParamDataDesc;
  124. struct GpuParamObjectDesc;
  125. struct GpuParamBlockDesc;
  126. class GpuProgInclude;
  127. class TextureView;
  128. class CoreObject;
  129. class ImportOptions;
  130. struct FontData;
  131. class GameObject;
  132. class GpuResource;
  133. class GpuResourceData;
  134. class BindableGpuParams;
  135. // Asset import
  136. class SpecificImporter;
  137. class Importer;
  138. // Resources
  139. class Resource;
  140. class Resources;
  141. class Texture;
  142. class Mesh;
  143. class Font;
  144. // Scene
  145. class SceneObject;
  146. class Component;
  147. class SceneManager;
  148. // RTTI
  149. class MeshRTTI;
  150. // Desc structs
  151. struct SAMPLER_STATE_DESC;
  152. struct DEPTH_STENCIL_STATE_DESC;
  153. struct RASTERIZER_STATE_DESC;
  154. struct BLEND_STATE_DESC;
  155. struct RENDER_TARGET_BLEND_STATE_DESC;
  156. struct RENDER_TEXTURE_DESC;
  157. struct RENDER_WINDOW_DESC;
  158. struct FONT_DESC;
  159. }
  160. /************************************************************************/
  161. /* Shared pointer typedefs */
  162. /************************************************************************/
  163. namespace CamelotFramework
  164. {
  165. typedef std::shared_ptr<GpuProgram> GpuProgramPtr;
  166. typedef std::shared_ptr<HighLevelGpuProgram> HighLevelGpuProgramPtr;
  167. typedef std::shared_ptr<PixelBuffer> PixelBufferPtr;
  168. typedef std::shared_ptr<VertexBuffer> VertexBufferPtr;
  169. typedef std::shared_ptr<IndexBuffer> IndexBufferPtr;
  170. typedef std::shared_ptr<GpuBuffer> GpuBufferPtr;
  171. typedef std::shared_ptr<VertexDeclaration> VertexDeclarationPtr;
  172. typedef std::shared_ptr<Mesh> MeshPtr;
  173. typedef std::shared_ptr<Texture> TexturePtr;
  174. typedef std::shared_ptr<Resource> ResourcePtr;
  175. typedef std::shared_ptr<Technique> TechniquePtr;
  176. typedef std::shared_ptr<Pass> PassPtr;
  177. typedef std::shared_ptr<Shader> ShaderPtr;
  178. typedef std::shared_ptr<Material> MaterialPtr;
  179. typedef std::shared_ptr<Renderer> RendererPtr;
  180. typedef std::shared_ptr<RendererFactory> RendererFactoryPtr;
  181. typedef std::shared_ptr<WorkQueue> WorkQueuePtr;
  182. typedef std::shared_ptr<PassParameters> PassParametersPtr;
  183. typedef std::shared_ptr<Component> ComponentPtr;
  184. typedef std::shared_ptr<SceneObject> GameObjectPtr;
  185. typedef std::shared_ptr<SamplerState> SamplerStatePtr;
  186. typedef std::shared_ptr<DepthStencilState> DepthStencilStatePtr;
  187. typedef std::shared_ptr<RasterizerState> RasterizerStatePtr;
  188. typedef std::shared_ptr<BlendState> BlendStatePtr;
  189. typedef std::shared_ptr<RenderWindow> RenderWindowPtr;
  190. typedef std::shared_ptr<RenderTarget> RenderTargetPtr;
  191. typedef std::shared_ptr<RenderTexture> RenderTexturePtr;
  192. typedef std::shared_ptr<MultiRenderTexture> MultiRenderTexturePtr;
  193. typedef std::shared_ptr<GpuParamBlock> GpuParamBlockPtr;
  194. typedef std::shared_ptr<GpuParamBlockBuffer> GpuParamBlockBufferPtr;
  195. typedef std::shared_ptr<GpuParams> GpuParamsPtr;
  196. typedef std::shared_ptr<TextureView> TextureViewPtr;
  197. typedef std::shared_ptr<Viewport> ViewportPtr;
  198. typedef std::shared_ptr<GpuProgInclude> GpuProgIncludePtr;
  199. typedef std::shared_ptr<ImportOptions> ImportOptionsPtr;
  200. typedef std::shared_ptr<const ImportOptions> ConstImportOptionsPtr;
  201. typedef std::shared_ptr<Font> FontPtr;
  202. typedef std::shared_ptr<InputHandler> InputHandlerPtr;
  203. typedef std::shared_ptr<GpuResource> GpuResourcePtr;
  204. }
  205. /************************************************************************/
  206. /* RTTI */
  207. /************************************************************************/
  208. namespace CamelotFramework
  209. {
  210. enum TypeID_Core
  211. {
  212. TID_Texture = 1001,
  213. TID_Mesh = 1002,
  214. TID_MeshData = 1003,
  215. TID_VertexDeclaration = 1004,
  216. TID_VertexElementData = 1005,
  217. TID_Component = 1006,
  218. TID_ResourceHandle = 1009,
  219. TID_GpuProgram = 1010,
  220. TID_ResourceHandleData = 1011,
  221. TID_CgProgram = 1012,
  222. TID_ResourceMetaData = 1013,
  223. TID_Pass = 1014,
  224. TID_Technique = 1015,
  225. TID_Shader = 1016,
  226. TID_Material = 1017,
  227. TID_MaterialParams = 1018,
  228. TID_FloatParamKVP = 1019,
  229. TID_MaterialTexParamKVP = 1020,
  230. TID_SamplerState = 1021,
  231. TID_SamplerStateParamKVP = 1022,
  232. TID_BlendState = 1023,
  233. TID_RasterizerState = 1024,
  234. TID_DepthStencilState = 1025,
  235. TID_MaterialParamFloat = 1026,
  236. TID_MaterialParamVec2 = 1027,
  237. TID_MaterialParamVec3 = 1028,
  238. TID_MaterialParamVec4 = 1029,
  239. TID_MaterialParamMat3 = 1030,
  240. TID_MaterialParamMat4 = 1031,
  241. TID_MaterialParamTexture = 1032,
  242. TID_MaterialParamSamplerState = 1033,
  243. TID_BLEND_STATE_DESC = 1034,
  244. TID_SHADER_DATA_PARAM_DESC = 1035,
  245. TID_SHADER_OBJECT_PARAM_DESC = 1036,
  246. TID_SHADER_PARAM_BLOCK_DESC = 1047,
  247. TID_ImportOptions = 1048,
  248. TID_GpuProgramImportOptions = 1049,
  249. TID_MaterialParamStruct = 1050,
  250. TID_Font = 1051,
  251. TID_FONT_DESC = 1052,
  252. TID_CHAR_DESC = 1053,
  253. TID_STDVECTOR = 1054,
  254. TID_STDMAP = 1055,
  255. TID_FontImportOptions = 1056,
  256. TID_FontData = 1057,
  257. TID_SceneObject = 1059,
  258. TID_GameObject = 1060,
  259. TID_GpuResource = 1061,
  260. TID_PixelData = 1062,
  261. TID_GpuResourceData = 1063
  262. };
  263. }
  264. /************************************************************************/
  265. /* Resource references */
  266. /************************************************************************/
  267. #include "CmResourceHandle.h"
  268. namespace CamelotFramework
  269. {
  270. // Resource handles
  271. typedef ResourceHandle<Resource> HResource;
  272. typedef ResourceHandle<Texture> HTexture;
  273. typedef ResourceHandle<Mesh> HMesh;
  274. typedef ResourceHandle<GpuProgram> HGpuProgram;
  275. typedef ResourceHandle<HighLevelGpuProgram> HHighLevelGpuProgram;
  276. typedef ResourceHandle<Material> HMaterial;
  277. typedef ResourceHandle<SamplerState> HSamplerState;
  278. typedef ResourceHandle<RasterizerState> HRasterizerState;
  279. typedef ResourceHandle<DepthStencilState> HDepthStencilState;
  280. typedef ResourceHandle<BlendState> HBlendState;
  281. typedef ResourceHandle<GpuProgInclude> HGpuProgInclude;
  282. typedef ResourceHandle<Font> HFont;
  283. }
  284. #endif