CmCommon.h 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  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 CamelotEngine {
  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 SceneBlendFactor
  48. {
  49. SBF_ONE,
  50. SBF_ZERO,
  51. SBF_DEST_COLOUR,
  52. SBF_SOURCE_COLOUR,
  53. SBF_ONE_MINUS_DEST_COLOUR,
  54. SBF_ONE_MINUS_SOURCE_COLOUR,
  55. SBF_DEST_ALPHA,
  56. SBF_SOURCE_ALPHA,
  57. SBF_ONE_MINUS_DEST_ALPHA,
  58. SBF_ONE_MINUS_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 SceneBlendOperation
  65. {
  66. SBO_ADD,
  67. SBO_SUBTRACT,
  68. SBO_REVERSE_SUBTRACT,
  69. SBO_MIN,
  70. SBO_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. /** High-level filtering options providing shortcuts to settings the
  86. minification, magnification and mip filters. */
  87. enum TextureFilterOptions
  88. {
  89. /// Equal to: min=FO_POINT, mag=FO_POINT, mip=FO_NONE
  90. TFO_NONE,
  91. /// Equal to: min=FO_LINEAR, mag=FO_LINEAR, mip=FO_POINT
  92. TFO_BILINEAR,
  93. /// Equal to: min=FO_LINEAR, mag=FO_LINEAR, mip=FO_LINEAR
  94. TFO_TRILINEAR,
  95. /// Equal to: min=FO_ANISOTROPIC, max=FO_ANISOTROPIC, mip=FO_LINEAR
  96. TFO_ANISOTROPIC
  97. };
  98. enum FilterType
  99. {
  100. /// The filter used when shrinking a texture
  101. FT_MIN,
  102. /// The filter used when magnifying a texture
  103. FT_MAG,
  104. /// The filter used when determining the mipmap
  105. FT_MIP
  106. };
  107. /** Filtering options for textures / mipmaps. */
  108. enum FilterOptions
  109. {
  110. /// No filtering, used for FILT_MIP to turn off mipmapping
  111. FO_NONE,
  112. /// Use the closest pixel
  113. FO_POINT,
  114. /// Average of a 2x2 pixel area, denotes bilinear for MIN and MAG, trilinear for MIP
  115. FO_LINEAR,
  116. /// Similar to FO_LINEAR, but compensates for the angle of the texture plane
  117. FO_ANISOTROPIC
  118. };
  119. /** Light shading modes. */
  120. enum ShadeOptions
  121. {
  122. SO_FLAT,
  123. SO_GOURAUD,
  124. SO_PHONG
  125. };
  126. /** Fog modes. */
  127. enum FogMode
  128. {
  129. /// No fog. Duh.
  130. FOG_NONE,
  131. /// Fog density increases exponentially from the camera (fog = 1/e^(distance * density))
  132. FOG_EXP,
  133. /// Fog density increases at the square of FOG_EXP, i.e. even quicker (fog = 1/e^(distance * density)^2)
  134. FOG_EXP2,
  135. /// Fog density increases linearly between the start and end distances
  136. FOG_LINEAR
  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_ANTICLOCKWISE = 3
  148. };
  149. /** The polygon mode to use when rasterising. */
  150. enum PolygonMode
  151. {
  152. /// Only points are rendered.
  153. PM_POINTS = 1,
  154. /// Wireframe models are rendered.
  155. PM_WIREFRAME = 2,
  156. /// Solid polygons are rendered.
  157. PM_SOLID = 3
  158. };
  159. /** An enumeration describing which material properties should track the vertex colours */
  160. typedef int TrackVertexColourType;
  161. enum TrackVertexColourEnum {
  162. TVC_NONE = 0x0,
  163. TVC_AMBIENT = 0x1,
  164. TVC_DIFFUSE = 0x2,
  165. TVC_SPECULAR = 0x4,
  166. TVC_EMISSIVE = 0x8
  167. };
  168. /** Defines the frame buffer types. */
  169. enum FrameBufferType {
  170. FBT_COLOUR = 0x1,
  171. FBT_DEPTH = 0x2,
  172. FBT_STENCIL = 0x4
  173. };
  174. /// Name / value parameter pair (first = name, second = value)
  175. typedef map<String, String>::type NameValuePairList;
  176. /// Render window creation parameters.
  177. struct RenderWindowDescription
  178. {
  179. String name;
  180. unsigned int width;
  181. unsigned int height;
  182. bool useFullScreen;
  183. NameValuePairList miscParams;
  184. };
  185. /// Render window creation parameters container.
  186. typedef vector<RenderWindowDescription>::type RenderWindowDescriptionList;
  187. /// Render window container.
  188. typedef vector<RenderWindow*>::type RenderWindowList;
  189. /** @} */
  190. }
  191. #endif