aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/irrlicht-1.8/include/SMaterial.h
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/irrlicht-1.8/include/SMaterial.h')
-rw-r--r--libraries/irrlicht-1.8/include/SMaterial.h1370
1 files changed, 685 insertions, 685 deletions
diff --git a/libraries/irrlicht-1.8/include/SMaterial.h b/libraries/irrlicht-1.8/include/SMaterial.h
index 3172241..a1c3ff4 100644
--- a/libraries/irrlicht-1.8/include/SMaterial.h
+++ b/libraries/irrlicht-1.8/include/SMaterial.h
@@ -1,685 +1,685 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt 1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine". 2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h 3// For conditions of distribution and use, see copyright notice in irrlicht.h
4 4
5#ifndef __S_MATERIAL_H_INCLUDED__ 5#ifndef __S_MATERIAL_H_INCLUDED__
6#define __S_MATERIAL_H_INCLUDED__ 6#define __S_MATERIAL_H_INCLUDED__
7 7
8#include "SColor.h" 8#include "SColor.h"
9#include "matrix4.h" 9#include "matrix4.h"
10#include "irrArray.h" 10#include "irrArray.h"
11#include "irrMath.h" 11#include "irrMath.h"
12#include "EMaterialTypes.h" 12#include "EMaterialTypes.h"
13#include "EMaterialFlags.h" 13#include "EMaterialFlags.h"
14#include "SMaterialLayer.h" 14#include "SMaterialLayer.h"
15 15
16namespace irr 16namespace irr
17{ 17{
18namespace video 18namespace video
19{ 19{
20 class ITexture; 20 class ITexture;
21 21
22 //! Flag for EMT_ONETEXTURE_BLEND, ( BlendFactor ) BlendFunc = source * sourceFactor + dest * destFactor 22 //! Flag for EMT_ONETEXTURE_BLEND, ( BlendFactor ) BlendFunc = source * sourceFactor + dest * destFactor
23 enum E_BLEND_FACTOR 23 enum E_BLEND_FACTOR
24 { 24 {
25 EBF_ZERO = 0, //!< src & dest (0, 0, 0, 0) 25 EBF_ZERO = 0, //!< src & dest (0, 0, 0, 0)
26 EBF_ONE, //!< src & dest (1, 1, 1, 1) 26 EBF_ONE, //!< src & dest (1, 1, 1, 1)
27 EBF_DST_COLOR, //!< src (destR, destG, destB, destA) 27 EBF_DST_COLOR, //!< src (destR, destG, destB, destA)
28 EBF_ONE_MINUS_DST_COLOR, //!< src (1-destR, 1-destG, 1-destB, 1-destA) 28 EBF_ONE_MINUS_DST_COLOR, //!< src (1-destR, 1-destG, 1-destB, 1-destA)
29 EBF_SRC_COLOR, //!< dest (srcR, srcG, srcB, srcA) 29 EBF_SRC_COLOR, //!< dest (srcR, srcG, srcB, srcA)
30 EBF_ONE_MINUS_SRC_COLOR, //!< dest (1-srcR, 1-srcG, 1-srcB, 1-srcA) 30 EBF_ONE_MINUS_SRC_COLOR, //!< dest (1-srcR, 1-srcG, 1-srcB, 1-srcA)
31 EBF_SRC_ALPHA, //!< src & dest (srcA, srcA, srcA, srcA) 31 EBF_SRC_ALPHA, //!< src & dest (srcA, srcA, srcA, srcA)
32 EBF_ONE_MINUS_SRC_ALPHA, //!< src & dest (1-srcA, 1-srcA, 1-srcA, 1-srcA) 32 EBF_ONE_MINUS_SRC_ALPHA, //!< src & dest (1-srcA, 1-srcA, 1-srcA, 1-srcA)
33 EBF_DST_ALPHA, //!< src & dest (destA, destA, destA, destA) 33 EBF_DST_ALPHA, //!< src & dest (destA, destA, destA, destA)
34 EBF_ONE_MINUS_DST_ALPHA, //!< src & dest (1-destA, 1-destA, 1-destA, 1-destA) 34 EBF_ONE_MINUS_DST_ALPHA, //!< src & dest (1-destA, 1-destA, 1-destA, 1-destA)
35 EBF_SRC_ALPHA_SATURATE //!< src (min(srcA, 1-destA), idem, ...) 35 EBF_SRC_ALPHA_SATURATE //!< src (min(srcA, 1-destA), idem, ...)
36 }; 36 };
37 37
38 //! Values defining the blend operation used when blend is enabled 38 //! Values defining the blend operation used when blend is enabled
39 enum E_BLEND_OPERATION 39 enum E_BLEND_OPERATION
40 { 40 {
41 EBO_NONE = 0, //!< No blending happens 41 EBO_NONE = 0, //!< No blending happens
42 EBO_ADD, //!< Default blending adds the color values 42 EBO_ADD, //!< Default blending adds the color values
43 EBO_SUBTRACT, //!< This mode subtracts the color values 43 EBO_SUBTRACT, //!< This mode subtracts the color values
44 EBO_REVSUBTRACT,//!< This modes subtracts destination from source 44 EBO_REVSUBTRACT,//!< This modes subtracts destination from source
45 EBO_MIN, //!< Choose minimum value of each color channel 45 EBO_MIN, //!< Choose minimum value of each color channel
46 EBO_MAX, //!< Choose maximum value of each color channel 46 EBO_MAX, //!< Choose maximum value of each color channel
47 EBO_MIN_FACTOR, //!< Choose minimum value of each color channel after applying blend factors, not widely supported 47 EBO_MIN_FACTOR, //!< Choose minimum value of each color channel after applying blend factors, not widely supported
48 EBO_MAX_FACTOR, //!< Choose maximum value of each color channel after applying blend factors, not widely supported 48 EBO_MAX_FACTOR, //!< Choose maximum value of each color channel after applying blend factors, not widely supported
49 EBO_MIN_ALPHA, //!< Choose minimum value of each color channel based on alpha value, not widely supported 49 EBO_MIN_ALPHA, //!< Choose minimum value of each color channel based on alpha value, not widely supported
50 EBO_MAX_ALPHA //!< Choose maximum value of each color channel based on alpha value, not widely supported 50 EBO_MAX_ALPHA //!< Choose maximum value of each color channel based on alpha value, not widely supported
51 }; 51 };
52 52
53 //! MaterialTypeParam: e.g. DirectX: D3DTOP_MODULATE, D3DTOP_MODULATE2X, D3DTOP_MODULATE4X 53 //! MaterialTypeParam: e.g. DirectX: D3DTOP_MODULATE, D3DTOP_MODULATE2X, D3DTOP_MODULATE4X
54 enum E_MODULATE_FUNC 54 enum E_MODULATE_FUNC
55 { 55 {
56 EMFN_MODULATE_1X = 1, 56 EMFN_MODULATE_1X = 1,
57 EMFN_MODULATE_2X = 2, 57 EMFN_MODULATE_2X = 2,
58 EMFN_MODULATE_4X = 4 58 EMFN_MODULATE_4X = 4
59 }; 59 };
60 60
61 //! Comparison function, e.g. for depth buffer test 61 //! Comparison function, e.g. for depth buffer test
62 enum E_COMPARISON_FUNC 62 enum E_COMPARISON_FUNC
63 { 63 {
64 //! Test never succeeds, this equals disable 64 //! Test never succeeds, this equals disable
65 ECFN_NEVER=0, 65 ECFN_NEVER=0,
66 //! <= test, default for e.g. depth test 66 //! <= test, default for e.g. depth test
67 ECFN_LESSEQUAL=1, 67 ECFN_LESSEQUAL=1,
68 //! Exact equality 68 //! Exact equality
69 ECFN_EQUAL=2, 69 ECFN_EQUAL=2,
70 //! exclusive less comparison, i.e. < 70 //! exclusive less comparison, i.e. <
71 ECFN_LESS, 71 ECFN_LESS,
72 //! Succeeds almost always, except for exact equality 72 //! Succeeds almost always, except for exact equality
73 ECFN_NOTEQUAL, 73 ECFN_NOTEQUAL,
74 //! >= test 74 //! >= test
75 ECFN_GREATEREQUAL, 75 ECFN_GREATEREQUAL,
76 //! inverse of <= 76 //! inverse of <=
77 ECFN_GREATER, 77 ECFN_GREATER,
78 //! test succeeds always 78 //! test succeeds always
79 ECFN_ALWAYS 79 ECFN_ALWAYS
80 }; 80 };
81 81
82 //! Enum values for enabling/disabling color planes for rendering 82 //! Enum values for enabling/disabling color planes for rendering
83 enum E_COLOR_PLANE 83 enum E_COLOR_PLANE
84 { 84 {
85 //! No color enabled 85 //! No color enabled
86 ECP_NONE=0, 86 ECP_NONE=0,
87 //! Alpha enabled 87 //! Alpha enabled
88 ECP_ALPHA=1, 88 ECP_ALPHA=1,
89 //! Red enabled 89 //! Red enabled
90 ECP_RED=2, 90 ECP_RED=2,
91 //! Green enabled 91 //! Green enabled
92 ECP_GREEN=4, 92 ECP_GREEN=4,
93 //! Blue enabled 93 //! Blue enabled
94 ECP_BLUE=8, 94 ECP_BLUE=8,
95 //! All colors, no alpha 95 //! All colors, no alpha
96 ECP_RGB=14, 96 ECP_RGB=14,
97 //! All planes enabled 97 //! All planes enabled
98 ECP_ALL=15 98 ECP_ALL=15
99 }; 99 };
100 100
101 //! Source of the alpha value to take 101 //! Source of the alpha value to take
102 /** This is currently only supported in EMT_ONETEXTURE_BLEND. You can use an 102 /** This is currently only supported in EMT_ONETEXTURE_BLEND. You can use an
103 or'ed combination of values. Alpha values are modulated (multiplicated). */ 103 or'ed combination of values. Alpha values are modulated (multiplicated). */
104 enum E_ALPHA_SOURCE 104 enum E_ALPHA_SOURCE
105 { 105 {
106 //! Use no alpha, somewhat redundant with other settings 106 //! Use no alpha, somewhat redundant with other settings
107 EAS_NONE=0, 107 EAS_NONE=0,
108 //! Use vertex color alpha 108 //! Use vertex color alpha
109 EAS_VERTEX_COLOR, 109 EAS_VERTEX_COLOR,
110 //! Use texture alpha channel 110 //! Use texture alpha channel
111 EAS_TEXTURE 111 EAS_TEXTURE
112 }; 112 };
113 113
114 //! EMT_ONETEXTURE_BLEND: pack srcFact, dstFact, Modulate and alpha source to MaterialTypeParam 114 //! EMT_ONETEXTURE_BLEND: pack srcFact, dstFact, Modulate and alpha source to MaterialTypeParam
115 /** alpha source can be an OR'ed combination of E_ALPHA_SOURCE values. */ 115 /** alpha source can be an OR'ed combination of E_ALPHA_SOURCE values. */
116 inline f32 pack_textureBlendFunc ( const E_BLEND_FACTOR srcFact, const E_BLEND_FACTOR dstFact, const E_MODULATE_FUNC modulate=EMFN_MODULATE_1X, const u32 alphaSource=EAS_TEXTURE ) 116 inline f32 pack_textureBlendFunc ( const E_BLEND_FACTOR srcFact, const E_BLEND_FACTOR dstFact, const E_MODULATE_FUNC modulate=EMFN_MODULATE_1X, const u32 alphaSource=EAS_TEXTURE )
117 { 117 {
118 const u32 tmp = (alphaSource << 12) | (modulate << 8) | (srcFact << 4) | dstFact; 118 const u32 tmp = (alphaSource << 12) | (modulate << 8) | (srcFact << 4) | dstFact;
119 return FR(tmp); 119 return FR(tmp);
120 } 120 }
121 121
122 //! EMT_ONETEXTURE_BLEND: unpack srcFact & dstFact and Modulo to MaterialTypeParam 122 //! EMT_ONETEXTURE_BLEND: unpack srcFact & dstFact and Modulo to MaterialTypeParam
123 /** The fields don't use the full byte range, so we could pack even more... */ 123 /** The fields don't use the full byte range, so we could pack even more... */
124 inline void unpack_textureBlendFunc ( E_BLEND_FACTOR &srcFact, E_BLEND_FACTOR &dstFact, 124 inline void unpack_textureBlendFunc ( E_BLEND_FACTOR &srcFact, E_BLEND_FACTOR &dstFact,
125 E_MODULATE_FUNC &modulo, u32& alphaSource, const f32 param ) 125 E_MODULATE_FUNC &modulo, u32& alphaSource, const f32 param )
126 { 126 {
127 const u32 state = IR(param); 127 const u32 state = IR(param);
128 alphaSource = (state & 0x0000F000) >> 12; 128 alphaSource = (state & 0x0000F000) >> 12;
129 modulo = E_MODULATE_FUNC( ( state & 0x00000F00 ) >> 8 ); 129 modulo = E_MODULATE_FUNC( ( state & 0x00000F00 ) >> 8 );
130 srcFact = E_BLEND_FACTOR ( ( state & 0x000000F0 ) >> 4 ); 130 srcFact = E_BLEND_FACTOR ( ( state & 0x000000F0 ) >> 4 );
131 dstFact = E_BLEND_FACTOR ( ( state & 0x0000000F ) ); 131 dstFact = E_BLEND_FACTOR ( ( state & 0x0000000F ) );
132 } 132 }
133 133
134 //! EMT_ONETEXTURE_BLEND: has BlendFactor Alphablending 134 //! EMT_ONETEXTURE_BLEND: has BlendFactor Alphablending
135 inline bool textureBlendFunc_hasAlpha ( const E_BLEND_FACTOR factor ) 135 inline bool textureBlendFunc_hasAlpha ( const E_BLEND_FACTOR factor )
136 { 136 {
137 switch ( factor ) 137 switch ( factor )
138 { 138 {
139 case EBF_SRC_ALPHA: 139 case EBF_SRC_ALPHA:
140 case EBF_ONE_MINUS_SRC_ALPHA: 140 case EBF_ONE_MINUS_SRC_ALPHA:
141 case EBF_DST_ALPHA: 141 case EBF_DST_ALPHA:
142 case EBF_ONE_MINUS_DST_ALPHA: 142 case EBF_ONE_MINUS_DST_ALPHA:
143 case EBF_SRC_ALPHA_SATURATE: 143 case EBF_SRC_ALPHA_SATURATE:
144 return true; 144 return true;
145 default: 145 default:
146 return false; 146 return false;
147 } 147 }
148 } 148 }
149 149
150 150
151 //! These flags are used to specify the anti-aliasing and smoothing modes 151 //! These flags are used to specify the anti-aliasing and smoothing modes
152 /** Techniques supported are multisampling, geometry smoothing, and alpha 152 /** Techniques supported are multisampling, geometry smoothing, and alpha
153 to coverage. 153 to coverage.
154 Some drivers don't support a per-material setting of the anti-aliasing 154 Some drivers don't support a per-material setting of the anti-aliasing
155 modes. In those cases, FSAA/multisampling is defined by the device mode 155 modes. In those cases, FSAA/multisampling is defined by the device mode
156 chosen upon creation via irr::SIrrCreationParameters. 156 chosen upon creation via irr::SIrrCreationParameters.
157 */ 157 */
158 enum E_ANTI_ALIASING_MODE 158 enum E_ANTI_ALIASING_MODE
159 { 159 {
160 //! Use to turn off anti-aliasing for this material 160 //! Use to turn off anti-aliasing for this material
161 EAAM_OFF=0, 161 EAAM_OFF=0,
162 //! Default anti-aliasing mode 162 //! Default anti-aliasing mode
163 EAAM_SIMPLE=1, 163 EAAM_SIMPLE=1,
164 //! High-quality anti-aliasing, not always supported, automatically enables SIMPLE mode 164 //! High-quality anti-aliasing, not always supported, automatically enables SIMPLE mode
165 EAAM_QUALITY=3, 165 EAAM_QUALITY=3,
166 //! Line smoothing 166 //! Line smoothing
167 EAAM_LINE_SMOOTH=4, 167 EAAM_LINE_SMOOTH=4,
168 //! point smoothing, often in software and slow, only with OpenGL 168 //! point smoothing, often in software and slow, only with OpenGL
169 EAAM_POINT_SMOOTH=8, 169 EAAM_POINT_SMOOTH=8,
170 //! All typical anti-alias and smooth modes 170 //! All typical anti-alias and smooth modes
171 EAAM_FULL_BASIC=15, 171 EAAM_FULL_BASIC=15,
172 //! Enhanced anti-aliasing for transparent materials 172 //! Enhanced anti-aliasing for transparent materials
173 /** Usually used with EMT_TRANSPARENT_ALPHA_REF and multisampling. */ 173 /** Usually used with EMT_TRANSPARENT_ALPHA_REF and multisampling. */
174 EAAM_ALPHA_TO_COVERAGE=16 174 EAAM_ALPHA_TO_COVERAGE=16
175 }; 175 };
176 176
177 //! These flags allow to define the interpretation of vertex color when lighting is enabled 177 //! These flags allow to define the interpretation of vertex color when lighting is enabled
178 /** Without lighting being enabled the vertex color is the only value defining the fragment color. 178 /** Without lighting being enabled the vertex color is the only value defining the fragment color.
179 Once lighting is enabled, the four values for diffuse, ambient, emissive, and specular take over. 179 Once lighting is enabled, the four values for diffuse, ambient, emissive, and specular take over.
180 With these flags it is possible to define which lighting factor shall be defined by the vertex color 180 With these flags it is possible to define which lighting factor shall be defined by the vertex color
181 instead of the lighting factor which is the same for all faces of that material. 181 instead of the lighting factor which is the same for all faces of that material.
182 The default is to use vertex color for the diffuse value, another pretty common value is to use 182 The default is to use vertex color for the diffuse value, another pretty common value is to use
183 vertex color for both diffuse and ambient factor. */ 183 vertex color for both diffuse and ambient factor. */
184 enum E_COLOR_MATERIAL 184 enum E_COLOR_MATERIAL
185 { 185 {
186 //! Don't use vertex color for lighting 186 //! Don't use vertex color for lighting
187 ECM_NONE=0, 187 ECM_NONE=0,
188 //! Use vertex color for diffuse light, this is default 188 //! Use vertex color for diffuse light, this is default
189 ECM_DIFFUSE, 189 ECM_DIFFUSE,
190 //! Use vertex color for ambient light 190 //! Use vertex color for ambient light
191 ECM_AMBIENT, 191 ECM_AMBIENT,
192 //! Use vertex color for emissive light 192 //! Use vertex color for emissive light
193 ECM_EMISSIVE, 193 ECM_EMISSIVE,
194 //! Use vertex color for specular light 194 //! Use vertex color for specular light
195 ECM_SPECULAR, 195 ECM_SPECULAR,
196 //! Use vertex color for both diffuse and ambient light 196 //! Use vertex color for both diffuse and ambient light
197 ECM_DIFFUSE_AND_AMBIENT 197 ECM_DIFFUSE_AND_AMBIENT
198 }; 198 };
199 199
200 //! Flags for the definition of the polygon offset feature 200 //! Flags for the definition of the polygon offset feature
201 /** These flags define whether the offset should be into the screen, or towards the eye. */ 201 /** These flags define whether the offset should be into the screen, or towards the eye. */
202 enum E_POLYGON_OFFSET 202 enum E_POLYGON_OFFSET
203 { 203 {
204 //! Push pixel towards the far plane, away from the eye 204 //! Push pixel towards the far plane, away from the eye
205 /** This is typically used for rendering inner areas. */ 205 /** This is typically used for rendering inner areas. */
206 EPO_BACK=0, 206 EPO_BACK=0,
207 //! Pull pixels towards the camera. 207 //! Pull pixels towards the camera.
208 /** This is typically used for polygons which should appear on top 208 /** This is typically used for polygons which should appear on top
209 of other elements, such as decals. */ 209 of other elements, such as decals. */
210 EPO_FRONT=1 210 EPO_FRONT=1
211 }; 211 };
212 212
213 //! Names for polygon offset direction 213 //! Names for polygon offset direction
214 const c8* const PolygonOffsetDirectionNames[] = 214 const c8* const PolygonOffsetDirectionNames[] =
215 { 215 {
216 "Back", 216 "Back",
217 "Front", 217 "Front",
218 0 218 0
219 }; 219 };
220 220
221 221
222 //! Maximum number of texture an SMaterial can have. 222 //! Maximum number of texture an SMaterial can have.
223 const u32 MATERIAL_MAX_TEXTURES = _IRR_MATERIAL_MAX_TEXTURES_; 223 const u32 MATERIAL_MAX_TEXTURES = _IRR_MATERIAL_MAX_TEXTURES_;
224 224
225 //! Struct for holding parameters for a material renderer 225 //! Struct for holding parameters for a material renderer
226 class SMaterial 226 class SMaterial
227 { 227 {
228 public: 228 public:
229 //! Default constructor. Creates a solid, lit material with white colors 229 //! Default constructor. Creates a solid, lit material with white colors
230 SMaterial() 230 SMaterial()
231 : MaterialType(EMT_SOLID), AmbientColor(255,255,255,255), DiffuseColor(255,255,255,255), 231 : MaterialType(EMT_SOLID), AmbientColor(255,255,255,255), DiffuseColor(255,255,255,255),
232 EmissiveColor(0,0,0,0), SpecularColor(255,255,255,255), 232 EmissiveColor(0,0,0,0), SpecularColor(255,255,255,255),
233 Shininess(0.0f), MaterialTypeParam(0.0f), MaterialTypeParam2(0.0f), Thickness(1.0f), 233 Shininess(0.0f), MaterialTypeParam(0.0f), MaterialTypeParam2(0.0f), Thickness(1.0f),
234 ZBuffer(ECFN_LESSEQUAL), AntiAliasing(EAAM_SIMPLE), ColorMask(ECP_ALL), 234 ZBuffer(ECFN_LESSEQUAL), AntiAliasing(EAAM_SIMPLE), ColorMask(ECP_ALL),
235 ColorMaterial(ECM_DIFFUSE), BlendOperation(EBO_NONE), 235 ColorMaterial(ECM_DIFFUSE), BlendOperation(EBO_NONE),
236 PolygonOffsetFactor(0), PolygonOffsetDirection(EPO_FRONT), 236 PolygonOffsetFactor(0), PolygonOffsetDirection(EPO_FRONT),
237 Wireframe(false), PointCloud(false), GouraudShading(true), 237 Wireframe(false), PointCloud(false), GouraudShading(true),
238 Lighting(true), ZWriteEnable(true), BackfaceCulling(true), FrontfaceCulling(false), 238 Lighting(true), ZWriteEnable(true), BackfaceCulling(true), FrontfaceCulling(false),
239 FogEnable(false), NormalizeNormals(false), UseMipMaps(true) 239 FogEnable(false), NormalizeNormals(false), UseMipMaps(true)
240 { } 240 { }
241 241
242 //! Copy constructor 242 //! Copy constructor
243 /** \param other Material to copy from. */ 243 /** \param other Material to copy from. */
244 SMaterial(const SMaterial& other) 244 SMaterial(const SMaterial& other)
245 { 245 {
246 // These pointers are checked during assignment 246 // These pointers are checked during assignment
247 for (u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i) 247 for (u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i)
248 TextureLayer[i].TextureMatrix = 0; 248 TextureLayer[i].TextureMatrix = 0;
249 *this = other; 249 *this = other;
250 } 250 }
251 251
252 //! Assignment operator 252 //! Assignment operator
253 /** \param other Material to copy from. */ 253 /** \param other Material to copy from. */
254 SMaterial& operator=(const SMaterial& other) 254 SMaterial& operator=(const SMaterial& other)
255 { 255 {
256 // Check for self-assignment! 256 // Check for self-assignment!
257 if (this == &other) 257 if (this == &other)
258 return *this; 258 return *this;
259 259
260 MaterialType = other.MaterialType; 260 MaterialType = other.MaterialType;
261 261
262 AmbientColor = other.AmbientColor; 262 AmbientColor = other.AmbientColor;
263 DiffuseColor = other.DiffuseColor; 263 DiffuseColor = other.DiffuseColor;
264 EmissiveColor = other.EmissiveColor; 264 EmissiveColor = other.EmissiveColor;
265 SpecularColor = other.SpecularColor; 265 SpecularColor = other.SpecularColor;
266 Shininess = other.Shininess; 266 Shininess = other.Shininess;
267 MaterialTypeParam = other.MaterialTypeParam; 267 MaterialTypeParam = other.MaterialTypeParam;
268 MaterialTypeParam2 = other.MaterialTypeParam2; 268 MaterialTypeParam2 = other.MaterialTypeParam2;
269 Thickness = other.Thickness; 269 Thickness = other.Thickness;
270 for (u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i) 270 for (u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i)
271 { 271 {
272 TextureLayer[i] = other.TextureLayer[i]; 272 TextureLayer[i] = other.TextureLayer[i];
273 } 273 }
274 274
275 Wireframe = other.Wireframe; 275 Wireframe = other.Wireframe;
276 PointCloud = other.PointCloud; 276 PointCloud = other.PointCloud;
277 GouraudShading = other.GouraudShading; 277 GouraudShading = other.GouraudShading;
278 Lighting = other.Lighting; 278 Lighting = other.Lighting;
279 ZWriteEnable = other.ZWriteEnable; 279 ZWriteEnable = other.ZWriteEnable;
280 BackfaceCulling = other.BackfaceCulling; 280 BackfaceCulling = other.BackfaceCulling;
281 FrontfaceCulling = other.FrontfaceCulling; 281 FrontfaceCulling = other.FrontfaceCulling;
282 FogEnable = other.FogEnable; 282 FogEnable = other.FogEnable;
283 NormalizeNormals = other.NormalizeNormals; 283 NormalizeNormals = other.NormalizeNormals;
284 ZBuffer = other.ZBuffer; 284 ZBuffer = other.ZBuffer;
285 AntiAliasing = other.AntiAliasing; 285 AntiAliasing = other.AntiAliasing;
286 ColorMask = other.ColorMask; 286 ColorMask = other.ColorMask;
287 ColorMaterial = other.ColorMaterial; 287 ColorMaterial = other.ColorMaterial;
288 BlendOperation = other.BlendOperation; 288 BlendOperation = other.BlendOperation;
289 PolygonOffsetFactor = other.PolygonOffsetFactor; 289 PolygonOffsetFactor = other.PolygonOffsetFactor;
290 PolygonOffsetDirection = other.PolygonOffsetDirection; 290 PolygonOffsetDirection = other.PolygonOffsetDirection;
291 UseMipMaps = other.UseMipMaps; 291 UseMipMaps = other.UseMipMaps;
292 292
293 return *this; 293 return *this;
294 } 294 }
295 295
296 //! Texture layer array. 296 //! Texture layer array.
297 SMaterialLayer TextureLayer[MATERIAL_MAX_TEXTURES]; 297 SMaterialLayer TextureLayer[MATERIAL_MAX_TEXTURES];
298 298
299 //! Type of the material. Specifies how everything is blended together 299 //! Type of the material. Specifies how everything is blended together
300 E_MATERIAL_TYPE MaterialType; 300 E_MATERIAL_TYPE MaterialType;
301 301
302 //! How much ambient light (a global light) is reflected by this material. 302 //! How much ambient light (a global light) is reflected by this material.
303 /** The default is full white, meaning objects are completely 303 /** The default is full white, meaning objects are completely
304 globally illuminated. Reduce this if you want to see diffuse 304 globally illuminated. Reduce this if you want to see diffuse
305 or specular light effects. */ 305 or specular light effects. */
306 SColor AmbientColor; 306 SColor AmbientColor;
307 307
308 //! How much diffuse light coming from a light source is reflected by this material. 308 //! How much diffuse light coming from a light source is reflected by this material.
309 /** The default is full white. */ 309 /** The default is full white. */
310 SColor DiffuseColor; 310 SColor DiffuseColor;
311 311
312 //! Light emitted by this material. Default is to emit no light. 312 //! Light emitted by this material. Default is to emit no light.
313 SColor EmissiveColor; 313 SColor EmissiveColor;
314 314
315 //! How much specular light (highlights from a light) is reflected. 315 //! How much specular light (highlights from a light) is reflected.
316 /** The default is to reflect white specular light. See 316 /** The default is to reflect white specular light. See
317 SMaterial::Shininess on how to enable specular lights. */ 317 SMaterial::Shininess on how to enable specular lights. */
318 SColor SpecularColor; 318 SColor SpecularColor;
319 319
320 //! Value affecting the size of specular highlights. 320 //! Value affecting the size of specular highlights.
321 /** A value of 20 is common. If set to 0, no specular 321 /** A value of 20 is common. If set to 0, no specular
322 highlights are being used. To activate, simply set the 322 highlights are being used. To activate, simply set the
323 shininess of a material to a value in the range [0.5;128]: 323 shininess of a material to a value in the range [0.5;128]:
324 \code 324 \code
325 sceneNode->getMaterial(0).Shininess = 20.0f; 325 sceneNode->getMaterial(0).Shininess = 20.0f;
326 \endcode 326 \endcode
327 327
328 You can change the color of the highlights using 328 You can change the color of the highlights using
329 \code 329 \code
330 sceneNode->getMaterial(0).SpecularColor.set(255,255,255,255); 330 sceneNode->getMaterial(0).SpecularColor.set(255,255,255,255);
331 \endcode 331 \endcode
332 332
333 The specular color of the dynamic lights 333 The specular color of the dynamic lights
334 (SLight::SpecularColor) will influence the the highlight color 334 (SLight::SpecularColor) will influence the the highlight color
335 too, but they are set to a useful value by default when 335 too, but they are set to a useful value by default when
336 creating the light scene node. Here is a simple example on how 336 creating the light scene node. Here is a simple example on how
337 to use specular highlights: 337 to use specular highlights:
338 \code 338 \code
339 // load and display mesh 339 // load and display mesh
340 scene::IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode( 340 scene::IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode(
341 smgr->getMesh("data/faerie.md2")); 341 smgr->getMesh("data/faerie.md2"));
342 node->setMaterialTexture(0, driver->getTexture("data/Faerie2.pcx")); // set diffuse texture 342 node->setMaterialTexture(0, driver->getTexture("data/Faerie2.pcx")); // set diffuse texture
343 node->setMaterialFlag(video::EMF_LIGHTING, true); // enable dynamic lighting 343 node->setMaterialFlag(video::EMF_LIGHTING, true); // enable dynamic lighting
344 node->getMaterial(0).Shininess = 20.0f; // set size of specular highlights 344 node->getMaterial(0).Shininess = 20.0f; // set size of specular highlights
345 345
346 // add white light 346 // add white light
347 scene::ILightSceneNode* light = smgr->addLightSceneNode(0, 347 scene::ILightSceneNode* light = smgr->addLightSceneNode(0,
348 core::vector3df(5,5,5), video::SColorf(1.0f, 1.0f, 1.0f)); 348 core::vector3df(5,5,5), video::SColorf(1.0f, 1.0f, 1.0f));
349 \endcode */ 349 \endcode */
350 f32 Shininess; 350 f32 Shininess;
351 351
352 //! Free parameter, dependent on the material type. 352 //! Free parameter, dependent on the material type.
353 /** Mostly ignored, used for example in EMT_PARALLAX_MAP_SOLID 353 /** Mostly ignored, used for example in EMT_PARALLAX_MAP_SOLID
354 and EMT_TRANSPARENT_ALPHA_CHANNEL. */ 354 and EMT_TRANSPARENT_ALPHA_CHANNEL. */
355 f32 MaterialTypeParam; 355 f32 MaterialTypeParam;
356 356
357 //! Second free parameter, dependent on the material type. 357 //! Second free parameter, dependent on the material type.
358 /** Mostly ignored. */ 358 /** Mostly ignored. */
359 f32 MaterialTypeParam2; 359 f32 MaterialTypeParam2;
360 360
361 //! Thickness of non-3dimensional elements such as lines and points. 361 //! Thickness of non-3dimensional elements such as lines and points.
362 f32 Thickness; 362 f32 Thickness;
363 363
364 //! Is the ZBuffer enabled? Default: ECFN_LESSEQUAL 364 //! Is the ZBuffer enabled? Default: ECFN_LESSEQUAL
365 /** Values are from E_COMPARISON_FUNC. */ 365 /** Values are from E_COMPARISON_FUNC. */
366 u8 ZBuffer; 366 u8 ZBuffer;
367 367
368 //! Sets the antialiasing mode 368 //! Sets the antialiasing mode
369 /** Values are chosen from E_ANTI_ALIASING_MODE. Default is 369 /** Values are chosen from E_ANTI_ALIASING_MODE. Default is
370 EAAM_SIMPLE|EAAM_LINE_SMOOTH, i.e. simple multi-sample 370 EAAM_SIMPLE|EAAM_LINE_SMOOTH, i.e. simple multi-sample
371 anti-aliasing and lime smoothing is enabled. */ 371 anti-aliasing and lime smoothing is enabled. */
372 u8 AntiAliasing; 372 u8 AntiAliasing;
373 373
374 //! Defines the enabled color planes 374 //! Defines the enabled color planes
375 /** Values are defined as or'ed values of the E_COLOR_PLANE enum. 375 /** Values are defined as or'ed values of the E_COLOR_PLANE enum.
376 Only enabled color planes will be rendered to the current render 376 Only enabled color planes will be rendered to the current render
377 target. Typical use is to disable all colors when rendering only to 377 target. Typical use is to disable all colors when rendering only to
378 depth or stencil buffer, or using Red and Green for Stereo rendering. */ 378 depth or stencil buffer, or using Red and Green for Stereo rendering. */
379 u8 ColorMask:4; 379 u8 ColorMask:4;
380 380
381 //! Defines the interpretation of vertex color in the lighting equation 381 //! Defines the interpretation of vertex color in the lighting equation
382 /** Values should be chosen from E_COLOR_MATERIAL. 382 /** Values should be chosen from E_COLOR_MATERIAL.
383 When lighting is enabled, vertex color can be used instead of the 383 When lighting is enabled, vertex color can be used instead of the
384 material values for light modulation. This allows to easily change e.g. the 384 material values for light modulation. This allows to easily change e.g. the
385 diffuse light behavior of each face. The default, ECM_DIFFUSE, will result in 385 diffuse light behavior of each face. The default, ECM_DIFFUSE, will result in
386 a very similar rendering as with lighting turned off, just with light shading. */ 386 a very similar rendering as with lighting turned off, just with light shading. */
387 u8 ColorMaterial:3; 387 u8 ColorMaterial:3;
388 388
389 //! Store the blend operation of choice 389 //! Store the blend operation of choice
390 /** Values to be chosen from E_BLEND_OPERATION. The actual way to use this value 390 /** Values to be chosen from E_BLEND_OPERATION. The actual way to use this value
391 is not yet determined, so ignore it for now. */ 391 is not yet determined, so ignore it for now. */
392 E_BLEND_OPERATION BlendOperation:4; 392 E_BLEND_OPERATION BlendOperation:4;
393 393
394 //! Factor specifying how far the polygon offset should be made 394 //! Factor specifying how far the polygon offset should be made
395 /** Specifying 0 disables the polygon offset. The direction is specified spearately. 395 /** Specifying 0 disables the polygon offset. The direction is specified spearately.
396 The factor can be from 0 to 7.*/ 396 The factor can be from 0 to 7.*/
397 u8 PolygonOffsetFactor:3; 397 u8 PolygonOffsetFactor:3;
398 398
399 //! Flag defining the direction the polygon offset is applied to. 399 //! Flag defining the direction the polygon offset is applied to.
400 /** Can be to front or to back, specififed by values from E_POLYGON_OFFSET. */ 400 /** Can be to front or to back, specififed by values from E_POLYGON_OFFSET. */
401 E_POLYGON_OFFSET PolygonOffsetDirection:1; 401 E_POLYGON_OFFSET PolygonOffsetDirection:1;
402 402
403 //! Draw as wireframe or filled triangles? Default: false 403 //! Draw as wireframe or filled triangles? Default: false
404 /** The user can access a material flag using 404 /** The user can access a material flag using
405 \code material.Wireframe=true \endcode 405 \code material.Wireframe=true \endcode
406 or \code material.setFlag(EMF_WIREFRAME, true); \endcode */ 406 or \code material.setFlag(EMF_WIREFRAME, true); \endcode */
407 bool Wireframe:1; 407 bool Wireframe:1;
408 408
409 //! Draw as point cloud or filled triangles? Default: false 409 //! Draw as point cloud or filled triangles? Default: false
410 bool PointCloud:1; 410 bool PointCloud:1;
411 411
412 //! Flat or Gouraud shading? Default: true 412 //! Flat or Gouraud shading? Default: true
413 bool GouraudShading:1; 413 bool GouraudShading:1;
414 414
415 //! Will this material be lighted? Default: true 415 //! Will this material be lighted? Default: true
416 bool Lighting:1; 416 bool Lighting:1;
417 417
418 //! Is the zbuffer writeable or is it read-only. Default: true. 418 //! Is the zbuffer writeable or is it read-only. Default: true.
419 /** This flag is forced to false if the MaterialType is a 419 /** This flag is forced to false if the MaterialType is a
420 transparent type and the scene parameter 420 transparent type and the scene parameter
421 ALLOW_ZWRITE_ON_TRANSPARENT is not set. */ 421 ALLOW_ZWRITE_ON_TRANSPARENT is not set. */
422 bool ZWriteEnable:1; 422 bool ZWriteEnable:1;
423 423
424 //! Is backface culling enabled? Default: true 424 //! Is backface culling enabled? Default: true
425 bool BackfaceCulling:1; 425 bool BackfaceCulling:1;
426 426
427 //! Is frontface culling enabled? Default: false 427 //! Is frontface culling enabled? Default: false
428 bool FrontfaceCulling:1; 428 bool FrontfaceCulling:1;
429 429
430 //! Is fog enabled? Default: false 430 //! Is fog enabled? Default: false
431 bool FogEnable:1; 431 bool FogEnable:1;
432 432
433 //! Should normals be normalized? 433 //! Should normals be normalized?
434 /** Always use this if the mesh lit and scaled. Default: false */ 434 /** Always use this if the mesh lit and scaled. Default: false */
435 bool NormalizeNormals:1; 435 bool NormalizeNormals:1;
436 436
437 //! Shall mipmaps be used if available 437 //! Shall mipmaps be used if available
438 /** Sometimes, disabling mipmap usage can be useful. Default: true */ 438 /** Sometimes, disabling mipmap usage can be useful. Default: true */
439 bool UseMipMaps:1; 439 bool UseMipMaps:1;
440 440
441 //! Gets the texture transformation matrix for level i 441 //! Gets the texture transformation matrix for level i
442 /** \param i The desired level. Must not be larger than MATERIAL_MAX_TEXTURES. 442 /** \param i The desired level. Must not be larger than MATERIAL_MAX_TEXTURES.
443 \return Texture matrix for texture level i. */ 443 \return Texture matrix for texture level i. */
444 core::matrix4& getTextureMatrix(u32 i) 444 core::matrix4& getTextureMatrix(u32 i)
445 { 445 {
446 return TextureLayer[i].getTextureMatrix(); 446 return TextureLayer[i].getTextureMatrix();
447 } 447 }
448 448
449 //! Gets the immutable texture transformation matrix for level i 449 //! Gets the immutable texture transformation matrix for level i
450 /** \param i The desired level. 450 /** \param i The desired level.
451 \return Texture matrix for texture level i, or identity matrix for levels larger than MATERIAL_MAX_TEXTURES. */ 451 \return Texture matrix for texture level i, or identity matrix for levels larger than MATERIAL_MAX_TEXTURES. */
452 const core::matrix4& getTextureMatrix(u32 i) const 452 const core::matrix4& getTextureMatrix(u32 i) const
453 { 453 {
454 if (i<MATERIAL_MAX_TEXTURES) 454 if (i<MATERIAL_MAX_TEXTURES)
455 return TextureLayer[i].getTextureMatrix(); 455 return TextureLayer[i].getTextureMatrix();
456 else 456 else
457 return core::IdentityMatrix; 457 return core::IdentityMatrix;
458 } 458 }
459 459
460 //! Sets the i-th texture transformation matrix 460 //! Sets the i-th texture transformation matrix
461 /** \param i The desired level. 461 /** \param i The desired level.
462 \param mat Texture matrix for texture level i. */ 462 \param mat Texture matrix for texture level i. */
463 void setTextureMatrix(u32 i, const core::matrix4& mat) 463 void setTextureMatrix(u32 i, const core::matrix4& mat)
464 { 464 {
465 if (i>=MATERIAL_MAX_TEXTURES) 465 if (i>=MATERIAL_MAX_TEXTURES)
466 return; 466 return;
467 TextureLayer[i].setTextureMatrix(mat); 467 TextureLayer[i].setTextureMatrix(mat);
468 } 468 }
469 469
470 //! Gets the i-th texture 470 //! Gets the i-th texture
471 /** \param i The desired level. 471 /** \param i The desired level.
472 \return Texture for texture level i, if defined, else 0. */ 472 \return Texture for texture level i, if defined, else 0. */
473 ITexture* getTexture(u32 i) const 473 ITexture* getTexture(u32 i) const
474 { 474 {
475 return i < MATERIAL_MAX_TEXTURES ? TextureLayer[i].Texture : 0; 475 return i < MATERIAL_MAX_TEXTURES ? TextureLayer[i].Texture : 0;
476 } 476 }
477 477
478 //! Sets the i-th texture 478 //! Sets the i-th texture
479 /** If i>=MATERIAL_MAX_TEXTURES this setting will be ignored. 479 /** If i>=MATERIAL_MAX_TEXTURES this setting will be ignored.
480 \param i The desired level. 480 \param i The desired level.
481 \param tex Texture for texture level i. */ 481 \param tex Texture for texture level i. */
482 void setTexture(u32 i, ITexture* tex) 482 void setTexture(u32 i, ITexture* tex)
483 { 483 {
484 if (i>=MATERIAL_MAX_TEXTURES) 484 if (i>=MATERIAL_MAX_TEXTURES)
485 return; 485 return;
486 TextureLayer[i].Texture = tex; 486 TextureLayer[i].Texture = tex;
487 } 487 }
488 488
489 //! Sets the Material flag to the given value 489 //! Sets the Material flag to the given value
490 /** \param flag The flag to be set. 490 /** \param flag The flag to be set.
491 \param value The new value for the flag. */ 491 \param value The new value for the flag. */
492 void setFlag(E_MATERIAL_FLAG flag, bool value) 492 void setFlag(E_MATERIAL_FLAG flag, bool value)
493 { 493 {
494 switch (flag) 494 switch (flag)
495 { 495 {
496 case EMF_WIREFRAME: 496 case EMF_WIREFRAME:
497 Wireframe = value; break; 497 Wireframe = value; break;
498 case EMF_POINTCLOUD: 498 case EMF_POINTCLOUD:
499 PointCloud = value; break; 499 PointCloud = value; break;
500 case EMF_GOURAUD_SHADING: 500 case EMF_GOURAUD_SHADING:
501 GouraudShading = value; break; 501 GouraudShading = value; break;
502 case EMF_LIGHTING: 502 case EMF_LIGHTING:
503 Lighting = value; break; 503 Lighting = value; break;
504 case EMF_ZBUFFER: 504 case EMF_ZBUFFER:
505 ZBuffer = value; break; 505 ZBuffer = value; break;
506 case EMF_ZWRITE_ENABLE: 506 case EMF_ZWRITE_ENABLE:
507 ZWriteEnable = value; break; 507 ZWriteEnable = value; break;
508 case EMF_BACK_FACE_CULLING: 508 case EMF_BACK_FACE_CULLING:
509 BackfaceCulling = value; break; 509 BackfaceCulling = value; break;
510 case EMF_FRONT_FACE_CULLING: 510 case EMF_FRONT_FACE_CULLING:
511 FrontfaceCulling = value; break; 511 FrontfaceCulling = value; break;
512 case EMF_BILINEAR_FILTER: 512 case EMF_BILINEAR_FILTER:
513 { 513 {
514 for (u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i) 514 for (u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i)
515 TextureLayer[i].BilinearFilter = value; 515 TextureLayer[i].BilinearFilter = value;
516 } 516 }
517 break; 517 break;
518 case EMF_TRILINEAR_FILTER: 518 case EMF_TRILINEAR_FILTER:
519 { 519 {
520 for (u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i) 520 for (u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i)
521 TextureLayer[i].TrilinearFilter = value; 521 TextureLayer[i].TrilinearFilter = value;
522 } 522 }
523 break; 523 break;
524 case EMF_ANISOTROPIC_FILTER: 524 case EMF_ANISOTROPIC_FILTER:
525 { 525 {
526 if (value) 526 if (value)
527 for (u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i) 527 for (u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i)
528 TextureLayer[i].AnisotropicFilter = 0xFF; 528 TextureLayer[i].AnisotropicFilter = 0xFF;
529 else 529 else
530 for (u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i) 530 for (u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i)
531 TextureLayer[i].AnisotropicFilter = 0; 531 TextureLayer[i].AnisotropicFilter = 0;
532 } 532 }
533 break; 533 break;
534 case EMF_FOG_ENABLE: 534 case EMF_FOG_ENABLE:
535 FogEnable = value; break; 535 FogEnable = value; break;
536 case EMF_NORMALIZE_NORMALS: 536 case EMF_NORMALIZE_NORMALS:
537 NormalizeNormals = value; break; 537 NormalizeNormals = value; break;
538 case EMF_TEXTURE_WRAP: 538 case EMF_TEXTURE_WRAP:
539 { 539 {
540 for (u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i) 540 for (u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i)
541 { 541 {
542 TextureLayer[i].TextureWrapU = (E_TEXTURE_CLAMP)value; 542 TextureLayer[i].TextureWrapU = (E_TEXTURE_CLAMP)value;
543 TextureLayer[i].TextureWrapV = (E_TEXTURE_CLAMP)value; 543 TextureLayer[i].TextureWrapV = (E_TEXTURE_CLAMP)value;
544 } 544 }
545 } 545 }
546 break; 546 break;
547 case EMF_ANTI_ALIASING: 547 case EMF_ANTI_ALIASING:
548 AntiAliasing = value?EAAM_SIMPLE:EAAM_OFF; break; 548 AntiAliasing = value?EAAM_SIMPLE:EAAM_OFF; break;
549 case EMF_COLOR_MASK: 549 case EMF_COLOR_MASK:
550 ColorMask = value?ECP_ALL:ECP_NONE; break; 550 ColorMask = value?ECP_ALL:ECP_NONE; break;
551 case EMF_COLOR_MATERIAL: 551 case EMF_COLOR_MATERIAL:
552 ColorMaterial = value?ECM_DIFFUSE:ECM_NONE; break; 552 ColorMaterial = value?ECM_DIFFUSE:ECM_NONE; break;
553 case EMF_USE_MIP_MAPS: 553 case EMF_USE_MIP_MAPS:
554 UseMipMaps = value; break; 554 UseMipMaps = value; break;
555 case EMF_BLEND_OPERATION: 555 case EMF_BLEND_OPERATION:
556 BlendOperation = value?EBO_ADD:EBO_NONE; break; 556 BlendOperation = value?EBO_ADD:EBO_NONE; break;
557 case EMF_POLYGON_OFFSET: 557 case EMF_POLYGON_OFFSET:
558 PolygonOffsetFactor = value?1:0; 558 PolygonOffsetFactor = value?1:0;
559 PolygonOffsetDirection = EPO_BACK; 559 PolygonOffsetDirection = EPO_BACK;
560 break; 560 break;
561 default: 561 default:
562 break; 562 break;
563 } 563 }
564 } 564 }
565 565
566 //! Gets the Material flag 566 //! Gets the Material flag
567 /** \param flag The flag to query. 567 /** \param flag The flag to query.
568 \return The current value of the flag. */ 568 \return The current value of the flag. */
569 bool getFlag(E_MATERIAL_FLAG flag) const 569 bool getFlag(E_MATERIAL_FLAG flag) const
570 { 570 {
571 switch (flag) 571 switch (flag)
572 { 572 {
573 case EMF_WIREFRAME: 573 case EMF_WIREFRAME:
574 return Wireframe; 574 return Wireframe;
575 case EMF_POINTCLOUD: 575 case EMF_POINTCLOUD:
576 return PointCloud; 576 return PointCloud;
577 case EMF_GOURAUD_SHADING: 577 case EMF_GOURAUD_SHADING:
578 return GouraudShading; 578 return GouraudShading;
579 case EMF_LIGHTING: 579 case EMF_LIGHTING:
580 return Lighting; 580 return Lighting;
581 case EMF_ZBUFFER: 581 case EMF_ZBUFFER:
582 return ZBuffer!=ECFN_NEVER; 582 return ZBuffer!=ECFN_NEVER;
583 case EMF_ZWRITE_ENABLE: 583 case EMF_ZWRITE_ENABLE:
584 return ZWriteEnable; 584 return ZWriteEnable;
585 case EMF_BACK_FACE_CULLING: 585 case EMF_BACK_FACE_CULLING:
586 return BackfaceCulling; 586 return BackfaceCulling;
587 case EMF_FRONT_FACE_CULLING: 587 case EMF_FRONT_FACE_CULLING:
588 return FrontfaceCulling; 588 return FrontfaceCulling;
589 case EMF_BILINEAR_FILTER: 589 case EMF_BILINEAR_FILTER:
590 return TextureLayer[0].BilinearFilter; 590 return TextureLayer[0].BilinearFilter;
591 case EMF_TRILINEAR_FILTER: 591 case EMF_TRILINEAR_FILTER:
592 return TextureLayer[0].TrilinearFilter; 592 return TextureLayer[0].TrilinearFilter;
593 case EMF_ANISOTROPIC_FILTER: 593 case EMF_ANISOTROPIC_FILTER:
594 return TextureLayer[0].AnisotropicFilter!=0; 594 return TextureLayer[0].AnisotropicFilter!=0;
595 case EMF_FOG_ENABLE: 595 case EMF_FOG_ENABLE:
596 return FogEnable; 596 return FogEnable;
597 case EMF_NORMALIZE_NORMALS: 597 case EMF_NORMALIZE_NORMALS:
598 return NormalizeNormals; 598 return NormalizeNormals;
599 case EMF_TEXTURE_WRAP: 599 case EMF_TEXTURE_WRAP:
600 return !(TextureLayer[0].TextureWrapU || 600 return !(TextureLayer[0].TextureWrapU ||
601 TextureLayer[0].TextureWrapV || 601 TextureLayer[0].TextureWrapV ||
602 TextureLayer[1].TextureWrapU || 602 TextureLayer[1].TextureWrapU ||
603 TextureLayer[1].TextureWrapV || 603 TextureLayer[1].TextureWrapV ||
604 TextureLayer[2].TextureWrapU || 604 TextureLayer[2].TextureWrapU ||
605 TextureLayer[2].TextureWrapV || 605 TextureLayer[2].TextureWrapV ||
606 TextureLayer[3].TextureWrapU || 606 TextureLayer[3].TextureWrapU ||
607 TextureLayer[3].TextureWrapV); 607 TextureLayer[3].TextureWrapV);
608 case EMF_ANTI_ALIASING: 608 case EMF_ANTI_ALIASING:
609 return (AntiAliasing==1); 609 return (AntiAliasing==1);
610 case EMF_COLOR_MASK: 610 case EMF_COLOR_MASK:
611 return (ColorMask!=ECP_NONE); 611 return (ColorMask!=ECP_NONE);
612 case EMF_COLOR_MATERIAL: 612 case EMF_COLOR_MATERIAL:
613 return (ColorMaterial != ECM_NONE); 613 return (ColorMaterial != ECM_NONE);
614 case EMF_USE_MIP_MAPS: 614 case EMF_USE_MIP_MAPS:
615 return UseMipMaps; 615 return UseMipMaps;
616 case EMF_BLEND_OPERATION: 616 case EMF_BLEND_OPERATION:
617 return BlendOperation != EBO_NONE; 617 return BlendOperation != EBO_NONE;
618 case EMF_POLYGON_OFFSET: 618 case EMF_POLYGON_OFFSET:
619 return PolygonOffsetFactor != 0; 619 return PolygonOffsetFactor != 0;
620 } 620 }
621 621
622 return false; 622 return false;
623 } 623 }
624 624
625 //! Inequality operator 625 //! Inequality operator
626 /** \param b Material to compare to. 626 /** \param b Material to compare to.
627 \return True if the materials differ, else false. */ 627 \return True if the materials differ, else false. */
628 inline bool operator!=(const SMaterial& b) const 628 inline bool operator!=(const SMaterial& b) const
629 { 629 {
630 bool different = 630 bool different =
631 MaterialType != b.MaterialType || 631 MaterialType != b.MaterialType ||
632 AmbientColor != b.AmbientColor || 632 AmbientColor != b.AmbientColor ||
633 DiffuseColor != b.DiffuseColor || 633 DiffuseColor != b.DiffuseColor ||
634 EmissiveColor != b.EmissiveColor || 634 EmissiveColor != b.EmissiveColor ||
635 SpecularColor != b.SpecularColor || 635 SpecularColor != b.SpecularColor ||
636 Shininess != b.Shininess || 636 Shininess != b.Shininess ||
637 MaterialTypeParam != b.MaterialTypeParam || 637 MaterialTypeParam != b.MaterialTypeParam ||
638 MaterialTypeParam2 != b.MaterialTypeParam2 || 638 MaterialTypeParam2 != b.MaterialTypeParam2 ||
639 Thickness != b.Thickness || 639 Thickness != b.Thickness ||
640 Wireframe != b.Wireframe || 640 Wireframe != b.Wireframe ||
641 PointCloud != b.PointCloud || 641 PointCloud != b.PointCloud ||
642 GouraudShading != b.GouraudShading || 642 GouraudShading != b.GouraudShading ||
643 Lighting != b.Lighting || 643 Lighting != b.Lighting ||
644 ZBuffer != b.ZBuffer || 644 ZBuffer != b.ZBuffer ||
645 ZWriteEnable != b.ZWriteEnable || 645 ZWriteEnable != b.ZWriteEnable ||
646 BackfaceCulling != b.BackfaceCulling || 646 BackfaceCulling != b.BackfaceCulling ||
647 FrontfaceCulling != b.FrontfaceCulling || 647 FrontfaceCulling != b.FrontfaceCulling ||
648 FogEnable != b.FogEnable || 648 FogEnable != b.FogEnable ||
649 NormalizeNormals != b.NormalizeNormals || 649 NormalizeNormals != b.NormalizeNormals ||
650 AntiAliasing != b.AntiAliasing || 650 AntiAliasing != b.AntiAliasing ||
651 ColorMask != b.ColorMask || 651 ColorMask != b.ColorMask ||
652 ColorMaterial != b.ColorMaterial || 652 ColorMaterial != b.ColorMaterial ||
653 BlendOperation != b.BlendOperation || 653 BlendOperation != b.BlendOperation ||
654 PolygonOffsetFactor != b.PolygonOffsetFactor || 654 PolygonOffsetFactor != b.PolygonOffsetFactor ||
655 PolygonOffsetDirection != b.PolygonOffsetDirection || 655 PolygonOffsetDirection != b.PolygonOffsetDirection ||
656 UseMipMaps != b.UseMipMaps; 656 UseMipMaps != b.UseMipMaps;
657 for (u32 i=0; (i<MATERIAL_MAX_TEXTURES) && !different; ++i) 657 for (u32 i=0; (i<MATERIAL_MAX_TEXTURES) && !different; ++i)
658 { 658 {
659 different |= (TextureLayer[i] != b.TextureLayer[i]); 659 different |= (TextureLayer[i] != b.TextureLayer[i]);
660 } 660 }
661 return different; 661 return different;
662 } 662 }
663 663
664 //! Equality operator 664 //! Equality operator
665 /** \param b Material to compare to. 665 /** \param b Material to compare to.
666 \return True if the materials are equal, else false. */ 666 \return True if the materials are equal, else false. */
667 inline bool operator==(const SMaterial& b) const 667 inline bool operator==(const SMaterial& b) const
668 { return !(b!=*this); } 668 { return !(b!=*this); }
669 669
670 bool isTransparent() const 670 bool isTransparent() const
671 { 671 {
672 return MaterialType==EMT_TRANSPARENT_ADD_COLOR || 672 return MaterialType==EMT_TRANSPARENT_ADD_COLOR ||
673 MaterialType==EMT_TRANSPARENT_ALPHA_CHANNEL || 673 MaterialType==EMT_TRANSPARENT_ALPHA_CHANNEL ||
674 MaterialType==EMT_TRANSPARENT_VERTEX_ALPHA || 674 MaterialType==EMT_TRANSPARENT_VERTEX_ALPHA ||
675 MaterialType==EMT_TRANSPARENT_REFLECTION_2_LAYER; 675 MaterialType==EMT_TRANSPARENT_REFLECTION_2_LAYER;
676 } 676 }
677 }; 677 };
678 678
679 //! global const identity Material 679 //! global const identity Material
680 IRRLICHT_API extern SMaterial IdentityMaterial; 680 IRRLICHT_API extern SMaterial IdentityMaterial;
681 681
682} // end namespace video 682} // end namespace video
683} // end namespace irr 683} // end namespace irr
684 684
685#endif 685#endif