GraphicsDefs.h 7.6 KB

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