GraphicsDefs.h 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  1. //
  2. // Urho3D Engine
  3. // Copyright (c) 2008-2011 Lasse Öörni
  4. //
  5. // Permission is hereby granted, free of charge, to any person obtaining a copy
  6. // of this software and associated documentation files (the "Software"), to deal
  7. // in the Software without restriction, including without limitation the rights
  8. // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  9. // copies of the Software, and to permit persons to whom the Software is
  10. // furnished to do so, subject to the following conditions:
  11. //
  12. // The above copyright notice and this permission notice shall be included in
  13. // all copies or substantial portions of the Software.
  14. //
  15. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20. // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  21. // THE SOFTWARE.
  22. //
  23. #pragma once
  24. #include "HashBase.h"
  25. #include "StringHash.h"
  26. /// Rendering mode
  27. enum RenderMode
  28. {
  29. RENDER_FORWARD = 0,
  30. RENDER_DEFERRED
  31. };
  32. /// Primitive type
  33. enum PrimitiveType
  34. {
  35. TRIANGLE_LIST = 0,
  36. LINE_LIST
  37. };
  38. /// Geometry type
  39. enum GeometryType
  40. {
  41. GEOM_STATIC = 0,
  42. GEOM_SKINNED,
  43. GEOM_INSTANCED,
  44. GEOM_BILLBOARD,
  45. MAX_GEOMETRYTYPES
  46. };
  47. /// Blending mode
  48. enum BlendMode
  49. {
  50. BLEND_REPLACE = 0,
  51. BLEND_ADD,
  52. BLEND_MULTIPLY,
  53. BLEND_ALPHA,
  54. BLEND_ADDALPHA,
  55. BLEND_PREMULALPHA,
  56. BLEND_INVDESTALPHA,
  57. MAX_BLENDMODES
  58. };
  59. /// Depth or stencil compare mode
  60. enum CompareMode
  61. {
  62. CMP_ALWAYS = 0,
  63. CMP_EQUAL,
  64. CMP_NOTEQUAL,
  65. CMP_LESS,
  66. CMP_LESSEQUAL,
  67. CMP_GREATER,
  68. CMP_GREATEREQUAL,
  69. MAX_COMPAREMODES
  70. };
  71. /// Culling mode
  72. enum CullMode
  73. {
  74. CULL_NONE = 0,
  75. CULL_CCW,
  76. CULL_CW,
  77. MAX_CULLMODES
  78. };
  79. /// Fill mode
  80. enum FillMode
  81. {
  82. FILL_SOLID = 0,
  83. FILL_WIREFRAME
  84. };
  85. /// Stencil operation
  86. enum StencilOp
  87. {
  88. OP_KEEP = 0,
  89. OP_ZERO,
  90. OP_REF,
  91. OP_INCR,
  92. OP_DECR
  93. };
  94. /// Buffer lock mode
  95. enum LockMode
  96. {
  97. LOCK_NORMAL,
  98. LOCK_DISCARD,
  99. LOCK_NOOVERWRITE,
  100. LOCK_READONLY
  101. };
  102. /// Vertex elements
  103. enum VertexElement
  104. {
  105. ELEMENT_POSITION = 0,
  106. ELEMENT_NORMAL,
  107. ELEMENT_COLOR,
  108. ELEMENT_TEXCOORD1,
  109. ELEMENT_TEXCOORD2,
  110. ELEMENT_CUBETEXCOORD1,
  111. ELEMENT_CUBETEXCOORD2,
  112. ELEMENT_TANGENT,
  113. ELEMENT_BLENDWEIGHTS,
  114. ELEMENT_BLENDINDICES,
  115. ELEMENT_INSTANCEMATRIX1,
  116. ELEMENT_INSTANCEMATRIX2,
  117. ELEMENT_INSTANCEMATRIX3,
  118. MAX_VERTEX_ELEMENTS
  119. };
  120. /// Texture filtering mode
  121. enum TextureFilterMode
  122. {
  123. FILTER_NEAREST = 0,
  124. FILTER_BILINEAR,
  125. FILTER_TRILINEAR,
  126. FILTER_ANISOTROPIC,
  127. FILTER_DEFAULT,
  128. MAX_FILTERMODES
  129. };
  130. /// Texture addressing mode
  131. enum TextureAddressMode
  132. {
  133. ADDRESS_WRAP = 0,
  134. ADDRESS_MIRROR,
  135. ADDRESS_CLAMP,
  136. ADDRESS_BORDER,
  137. MAX_ADDRESSMODES
  138. };
  139. /// Texture coordinates
  140. enum TextureCoordinate
  141. {
  142. COORD_U = 0,
  143. COORD_V,
  144. COORD_W,
  145. MAX_COORDS
  146. };
  147. /// Texture usage types
  148. enum TextureUsage
  149. {
  150. TEXTURE_STATIC = 0,
  151. TEXTURE_DYNAMIC,
  152. TEXTURE_RENDERTARGET,
  153. TEXTURE_DEPTHSTENCIL
  154. };
  155. /// Rendering passes
  156. enum PassType
  157. {
  158. PASS_GBUFFER,
  159. PASS_BASE,
  160. PASS_LITBASE,
  161. PASS_LIGHT,
  162. PASS_EXTRA,
  163. PASS_SHADOW,
  164. MAX_PASSES
  165. };
  166. /// Cube map faces
  167. enum CubeMapFace
  168. {
  169. FACE_POSITIVE_X = 0,
  170. FACE_NEGATIVE_X,
  171. FACE_POSITIVE_Y,
  172. FACE_NEGATIVE_Y,
  173. FACE_POSITIVE_Z,
  174. FACE_NEGATIVE_Z,
  175. MAX_CUBEMAP_FACES
  176. };
  177. /// Shader types
  178. enum ShaderType
  179. {
  180. VS = 0,
  181. PS,
  182. };
  183. // Inbuilt shader parameters
  184. extern StringHash VSP_CAMERAPOS;
  185. extern StringHash VSP_CAMERAROT;
  186. extern StringHash VSP_DEPTHMODE;
  187. extern StringHash VSP_ELAPSEDTIME;
  188. extern StringHash VSP_FRUSTUMSIZE;
  189. extern StringHash VSP_GBUFFEROFFSETS;
  190. extern StringHash VSP_MODEL;
  191. extern StringHash VSP_SHADOWPROJ;
  192. extern StringHash VSP_SPOTPROJ;
  193. extern StringHash VSP_VIEWPROJ;
  194. extern StringHash VSP_UOFFSET;
  195. extern StringHash VSP_VOFFSET;
  196. extern StringHash VSP_VIEWRIGHTVECTOR;
  197. extern StringHash VSP_VIEWUPVECTOR;
  198. extern StringHash VSP_SKINMATRICES;
  199. extern StringHash PSP_AMBIENTCOLOR;
  200. extern StringHash PSP_DEPTHRECONSTRUCT;
  201. extern StringHash PSP_EDGEFILTERPARAMS;
  202. extern StringHash PSP_ELAPSEDTIME;
  203. extern StringHash PSP_FOGCOLOR;
  204. extern StringHash PSP_FOGPARAMS;
  205. extern StringHash PSP_LIGHTATTEN;
  206. extern StringHash PSP_LIGHTCOLOR;
  207. extern StringHash PSP_LIGHTDIR;
  208. extern StringHash PSP_LIGHTPOS;
  209. extern StringHash PSP_LIGHTSPLITS;
  210. extern StringHash PSP_LIGHTVECROT;
  211. extern StringHash PSP_MATDIFFCOLOR;
  212. extern StringHash PSP_MATEMISSIVECOLOR;
  213. extern StringHash PSP_MATSPECPROPERTIES;
  214. extern StringHash PSP_SAMPLEOFFSETS;
  215. extern StringHash PSP_SHADOWINTENSITY;
  216. extern StringHash PSP_SHADOWPROJ;
  217. extern StringHash PSP_SPOTPROJ;
  218. /// Texture units
  219. enum TextureUnit
  220. {
  221. TU_DIFFUSE = 0,
  222. TU_NORMAL = 1,
  223. TU_SPECULAR = 2,
  224. TU_DETAIL = 3,
  225. TU_ENVIRONMENT = 4,
  226. TU_EMISSIVE = 5,
  227. MAX_MATERIAL_TEXTURE_UNITS = 6,
  228. TU_DIFFBUFFER = 0,
  229. TU_NORMALBUFFER = 1,
  230. TU_DEPTHBUFFER = 2,
  231. TU_SHADOWMAP = 5,
  232. TU_LIGHTRAMP = 6,
  233. TU_LIGHTSPOT = 7,
  234. MAX_TEXTURE_UNITS = 8
  235. };
  236. static const int QUALITY_LOW = 0;
  237. static const int QUALITY_MEDIUM = 1;
  238. static const int QUALITY_HIGH = 2;
  239. static const int QUALITY_MAX = 15;
  240. static const unsigned CLEAR_COLOR = 0x1;
  241. static const unsigned CLEAR_DEPTH = 0x2;
  242. static const unsigned CLEAR_STENCIL = 0x4;
  243. static const unsigned MASK_NONE = 0x0;
  244. static const unsigned MASK_POSITION = 0x1;
  245. static const unsigned MASK_NORMAL = 0x2;
  246. static const unsigned MASK_COLOR = 0x4;
  247. static const unsigned MASK_TEXCOORD1 = 0x8;
  248. static const unsigned MASK_TEXCOORD2 = 0x10;
  249. static const unsigned MASK_CUBETEXCOORD1 = 0x20;
  250. static const unsigned MASK_CUBETEXCOORD2 = 0x40;
  251. static const unsigned MASK_TANGENT = 0x80;
  252. static const unsigned MASK_BLENDWEIGHTS = 0x100;
  253. static const unsigned MASK_BLENDINDICES = 0x200;
  254. static const unsigned MASK_INSTANCEMATRIX1 = 0x400;
  255. static const unsigned MASK_INSTANCEMATRIX2 = 0x800;
  256. static const unsigned MASK_INSTANCEMATRIX3 = 0x1000;
  257. static const unsigned MASK_DEFAULT = 0xffffffff;
  258. static const unsigned NO_ELEMENT = 0xffffffff;
  259. static const float ANIMATION_LOD_BASESCALE = 2.5f;
  260. static const int MAX_RENDERTARGETS = 4;
  261. static const int MAX_VERTEX_STREAMS = 4;
  262. static const int MAX_SKIN_MATRICES = 64;
  263. static const int MAX_CONSTANT_REGISTERS = 256;
  264. static const int MAX_IMMEDIATE_ELEMENTS = 4;