GraphicsDefs.h 7.9 KB

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