GraphicsDefs.h 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324
  1. //
  2. // Copyright (c) 2008-2013 the Urho3D project.
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files (the "Software"), to deal
  6. // in the Software without restriction, including without limitation the rights
  7. // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8. // copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions:
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  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. #pragma once
  23. #include "HashBase.h"
  24. #include "StringHash.h"
  25. namespace Urho3D
  26. {
  27. class Vector3;
  28. /// Primitive type.
  29. enum PrimitiveType
  30. {
  31. TRIANGLE_LIST = 0,
  32. LINE_LIST
  33. };
  34. /// %Geometry type.
  35. enum GeometryType
  36. {
  37. GEOM_STATIC = 0,
  38. GEOM_SKINNED = 1,
  39. GEOM_INSTANCED = 2,
  40. GEOM_BILLBOARD = 3,
  41. GEOM_STATIC_NOINSTANCING = 4,
  42. MAX_GEOMETRYTYPES = 4,
  43. };
  44. /// Blending mode.
  45. enum BlendMode
  46. {
  47. BLEND_REPLACE = 0,
  48. BLEND_ADD,
  49. BLEND_MULTIPLY,
  50. BLEND_ALPHA,
  51. BLEND_ADDALPHA,
  52. BLEND_PREMULALPHA,
  53. BLEND_INVDESTALPHA,
  54. MAX_BLENDMODES
  55. };
  56. /// Depth or stencil compare mode.
  57. enum CompareMode
  58. {
  59. CMP_ALWAYS = 0,
  60. CMP_EQUAL,
  61. CMP_NOTEQUAL,
  62. CMP_LESS,
  63. CMP_LESSEQUAL,
  64. CMP_GREATER,
  65. CMP_GREATEREQUAL,
  66. MAX_COMPAREMODES
  67. };
  68. /// Culling mode.
  69. enum CullMode
  70. {
  71. CULL_NONE = 0,
  72. CULL_CCW,
  73. CULL_CW,
  74. MAX_CULLMODES
  75. };
  76. /// Fill mode.
  77. enum FillMode
  78. {
  79. FILL_SOLID = 0,
  80. FILL_WIREFRAME,
  81. FILL_POINT
  82. };
  83. /// Stencil operation.
  84. enum StencilOp
  85. {
  86. OP_KEEP = 0,
  87. OP_ZERO,
  88. OP_REF,
  89. OP_INCR,
  90. OP_DECR
  91. };
  92. /// Vertex/index buffer lock state.
  93. enum LockState
  94. {
  95. LOCK_NONE = 0,
  96. LOCK_HARDWARE,
  97. LOCK_SHADOW,
  98. LOCK_SCRATCH
  99. };
  100. /// Vertex elements.
  101. enum VertexElement
  102. {
  103. ELEMENT_POSITION = 0,
  104. ELEMENT_NORMAL,
  105. ELEMENT_COLOR,
  106. ELEMENT_TEXCOORD1,
  107. ELEMENT_TEXCOORD2,
  108. ELEMENT_CUBETEXCOORD1,
  109. ELEMENT_CUBETEXCOORD2,
  110. ELEMENT_TANGENT,
  111. ELEMENT_BLENDWEIGHTS,
  112. ELEMENT_BLENDINDICES,
  113. ELEMENT_INSTANCEMATRIX1,
  114. ELEMENT_INSTANCEMATRIX2,
  115. ELEMENT_INSTANCEMATRIX3,
  116. MAX_VERTEX_ELEMENTS
  117. };
  118. /// Texture filtering mode.
  119. enum TextureFilterMode
  120. {
  121. FILTER_NEAREST = 0,
  122. FILTER_BILINEAR,
  123. FILTER_TRILINEAR,
  124. FILTER_ANISOTROPIC,
  125. FILTER_DEFAULT,
  126. MAX_FILTERMODES
  127. };
  128. /// Texture addressing mode.
  129. enum TextureAddressMode
  130. {
  131. ADDRESS_WRAP = 0,
  132. ADDRESS_MIRROR,
  133. ADDRESS_CLAMP,
  134. ADDRESS_BORDER,
  135. MAX_ADDRESSMODES
  136. };
  137. /// Texture coordinates.
  138. enum TextureCoordinate
  139. {
  140. COORD_U = 0,
  141. COORD_V,
  142. COORD_W,
  143. MAX_COORDS
  144. };
  145. /// Texture usage types.
  146. enum TextureUsage
  147. {
  148. TEXTURE_STATIC = 0,
  149. TEXTURE_DYNAMIC,
  150. TEXTURE_RENDERTARGET,
  151. TEXTURE_DEPTHSTENCIL
  152. };
  153. /// Cube map faces.
  154. enum CubeMapFace
  155. {
  156. FACE_POSITIVE_X = 0,
  157. FACE_NEGATIVE_X,
  158. FACE_POSITIVE_Y,
  159. FACE_NEGATIVE_Y,
  160. FACE_POSITIVE_Z,
  161. FACE_NEGATIVE_Z,
  162. MAX_CUBEMAP_FACES
  163. };
  164. /// Update mode for render surface viewports.
  165. enum RenderSurfaceUpdateMode
  166. {
  167. SURFACE_MANUALUPDATE = 0,
  168. SURFACE_UPDATEVISIBLE,
  169. SURFACE_UPDATEALWAYS
  170. };
  171. /// Shader types.
  172. enum ShaderType
  173. {
  174. VS = 0,
  175. PS,
  176. };
  177. // Inbuilt shader parameters.
  178. extern StringHash VSP_AMBIENTSTARTCOLOR;
  179. extern StringHash VSP_AMBIENTENDCOLOR;
  180. extern StringHash VSP_BILLBOARDROT;
  181. extern StringHash VSP_CAMERAPOS;
  182. extern StringHash VSP_CAMERAROT;
  183. extern StringHash VSP_DEPTHMODE;
  184. extern StringHash VSP_ELAPSEDTIME;
  185. extern StringHash VSP_FRUSTUMSIZE;
  186. extern StringHash VSP_GBUFFEROFFSETS;
  187. extern StringHash VSP_LIGHTDIR;
  188. extern StringHash VSP_LIGHTPOS;
  189. extern StringHash VSP_MODEL;
  190. extern StringHash VSP_VIEWPROJ;
  191. extern StringHash VSP_UOFFSET;
  192. extern StringHash VSP_VOFFSET;
  193. extern StringHash VSP_ZONE;
  194. extern StringHash VSP_LIGHTMATRICES;
  195. extern StringHash VSP_SKINMATRICES;
  196. extern StringHash VSP_VERTEXLIGHTS;
  197. extern StringHash PSP_AMBIENTCOLOR;
  198. extern StringHash PSP_ELAPSEDTIME;
  199. extern StringHash PSP_FOGCOLOR;
  200. extern StringHash PSP_FOGPARAMS;
  201. extern StringHash PSP_GBUFFERINVSIZE;
  202. extern StringHash PSP_LIGHTCOLOR;
  203. extern StringHash PSP_LIGHTDIR;
  204. extern StringHash PSP_LIGHTPOS;
  205. extern StringHash PSP_MATDIFFCOLOR;
  206. extern StringHash PSP_MATEMISSIVECOLOR;
  207. extern StringHash PSP_MATENVMAPCOLOR;
  208. extern StringHash PSP_MATSPECCOLOR;
  209. extern StringHash PSP_SHADOWCUBEADJUST;
  210. extern StringHash PSP_SHADOWDEPTHFADE;
  211. extern StringHash PSP_SHADOWINTENSITY;
  212. extern StringHash PSP_SHADOWMAPINVSIZE;
  213. extern StringHash PSP_SHADOWSPLITS;
  214. extern StringHash PSP_LIGHTMATRICES;
  215. // Inbuilt pass types
  216. extern StringHash PASS_BASE;
  217. extern StringHash PASS_LITBASE;
  218. extern StringHash PASS_LIGHT;
  219. extern StringHash PASS_ALPHA;
  220. extern StringHash PASS_LITALPHA;
  221. extern StringHash PASS_SHADOW;
  222. extern StringHash PASS_DEFERRED;
  223. extern StringHash PASS_PREPASS;
  224. extern StringHash PASS_MATERIAL;
  225. extern StringHash PASS_PREALPHA;
  226. extern StringHash PASS_POSTALPHA;
  227. // Scale calculation from bounding box diagonal.
  228. extern Vector3 DOT_SCALE;
  229. /// Texture units.
  230. enum TextureUnit
  231. {
  232. TU_DIFFUSE = 0,
  233. TU_ALBEDOBUFFER = 0,
  234. TU_NORMAL = 1,
  235. TU_NORMALBUFFER = 1,
  236. TU_SPECULAR = 2,
  237. TU_EMISSIVE = 3,
  238. TU_ENVIRONMENT = 4,
  239. MAX_MATERIAL_TEXTURE_UNITS = 5,
  240. TU_LIGHTRAMP = 5,
  241. TU_LIGHTSHAPE = 6,
  242. TU_SHADOWMAP = 7,
  243. TU_FACESELECT = 8,
  244. TU_INDIRECTION = 9,
  245. TU_DEPTHBUFFER = 10,
  246. TU_LIGHTBUFFER = 11,
  247. MAX_TEXTURE_UNITS = 12
  248. };
  249. /// Shader parameter groups for determining need to update.
  250. enum ShaderParameterGroup
  251. {
  252. SP_FRAME = 0,
  253. SP_CAMERA,
  254. SP_VIEWPORT,
  255. SP_ZONE,
  256. SP_LIGHT,
  257. SP_VERTEXLIGHTS,
  258. SP_MATERIAL,
  259. SP_OBJECTTRANSFORM,
  260. MAX_SHADER_PARAMETER_GROUPS
  261. };
  262. static const int QUALITY_LOW = 0;
  263. static const int QUALITY_MEDIUM = 1;
  264. static const int QUALITY_HIGH = 2;
  265. static const int QUALITY_MAX = 15;
  266. static const int SHADOWQUALITY_LOW_16BIT = 0;
  267. static const int SHADOWQUALITY_LOW_24BIT = 1;
  268. static const int SHADOWQUALITY_HIGH_16BIT = 2;
  269. static const int SHADOWQUALITY_HIGH_24BIT = 3;
  270. static const unsigned CLEAR_COLOR = 0x1;
  271. static const unsigned CLEAR_DEPTH = 0x2;
  272. static const unsigned CLEAR_STENCIL = 0x4;
  273. static const unsigned MASK_NONE = 0x0;
  274. static const unsigned MASK_POSITION = 0x1;
  275. static const unsigned MASK_NORMAL = 0x2;
  276. static const unsigned MASK_COLOR = 0x4;
  277. static const unsigned MASK_TEXCOORD1 = 0x8;
  278. static const unsigned MASK_TEXCOORD2 = 0x10;
  279. static const unsigned MASK_CUBETEXCOORD1 = 0x20;
  280. static const unsigned MASK_CUBETEXCOORD2 = 0x40;
  281. static const unsigned MASK_TANGENT = 0x80;
  282. static const unsigned MASK_BLENDWEIGHTS = 0x100;
  283. static const unsigned MASK_BLENDINDICES = 0x200;
  284. static const unsigned MASK_INSTANCEMATRIX1 = 0x400;
  285. static const unsigned MASK_INSTANCEMATRIX2 = 0x800;
  286. static const unsigned MASK_INSTANCEMATRIX3 = 0x1000;
  287. static const unsigned MASK_DEFAULT = 0xffffffff;
  288. static const unsigned NO_ELEMENT = 0xffffffff;
  289. static const int MAX_RENDERTARGETS = 4;
  290. static const int MAX_VERTEX_STREAMS = 4;
  291. static const int MAX_SKIN_MATRICES = 64;
  292. static const int MAX_CONSTANT_REGISTERS = 256;
  293. }