CmCommonEnums.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354
  1. /*
  2. -----------------------------------------------------------------------------
  3. This source file is part of OGRE
  4. (Object-oriented Graphics Rendering Engine)
  5. For the latest info, see http://www.ogre3d.org/
  6. Copyright (c) 2000-2011 Torus Knot Software Ltd
  7. Permission is hereby granted, free of charge, to any person obtaining a copy
  8. of this software and associated documentation files (the "Software"), to deal
  9. in the Software without restriction, including without limitation the rights
  10. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  11. copies of the Software, and to permit persons to whom the Software is
  12. furnished to do so, subject to the following conditions:
  13. The above copyright notice and this permission notice shall be included in
  14. all copies or substantial portions of the Software.
  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. */
  24. #ifndef __Common_H__
  25. #define __Common_H__
  26. // Common stuff
  27. #include "CmString.h"
  28. #if defined ( CM_GCC_VISIBILITY )
  29. # pragma GCC visibility push(default)
  30. #endif
  31. #include <utility>
  32. #include <sstream>
  33. #if defined ( CM_GCC_VISIBILITY )
  34. # pragma GCC visibility pop
  35. #endif
  36. namespace CamelotFramework {
  37. /** \addtogroup Core
  38. * @{
  39. */
  40. /** \addtogroup General
  41. * @{
  42. */
  43. /** Blending factors for manually blending objects with the scene. If there isn't a predefined
  44. SceneBlendType that you like, then you can specify the blending factors directly to affect the
  45. combination of object and the existing scene. See Material::setSceneBlending for more details.
  46. */
  47. enum BlendFactor
  48. {
  49. BF_ONE,
  50. BF_ZERO,
  51. BF_DEST_COLOR,
  52. BF_SOURCE_COLOR,
  53. BF_INV_DEST_COLOR,
  54. BF_INV_SOURCE_COLOR,
  55. BF_DEST_ALPHA,
  56. BF_SOURCE_ALPHA,
  57. BF_INV_DEST_ALPHA,
  58. BF_INV_SOURCE_ALPHA
  59. };
  60. /** Blending operations controls how objects are blended into the scene. The default operation
  61. is add (+) but by changing this you can change how drawn objects are blended into the
  62. existing scene.
  63. */
  64. enum BlendOperation
  65. {
  66. BO_ADD,
  67. BO_SUBTRACT,
  68. BO_REVERSE_SUBTRACT,
  69. BO_MIN,
  70. BO_MAX
  71. };
  72. /** Comparison functions used for the depth/stencil buffer operations and
  73. others. */
  74. enum CompareFunction
  75. {
  76. CMPF_ALWAYS_FAIL,
  77. CMPF_ALWAYS_PASS,
  78. CMPF_LESS,
  79. CMPF_LESS_EQUAL,
  80. CMPF_EQUAL,
  81. CMPF_NOT_EQUAL,
  82. CMPF_GREATER_EQUAL,
  83. CMPF_GREATER
  84. };
  85. /** Texture addressing modes - default is TAM_WRAP.
  86. @note
  87. These settings are relevant in both the fixed-function and the
  88. programmable pipeline.
  89. */
  90. enum TextureAddressingMode
  91. {
  92. /// Texture wraps at values over 1.0
  93. TAM_WRAP,
  94. /// Texture mirrors (flips) at joins over 1.0
  95. TAM_MIRROR,
  96. /// Texture clamps at 1.0
  97. TAM_CLAMP,
  98. /// Texture coordinates outside the range [0.0, 1.0] are set to the border colour
  99. TAM_BORDER
  100. };
  101. /** High-level filtering options providing shortcuts to settings the
  102. minification, magnification and mip filters. */
  103. enum TextureFilterOptions
  104. {
  105. /// Equal to: min=FO_POINT, mag=FO_POINT, mip=FO_NONE
  106. TFO_NONE,
  107. /// Equal to: min=FO_LINEAR, mag=FO_LINEAR, mip=FO_POINT
  108. TFO_BILINEAR,
  109. /// Equal to: min=FO_LINEAR, mag=FO_LINEAR, mip=FO_LINEAR
  110. TFO_TRILINEAR,
  111. /// Equal to: min=FO_ANISOTROPIC, max=FO_ANISOTROPIC, mip=FO_LINEAR
  112. TFO_ANISOTROPIC
  113. };
  114. enum FilterType
  115. {
  116. /// The filter used when shrinking a texture
  117. FT_MIN,
  118. /// The filter used when magnifying a texture
  119. FT_MAG,
  120. /// The filter used when determining the mipmap
  121. FT_MIP
  122. };
  123. /** Filtering options for textures / mipmaps. */
  124. enum FilterOptions
  125. {
  126. /// No filtering, used for FILT_MIP to turn off mipmapping
  127. FO_NONE = 0,
  128. /// Use the closest pixel
  129. FO_POINT = 1,
  130. /// Average of a 2x2 pixel area, denotes bilinear for MIN and MAG, trilinear for MIP
  131. FO_LINEAR = 2,
  132. /// Similar to FO_LINEAR, but compensates for the angle of the texture plane
  133. FO_ANISOTROPIC = 3,
  134. /// Specifies that the sampled values will be compared against existing sampled data.
  135. /// Should be OR-ed with other filtering options.
  136. FO_USE_COMPARISON = 4
  137. };
  138. /** Hardware culling modes based on vertex winding.
  139. This setting applies to how the hardware API culls triangles it is sent. */
  140. enum CullingMode
  141. {
  142. /// Hardware never culls triangles and renders everything it receives.
  143. CULL_NONE = 1,
  144. /// Hardware culls triangles whose vertices are listed clockwise in the view (default).
  145. CULL_CLOCKWISE = 2,
  146. /// Hardware culls triangles whose vertices are listed anticlockwise in the view.
  147. CULL_COUNTERCLOCKWISE = 3
  148. };
  149. /** The polygon mode to use when rasterising. */
  150. enum PolygonMode
  151. {
  152. /// Wireframe models are rendered.
  153. PM_WIREFRAME = 1,
  154. /// Solid polygons are rendered.
  155. PM_SOLID = 2
  156. };
  157. /** Defines the frame buffer types. */
  158. enum FrameBufferType {
  159. FBT_COLOR = 0x1,
  160. FBT_DEPTH = 0x2,
  161. FBT_STENCIL = 0x4
  162. };
  163. /// Enum describing the various actions which can be taken onthe stencil buffer
  164. enum StencilOperation
  165. {
  166. /// Leave the stencil buffer unchanged
  167. SOP_KEEP,
  168. /// Set the stencil value to zero
  169. SOP_ZERO,
  170. /// Set the stencil value to the reference value
  171. SOP_REPLACE,
  172. /// Increase the stencil value by 1, clamping at the maximum value
  173. SOP_INCREMENT,
  174. /// Decrease the stencil value by 1, clamping at 0
  175. SOP_DECREMENT,
  176. /// Increase the stencil value by 1, wrapping back to 0 when incrementing the maximum value
  177. SOP_INCREMENT_WRAP,
  178. /// Decrease the stencil value by 1, wrapping when decrementing 0
  179. SOP_DECREMENT_WRAP,
  180. /// Invert the bits of the stencil buffer
  181. SOP_INVERT
  182. };
  183. /// Locking options
  184. enum GpuLockOptions
  185. {
  186. /** Normal mode, ie allows read/write and contents are preserved. */
  187. GBL_READ_WRITE,
  188. /** Discards the <em>entire</em> buffer while locking; this allows optimisation to be
  189. performed because synchronisation issues are relaxed.
  190. */
  191. GBL_WRITE_ONLY_DISCARD,
  192. /** Lock the buffer for reading only. Not allowed in buffers which are created with HBU_WRITE_ONLY.
  193. */
  194. GBL_READ_ONLY,
  195. /** As HBL_NORMAL, except the application guarantees not to overwrite any
  196. region of the buffer which has already been used in this frame, can allow
  197. some optimisation on some APIs. */
  198. GBL_WRITE_ONLY_NO_OVERWRITE,
  199. /** Lock for writing only */
  200. GBL_WRITE_ONLY
  201. };
  202. /// Enums describing buffer usage; not mutually exclusive
  203. enum GpuBufferUsage
  204. {
  205. /** Static buffer which the application rarely modifies once created. Modifying
  206. the contents of this buffer will involve a performance hit.
  207. */
  208. GBU_STATIC = 1,
  209. /** Indicates the application would like to modify this buffer with the CPU
  210. fairly often.
  211. */
  212. GBU_DYNAMIC = 2
  213. };
  214. /**
  215. * @brief Types of generic GPU buffers that may be attached to GPU programs.
  216. */
  217. enum GpuBufferType
  218. {
  219. GBT_STRUCTURED,
  220. GBT_RAW,
  221. GBT_INDIRECTARGUMENT,
  222. GBT_APPENDCONSUME
  223. };
  224. /**
  225. * @brief Different types of gpu views
  226. */
  227. enum GpuViewUsage
  228. {
  229. GVU_DEFAULT = 0x01,
  230. GVU_RENDERTARGET = 0x02,
  231. GVU_DEPTHSTENCIL = 0x04,
  232. GVU_RANDOMWRITE = 0x08
  233. };
  234. enum GpuParamBlockUsage
  235. {
  236. GPBU_STATIC,
  237. GPBU_DYNAMIC
  238. };
  239. enum GpuParamType
  240. {
  241. GPT_DATA,
  242. GPT_OBJECT
  243. };
  244. enum GpuParamDataType
  245. {
  246. GPDT_FLOAT1 = 1,
  247. GPDT_FLOAT2 = 2,
  248. GPDT_FLOAT3 = 3,
  249. GPDT_FLOAT4 = 4,
  250. GPDT_MATRIX_2X2 = 11,
  251. GPDT_MATRIX_2X3 = 12,
  252. GPDT_MATRIX_2X4 = 13,
  253. GPDT_MATRIX_3X2 = 14,
  254. GPDT_MATRIX_3X3 = 15,
  255. GPDT_MATRIX_3X4 = 16,
  256. GPDT_MATRIX_4X2 = 17,
  257. GPDT_MATRIX_4X3 = 18,
  258. GPDT_MATRIX_4X4 = 19,
  259. GPDT_INT1 = 20,
  260. GPDT_INT2 = 21,
  261. GPDT_INT3 = 22,
  262. GPDT_INT4 = 23,
  263. GPDT_BOOL = 24,
  264. GPDT_STRUCT = 25,
  265. GPDT_UNKNOWN = 0xffff
  266. };
  267. enum GpuParamObjectType
  268. {
  269. GPOT_SAMPLER1D = 1,
  270. GPOT_SAMPLER2D = 2,
  271. GPOT_SAMPLER3D = 3,
  272. GPOT_SAMPLERCUBE = 4,
  273. GPOT_TEXTURE1D = 11,
  274. GPOT_TEXTURE2D = 12,
  275. GPOT_TEXTURE3D = 13,
  276. GPOT_TEXTURECUBE = 14,
  277. GPOT_RWTEXTURE1D = 21,
  278. GPOT_RWTEXTURE2D = 22,
  279. GPOT_RWTEXTURE3D = 23,
  280. GPOT_BYTE_BUFFER = 32,
  281. GPOT_STRUCTURED_BUFFER = 33,
  282. GPOT_RWTYPED_BUFFER = 41,
  283. GPOT_RWBYTE_BUFFER = 42,
  284. GPOT_RWSTRUCTURED_BUFFER = 43,
  285. GPOT_RWSTRUCTURED_BUFFER_WITH_COUNTER = 44,
  286. GPOT_RWAPPEND_BUFFER = 45,
  287. GPOT_RWCONSUME_BUFFER = 46,
  288. GPOT_UNKNOWN = 0xffff
  289. };
  290. /**
  291. * @brief These values represent a hint to the driver when writing
  292. * to a GPU buffer.
  293. *
  294. * Normal - Default flag with least restrictions. Can cause a CPU-GPU sync point
  295. * so avoid using it often (i.e. every frame) as that might limit your performance significantly.
  296. * Discard - Tells the driver to completely discard the contents of the buffer you are writing
  297. * to. The driver will (most likely) internally allocate another buffer with same specifications (which is fairly fast)
  298. * and you will avoid CPU-GPU stalls.
  299. * NoOverwrite - Guarantees the driver that you will not be updating any part of the buffer that is currently used.
  300. * This will also avoid CPU-GPU stalls, without requiring you to discard the entire buffer. However it is hard to
  301. * guarantee when GPU has finished using a buffer.
  302. */
  303. enum class BufferWriteType
  304. {
  305. Normal,
  306. Discard,
  307. NoOverwrite
  308. };
  309. /** Texture addressing mode for each texture coordinate. */
  310. struct UVWAddressingMode
  311. {
  312. UVWAddressingMode()
  313. :u(TAM_WRAP), v(TAM_WRAP), w(TAM_WRAP)
  314. { }
  315. TextureAddressingMode u, v, w;
  316. };
  317. /// Name / value parameter pair (first = name, second = value)
  318. typedef Map<String, String>::type NameValuePairList;
  319. /** @} */
  320. }
  321. #endif