EMaterialTypes.h 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. // Copyright (C) 2002-2012 Nikolaus Gebhardt
  2. // This file is part of the "Irrlicht Engine".
  3. // For conditions of distribution and use, see copyright notice in irrlicht.h
  4. #ifndef IRR_E_MATERIAL_TYPES_H_INCLUDED
  5. #define IRR_E_MATERIAL_TYPES_H_INCLUDED
  6. namespace irr
  7. {
  8. namespace video
  9. {
  10. //! Abstracted and easy to use fixed function/programmable pipeline material modes.
  11. enum E_MATERIAL_TYPE
  12. {
  13. //! Standard solid material.
  14. /** Only first texture is used, which is supposed to be the
  15. diffuse material. */
  16. EMT_SOLID = 0,
  17. //! Solid material with 2 texture layers.
  18. /** The second is blended onto the first using the alpha value
  19. of the vertex colors. This material is currently not implemented in OpenGL.
  20. */
  21. EMT_SOLID_2_LAYER,
  22. //! Material type with standard lightmap technique
  23. /** There should be 2 textures: The first texture layer is a
  24. diffuse map, the second is a light map. Dynamic light is
  25. ignored. */
  26. EMT_LIGHTMAP,
  27. //! Material type with lightmap technique like EMT_LIGHTMAP.
  28. /** But lightmap and diffuse texture are added instead of modulated. */
  29. EMT_LIGHTMAP_ADD,
  30. //! Material type with standard lightmap technique
  31. /** There should be 2 textures: The first texture layer is a
  32. diffuse map, the second is a light map. Dynamic light is
  33. ignored. The texture colors are effectively multiplied by 2
  34. for brightening. Like known in DirectX as D3DTOP_MODULATE2X. */
  35. EMT_LIGHTMAP_M2,
  36. //! Material type with standard lightmap technique
  37. /** There should be 2 textures: The first texture layer is a
  38. diffuse map, the second is a light map. Dynamic light is
  39. ignored. The texture colors are effectively multiplied by 4
  40. for brightening. Like known in DirectX as D3DTOP_MODULATE4X. */
  41. EMT_LIGHTMAP_M4,
  42. //! Like EMT_LIGHTMAP, but also supports dynamic lighting.
  43. EMT_LIGHTMAP_LIGHTING,
  44. //! Like EMT_LIGHTMAP_M2, but also supports dynamic lighting.
  45. EMT_LIGHTMAP_LIGHTING_M2,
  46. //! Like EMT_LIGHTMAP_M4, but also supports dynamic lighting.
  47. EMT_LIGHTMAP_LIGHTING_M4,
  48. //! Detail mapped material.
  49. /** The first texture is diffuse color map, the second is added
  50. to this and usually displayed with a bigger scale value so that
  51. it adds more detail. The detail map is added to the diffuse map
  52. using ADD_SIGNED, so that it is possible to add and subtract
  53. color from the diffuse map. For example a value of
  54. (127,127,127) will not change the appearance of the diffuse map
  55. at all. Often used for terrain rendering. */
  56. EMT_DETAIL_MAP,
  57. //! Look like a reflection of the environment around it.
  58. /** To make this possible, a texture called 'sphere map' is
  59. used, which must be set as the first texture. */
  60. EMT_SPHERE_MAP,
  61. //! A reflecting material with an optional non reflecting texture layer.
  62. /** The reflection map should be set as second texture. */
  63. EMT_REFLECTION_2_LAYER,
  64. //! A transparent material.
  65. /** Only the first texture is used. The new color is calculated
  66. by simply adding the source color and the dest color. This
  67. means if for example a billboard using a texture with black
  68. background and a red circle on it is drawn with this material,
  69. the result is that only the red circle will be drawn a little
  70. bit transparent, and everything which was black is 100%
  71. transparent and not visible. This material type is useful for
  72. particle effects. */
  73. EMT_TRANSPARENT_ADD_COLOR,
  74. //! Makes the material transparent based on the texture alpha channel.
  75. /** The final color is blended together from the destination
  76. color and the texture color, using the alpha channel value as
  77. blend factor. Only first texture is used. If you are using
  78. this material with small textures, it is a good idea to load
  79. the texture in 32 bit mode
  80. (video::IVideoDriver::setTextureCreationFlag()). Also, an alpha
  81. ref is used, which can be manipulated using
  82. SMaterial::MaterialTypeParam. This value controls how sharp the
  83. edges become when going from a transparent to a solid spot on
  84. the texture. */
  85. EMT_TRANSPARENT_ALPHA_CHANNEL,
  86. //! Makes the material transparent based on the texture alpha channel.
  87. /** If the alpha channel value is greater than 127, a
  88. pixel is written to the target, otherwise not. This
  89. material does not use alpha blending and is a lot faster
  90. than EMT_TRANSPARENT_ALPHA_CHANNEL. It is ideal for drawing
  91. stuff like leaves of plants, because the borders are not
  92. blurry but sharp. Only first texture is used. If you are
  93. using this material with small textures and 3d object, it
  94. is a good idea to load the texture in 32 bit mode
  95. (video::IVideoDriver::setTextureCreationFlag()). */
  96. EMT_TRANSPARENT_ALPHA_CHANNEL_REF,
  97. //! Makes the material transparent based on the vertex alpha value.
  98. EMT_TRANSPARENT_VERTEX_ALPHA,
  99. //! A transparent reflecting material with an optional additional non reflecting texture layer.
  100. /** The reflection map should be set as first texture. The
  101. transparency depends on the alpha value in the vertex colors. A
  102. texture which will not reflect can be set as second texture.*/
  103. EMT_TRANSPARENT_REFLECTION_2_LAYER,
  104. //! A solid normal map renderer.
  105. /** First texture is the color map, the second should be the
  106. normal map. Note that you should use this material only when
  107. drawing geometry consisting of vertices of type
  108. S3DVertexTangents (EVT_TANGENTS). You can convert any mesh into
  109. this format using IMeshManipulator::createMeshWithTangents()
  110. (See SpecialFX2 Tutorial). This shader runs on vertex shader
  111. 1.1 and pixel shader 1.1 capable hardware and falls back to a
  112. fixed function lighted material if this hardware is not
  113. available. Only two lights are supported by this shader, if
  114. there are more, the nearest two are chosen. */
  115. EMT_NORMAL_MAP_SOLID,
  116. //! A transparent normal map renderer.
  117. /** First texture is the color map, the second should be the
  118. normal map. Note that you should use this material only when
  119. drawing geometry consisting of vertices of type
  120. S3DVertexTangents (EVT_TANGENTS). You can convert any mesh into
  121. this format using IMeshManipulator::createMeshWithTangents()
  122. (See SpecialFX2 Tutorial). This shader runs on vertex shader
  123. 1.1 and pixel shader 1.1 capable hardware and falls back to a
  124. fixed function lighted material if this hardware is not
  125. available. Only two lights are supported by this shader, if
  126. there are more, the nearest two are chosen. */
  127. EMT_NORMAL_MAP_TRANSPARENT_ADD_COLOR,
  128. //! A transparent (based on the vertex alpha value) normal map renderer.
  129. /** First texture is the color map, the second should be the
  130. normal map. Note that you should use this material only when
  131. drawing geometry consisting of vertices of type
  132. S3DVertexTangents (EVT_TANGENTS). You can convert any mesh into
  133. this format using IMeshManipulator::createMeshWithTangents()
  134. (See SpecialFX2 Tutorial). This shader runs on vertex shader
  135. 1.1 and pixel shader 1.1 capable hardware and falls back to a
  136. fixed function lighted material if this hardware is not
  137. available. Only two lights are supported by this shader, if
  138. there are more, the nearest two are chosen. */
  139. EMT_NORMAL_MAP_TRANSPARENT_VERTEX_ALPHA,
  140. //! Just like EMT_NORMAL_MAP_SOLID, but uses parallax mapping.
  141. /** Looks a lot more realistic. This only works when the
  142. hardware supports at least vertex shader 1.1 and pixel shader
  143. 1.4. First texture is the color map, the second should be the
  144. normal map. The normal map texture should contain the height
  145. value in the alpha component. The
  146. IVideoDriver::makeNormalMapTexture() method writes this value
  147. automatically when creating normal maps from a heightmap when
  148. using a 32 bit texture. The height scale of the material
  149. (affecting the bumpiness) is being controlled by the
  150. SMaterial::MaterialTypeParam member. If set to zero, the
  151. default value (0.02f) will be applied. Otherwise the value set
  152. in SMaterial::MaterialTypeParam is taken. This value depends on
  153. with which scale the texture is mapped on the material. Too
  154. high or low values of MaterialTypeParam can result in strange
  155. artifacts. */
  156. EMT_PARALLAX_MAP_SOLID,
  157. //! A material like EMT_PARALLAX_MAP_SOLID, but transparent.
  158. /** Using EMT_TRANSPARENT_ADD_COLOR as base material. */
  159. EMT_PARALLAX_MAP_TRANSPARENT_ADD_COLOR,
  160. //! A material like EMT_PARALLAX_MAP_SOLID, but transparent.
  161. /** Using EMT_TRANSPARENT_VERTEX_ALPHA as base material. */
  162. EMT_PARALLAX_MAP_TRANSPARENT_VERTEX_ALPHA,
  163. //! BlendFunc = source * sourceFactor + dest * destFactor ( E_BLEND_FUNC )
  164. /** Using only first texture. Generic blending method.
  165. The blend function is set to SMaterial::MaterialTypeParam with
  166. pack_textureBlendFunc (for 2D) or pack_textureBlendFuncSeparate (for 3D). */
  167. EMT_ONETEXTURE_BLEND,
  168. //! This value is not used. It only forces this enumeration to compile to 32 bit.
  169. EMT_FORCE_32BIT = 0x7fffffff
  170. };
  171. //! Array holding the built in material type names
  172. const char* const sBuiltInMaterialTypeNames[] =
  173. {
  174. "solid",
  175. "solid_2layer",
  176. "lightmap",
  177. "lightmap_add",
  178. "lightmap_m2",
  179. "lightmap_m4",
  180. "lightmap_light",
  181. "lightmap_light_m2",
  182. "lightmap_light_m4",
  183. "detail_map",
  184. "sphere_map",
  185. "reflection_2layer",
  186. "trans_add",
  187. "trans_alphach",
  188. "trans_alphach_ref",
  189. "trans_vertex_alpha",
  190. "trans_reflection_2layer",
  191. "normalmap_solid",
  192. "normalmap_trans_add",
  193. "normalmap_trans_vertexalpha",
  194. "parallaxmap_solid",
  195. "parallaxmap_trans_add",
  196. "parallaxmap_trans_vertexalpha",
  197. "onetexture_blend",
  198. 0
  199. };
  200. } // end namespace video
  201. } // end namespace irr
  202. #endif // IRR_E_MATERIAL_TYPES_H_INCLUDED