Irrlicht 3D Engine
SMaterial.h
Go to the documentation of this file.
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 
5 #ifndef __S_MATERIAL_H_INCLUDED__
6 #define __S_MATERIAL_H_INCLUDED__
7 
8 #include "SColor.h"
9 #include "matrix4.h"
10 #include "irrArray.h"
11 #include "irrMath.h"
12 #include "EMaterialTypes.h"
13 #include "EMaterialFlags.h"
14 #include "SMaterialLayer.h"
15 
16 namespace irr
17 {
18 namespace video
19 {
20  class ITexture;
21 
24  {
25  EBF_ZERO = 0,
36  };
37 
40  {
41  EBO_NONE = 0,
51  };
52 
55  {
59  };
60 
63  {
82  };
83 
86  {
98  ECP_RGB=14,
101  };
102 
104 
107  {
114  };
115 
117 
118  inline f32 pack_textureBlendFunc(const E_BLEND_FACTOR srcFact, const E_BLEND_FACTOR dstFact,
119  const E_MODULATE_FUNC modulate=EMFN_MODULATE_1X, const u32 alphaSource=EAS_TEXTURE)
120  {
121  const u32 tmp = (alphaSource << 20) | (modulate << 16) | (srcFact << 12) | (dstFact << 8) | (srcFact << 4) | dstFact;
122  return FR(tmp);
123  }
124 
126 
127  inline f32 pack_textureBlendFuncSeparate(const E_BLEND_FACTOR srcRGBFact, const E_BLEND_FACTOR dstRGBFact,
128  const E_BLEND_FACTOR srcAlphaFact, const E_BLEND_FACTOR dstAlphaFact,
129  const E_MODULATE_FUNC modulate=EMFN_MODULATE_1X, const u32 alphaSource=EAS_TEXTURE)
130  {
131  const u32 tmp = (alphaSource << 20) | (modulate << 16) | (srcAlphaFact << 12) | (dstAlphaFact << 8) | (srcRGBFact << 4) | dstRGBFact;
132  return FR(tmp);
133  }
134 
136 
137  inline void unpack_textureBlendFunc(E_BLEND_FACTOR &srcFact, E_BLEND_FACTOR &dstFact,
138  E_MODULATE_FUNC &modulo, u32& alphaSource, const f32 param)
139  {
140  const u32 state = IR(param);
141  alphaSource = (state & 0x00F00000) >> 20;
142  modulo = E_MODULATE_FUNC( ( state & 0x000F0000 ) >> 16 );
143  srcFact = E_BLEND_FACTOR ( ( state & 0x000000F0 ) >> 4 );
144  dstFact = E_BLEND_FACTOR ( ( state & 0x0000000F ) );
145  }
146 
148 
149  inline void unpack_textureBlendFuncSeparate(E_BLEND_FACTOR &srcRGBFact, E_BLEND_FACTOR &dstRGBFact,
150  E_BLEND_FACTOR &srcAlphaFact, E_BLEND_FACTOR &dstAlphaFact,
151  E_MODULATE_FUNC &modulo, u32& alphaSource, const f32 param)
152  {
153  const u32 state = IR(param);
154  alphaSource = (state & 0x00F00000) >> 20;
155  modulo = E_MODULATE_FUNC( ( state & 0x000F0000 ) >> 16 );
156  srcAlphaFact = E_BLEND_FACTOR ( ( state & 0x0000F000 ) >> 12 );
157  dstAlphaFact = E_BLEND_FACTOR ( ( state & 0x00000F00 ) >> 8 );
158  srcRGBFact = E_BLEND_FACTOR ( ( state & 0x000000F0 ) >> 4 );
159  dstRGBFact = E_BLEND_FACTOR ( ( state & 0x0000000F ) );
160  }
161 
163  inline bool textureBlendFunc_hasAlpha ( const E_BLEND_FACTOR factor )
164  {
165  switch ( factor )
166  {
167  case EBF_SRC_ALPHA:
169  case EBF_DST_ALPHA:
172  return true;
173  default:
174  return false;
175  }
176  }
177 
178 
180 
187  {
202 
204  };
205 
207 
214  {
227  };
228 
230 
232  {
234 
237 
240  };
241 
244  {
245  "Back",
246  "Front",
247  0
248  };
249 
252  {
258  };
259 
260 
262 
266 
268 
283 
285  // Note for implementors: Serialization is in CNullDriver
286  class SMaterial
287  {
288  public:
291  : MaterialType(EMT_SOLID), AmbientColor(255,255,255,255), DiffuseColor(255,255,255,255),
292  EmissiveColor(0,0,0,0), SpecularColor(255,255,255,255),
293  Shininess(0.0f), MaterialTypeParam(0.0f), MaterialTypeParam2(0.0f), Thickness(1.0f),
298  Wireframe(false), PointCloud(false), GouraudShading(true),
299  Lighting(true), ZWriteEnable(true), BackfaceCulling(true), FrontfaceCulling(false),
300  FogEnable(false), NormalizeNormals(false), UseMipMaps(true),
302  { }
303 
305 
306  SMaterial(const SMaterial& other)
307  {
308  // These pointers are checked during assignment
309  for (u32 i=0; i<MATERIAL_MAX_TEXTURES_USED; ++i)
310  TextureLayer[i].TextureMatrix = 0;
311  *this = other;
312  }
313 
315 
317  {
318  // Check for self-assignment!
319  if (this == &other)
320  return *this;
321 
322  MaterialType = other.MaterialType;
323 
324  AmbientColor = other.AmbientColor;
325  DiffuseColor = other.DiffuseColor;
328  Shininess = other.Shininess;
331  Thickness = other.Thickness;
332  for (u32 i=0; i<MATERIAL_MAX_TEXTURES_USED; ++i)
333  {
334  TextureLayer[i] = other.TextureLayer[i];
335  }
336 
337  Wireframe = other.Wireframe;
338  PointCloud = other.PointCloud;
340  Lighting = other.Lighting;
341  ZWriteEnable = other.ZWriteEnable;
344  FogEnable = other.FogEnable;
346  ZBuffer = other.ZBuffer;
347  AntiAliasing = other.AntiAliasing;
348  ColorMask = other.ColorMask;
351  BlendFactor = other.BlendFactor;
356  UseMipMaps = other.UseMipMaps;
358 
359  return *this;
360  }
361 
364 
367 
369 
373 
375 
377 
380 
382 
385 
387 
417 
419 
422 
424 
426 
429 
431 
435 
437 
440 
442 
447 
449 
455 
457 
459 
461 
465 
467 
472 
474 
477 
479 
486 
488 
495 
497 
500  bool Wireframe:1;
501 
503  bool PointCloud:1;
504 
507 
509  bool Lighting:1;
510 
512 
516  bool ZWriteEnable:1;
517 
520 
523 
525  bool FogEnable:1;
526 
528 
530 
532 
533  bool UseMipMaps:1;
534 
536 
539 
541 
544  {
545  return TextureLayer[i].getTextureMatrix();
546  }
547 
549 
552  {
553  if (i<MATERIAL_MAX_TEXTURES)
554  return TextureLayer[i].getTextureMatrix();
555  else
556  return core::IdentityMatrix;
557  }
558 
560 
562  void setTextureMatrix(u32 i, const core::matrix4& mat)
563  {
564  if (i>=MATERIAL_MAX_TEXTURES)
565  return;
567  }
568 
570 
573  {
574  return i < MATERIAL_MAX_TEXTURES ? TextureLayer[i].Texture : 0;
575  }
576 
578 
581  void setTexture(u32 i, ITexture* tex)
582  {
583  if (i>=MATERIAL_MAX_TEXTURES)
584  return;
585  TextureLayer[i].Texture = tex;
586  }
587 
589 
591  void setFlag(E_MATERIAL_FLAG flag, bool value)
592  {
593  switch (flag)
594  {
595  case EMF_WIREFRAME:
596  Wireframe = value; break;
597  case EMF_POINTCLOUD:
598  PointCloud = value; break;
599  case EMF_GOURAUD_SHADING:
600  GouraudShading = value; break;
601  case EMF_LIGHTING:
602  Lighting = value; break;
603  case EMF_ZBUFFER:
604  ZBuffer = value; break;
605  case EMF_ZWRITE_ENABLE:
606  ZWriteEnable = value; break;
608  BackfaceCulling = value; break;
610  FrontfaceCulling = value; break;
611  case EMF_BILINEAR_FILTER:
612  {
613  for (u32 i=0; i<MATERIAL_MAX_TEXTURES_USED; ++i)
614  TextureLayer[i].BilinearFilter = value;
615  }
616  break;
618  {
619  for (u32 i=0; i<MATERIAL_MAX_TEXTURES_USED; ++i)
620  TextureLayer[i].TrilinearFilter = value;
621  }
622  break;
624  {
625  if (value)
626  for (u32 i=0; i<MATERIAL_MAX_TEXTURES_USED; ++i)
627  TextureLayer[i].AnisotropicFilter = 0xFF;
628  else
629  for (u32 i=0; i<MATERIAL_MAX_TEXTURES_USED; ++i)
630  TextureLayer[i].AnisotropicFilter = 0;
631  }
632  break;
633  case EMF_FOG_ENABLE:
634  FogEnable = value; break;
636  NormalizeNormals = value; break;
637  case EMF_TEXTURE_WRAP:
638  {
639  for (u32 i=0; i<MATERIAL_MAX_TEXTURES_USED; ++i)
640  {
644  }
645  }
646  break;
647  case EMF_ANTI_ALIASING:
648  AntiAliasing = value?EAAM_SIMPLE:EAAM_OFF; break;
649  case EMF_COLOR_MASK:
650  ColorMask = value?ECP_ALL:ECP_NONE; break;
651  case EMF_COLOR_MATERIAL:
652  ColorMaterial = value?ECM_DIFFUSE:ECM_NONE; break;
653  case EMF_USE_MIP_MAPS:
654  UseMipMaps = value; break;
655  case EMF_BLEND_OPERATION:
656  BlendOperation = value?EBO_ADD:EBO_NONE; break;
657  case EMF_BLEND_FACTOR:
658  break;
659  case EMF_POLYGON_OFFSET:
660  PolygonOffsetFactor = value?1:0;
662  PolygonOffsetSlopeScale = value?1.f:0.f;
663  PolygonOffsetDepthBias = value?1.f:0.f;
664  default:
665  break;
666  }
667  }
668 
670 
672  bool getFlag(E_MATERIAL_FLAG flag) const
673  {
674  switch (flag)
675  {
676  case EMF_WIREFRAME:
677  return Wireframe;
678  case EMF_POINTCLOUD:
679  return PointCloud;
680  case EMF_GOURAUD_SHADING:
681  return GouraudShading;
682  case EMF_LIGHTING:
683  return Lighting;
684  case EMF_ZBUFFER:
685  return ZBuffer!=ECFN_DISABLED;
686  case EMF_ZWRITE_ENABLE:
687  return ZWriteEnable;
689  return BackfaceCulling;
691  return FrontfaceCulling;
692  case EMF_BILINEAR_FILTER:
693  return TextureLayer[0].BilinearFilter;
695  return TextureLayer[0].TrilinearFilter;
697  return TextureLayer[0].AnisotropicFilter!=0;
698  case EMF_FOG_ENABLE:
699  return FogEnable;
701  return NormalizeNormals;
702  case EMF_TEXTURE_WRAP:
703  return !(TextureLayer[0].TextureWrapU ||
706  case EMF_ANTI_ALIASING:
707  return (AntiAliasing==1);
708  case EMF_COLOR_MASK:
709  return (ColorMask!=ECP_NONE);
710  case EMF_COLOR_MATERIAL:
711  return (ColorMaterial != ECM_NONE);
712  case EMF_USE_MIP_MAPS:
713  return UseMipMaps;
714  case EMF_BLEND_OPERATION:
715  return BlendOperation != EBO_NONE;
716  case EMF_BLEND_FACTOR:
717  return BlendFactor != 0.f;
718  case EMF_POLYGON_OFFSET:
719  return PolygonOffsetFactor != 0 || PolygonOffsetDepthBias != 0.f;
720  }
721 
722  return false;
723  }
724 
726 
728  inline bool operator!=(const SMaterial& b) const
729  {
730  bool different =
731  MaterialType != b.MaterialType ||
732  AmbientColor != b.AmbientColor ||
733  DiffuseColor != b.DiffuseColor ||
736  Shininess != b.Shininess ||
739  Thickness != b.Thickness ||
740  Wireframe != b.Wireframe ||
741  PointCloud != b.PointCloud ||
743  Lighting != b.Lighting ||
744  ZBuffer != b.ZBuffer ||
745  ZWriteEnable != b.ZWriteEnable ||
748  FogEnable != b.FogEnable ||
750  AntiAliasing != b.AntiAliasing ||
751  ColorMask != b.ColorMask ||
754  BlendFactor != b.BlendFactor ||
759  UseMipMaps != b.UseMipMaps ||
761  ;
762  for (u32 i=0; (i<MATERIAL_MAX_TEXTURES_USED) && !different; ++i)
763  {
764  different |= (TextureLayer[i] != b.TextureLayer[i]);
765  }
766  return different;
767  }
768 
770 
772  inline bool operator==(const SMaterial& b) const
773  { return !(b!=*this); }
774 
775  bool isTransparent() const
776  {
781  return true;
782 
783  if (BlendOperation != EBO_NONE && BlendFactor != 0.f)
784  {
785  E_BLEND_FACTOR srcRGBFact = EBF_ZERO;
786  E_BLEND_FACTOR dstRGBFact = EBF_ZERO;
787  E_BLEND_FACTOR srcAlphaFact = EBF_ZERO;
788  E_BLEND_FACTOR dstAlphaFact = EBF_ZERO;
790  u32 alphaSource = 0;
791 
792  unpack_textureBlendFuncSeparate(srcRGBFact, dstRGBFact, srcAlphaFact, dstAlphaFact, modulo, alphaSource, BlendFactor);
793 
794  if (textureBlendFunc_hasAlpha(srcRGBFact) || textureBlendFunc_hasAlpha(dstRGBFact) ||
795  textureBlendFunc_hasAlpha(srcAlphaFact) || textureBlendFunc_hasAlpha(dstAlphaFact))
796  {
797  return true;
798  }
799  }
800 
801  return false;
802  }
803  };
804 
806  IRRLICHT_API extern SMaterial IdentityMaterial;
807 } // end namespace video
808 } // end namespace irr
809 
810 #endif
u8 ZBuffer
Is the ZBuffer enabled? Default: ECFN_LESSEQUAL.
Definition: SMaterial.h:434
Is backface culling enabled? Default: true.
This modes subtracts destination from source.
Definition: SMaterial.h:44
const core::matrix4 & getTextureMatrix(u32 i) const
Gets the immutable texture transformation matrix for level i.
Definition: SMaterial.h:551
All typical anti-alias and smooth modes.
Definition: SMaterial.h:200
SMaterial()
Default constructor. Creates a solid, lit material with white colors.
Definition: SMaterial.h:290
E_BLEND_FACTOR
Flag for EMT_ONETEXTURE_BLEND, ( BlendFactor ) BlendFunc = source * sourceFactor + dest * destFactor.
Definition: SMaterial.h:23
point smoothing, often in software and slow, only with OpenGL
Definition: SMaterial.h:198
bool FrontfaceCulling
Is frontface culling enabled? Default: false.
Definition: SMaterial.h:522
Is fog enabled? Default: false.
E_MATERIAL_TYPE MaterialType
Type of the material. Specifies how everything is blended together.
Definition: SMaterial.h:366
IRRLICHT_API const matrix4 IdentityMatrix
global const identity matrix
E_MATERIAL_TYPE
Abstracted and easy to use fixed function/programmable pipeline material modes.
Use vertex color for ambient light.
Definition: SMaterial.h:220
bool getFlag(E_MATERIAL_FLAG flag) const
Gets the Material flag.
Definition: SMaterial.h:672
u8 ColorMaterial
Defines the interpretation of vertex color in the lighting equation.
Definition: SMaterial.h:454
ITexture * getTexture(u32 i) const
Gets the i-th texture.
Definition: SMaterial.h:572
dest (srcR, srcG, srcB, srcA)
Definition: SMaterial.h:29
u32 IR(f32 x)
Definition: irrMath.h:390
float f32
32 bit floating point variable.
Definition: irrTypes.h:108
f32 Shininess
Value affecting the size of specular highlights.
Definition: SMaterial.h:416
Depth test disabled (disable also write to depth buffer)
Definition: SMaterial.h:65
E_ZWRITE_FINE_CONTROL ZWriteFineControl
Give more control how the ZWriteEnable flag is interpreted.
Definition: SMaterial.h:538
src & dest (0, 0, 0, 0)
Definition: SMaterial.h:25
void setTexture(u32 i, ITexture *tex)
Sets the i-th texture.
Definition: SMaterial.h:581
bool PointCloud
Draw as point cloud or filled triangles? Default: false.
Definition: SMaterial.h:503
All colors, no alpha.
Definition: SMaterial.h:98
Is the ZBuffer enabled? Default: true.
E_COLOR_MATERIAL
These flags allow to define the interpretation of vertex color when lighting is enabled.
Definition: SMaterial.h:213
bool UseMipMaps
Shall mipmaps be used if available.
Definition: SMaterial.h:533
bool TrilinearFilter
Is trilinear filtering enabled? Default: false.
void setTextureMatrix(u32 i, const core::matrix4 &mat)
Sets the i-th texture transformation matrix.
Definition: SMaterial.h:562
u8 ColorMask
Defines the enabled color planes.
Definition: SMaterial.h:446
char c8
8 bit character variable.
Definition: irrTypes.h:35
Flag for blend operation.
bool operator==(const SMaterial &b) const
Equality operator.
Definition: SMaterial.h:772
core::matrix4 & getTextureMatrix(u32 i)
Gets the texture transformation matrix for level i.
Definition: SMaterial.h:543
bool GouraudShading
Flat or Gouraud shading? Default: true.
Definition: SMaterial.h:506
f32 PolygonOffsetDepthBias
A constant z-buffer offset for a polygon/line/point.
Definition: SMaterial.h:485
bool isTransparent() const
Definition: SMaterial.h:775
Use vertex color for diffuse light, this is default.
Definition: SMaterial.h:218
#define IRRLICHT_API
Set FPU settings.
E_ZWRITE_FINE_CONTROL
Fine-tuning for SMaterial.ZWriteFineControl.
Definition: SMaterial.h:251
u8 TextureWrapU
Texture Clamp Mode.
E_BLEND_OPERATION
Values defining the blend operation.
Definition: SMaterial.h:39
f32 PolygonOffsetSlopeScale
Variable Z-Buffer offset based on the slope of the polygon.
Definition: SMaterial.h:494
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)
Pack srcFact, dstFact, Modulate and alpha source to MaterialTypeParam or BlendFactor.
Definition: SMaterial.h:118
f32 MaterialTypeParam2
Second free parameter, dependent on the material type.
Definition: SMaterial.h:425
f32 Thickness
Thickness of non-3dimensional elements such as lines and points.
Definition: SMaterial.h:428
SColor EmissiveColor
Light emitted by this material. Default is to emit no light.
Definition: SMaterial.h:379
Everything in the Irrlicht Engine can be found in this namespace.
Definition: aabbox3d.h:12
const c8 *const PolygonOffsetDirectionNames[]
Names for polygon offset direction.
Definition: SMaterial.h:243
void setFlag(E_MATERIAL_FLAG flag, bool value)
Sets the Material flag to the given value.
Definition: SMaterial.h:591
ColorMaterial enum for vertex color interpretation.
bool textureBlendFunc_hasAlpha(const E_BLEND_FACTOR factor)
has blend factor alphablending
Definition: SMaterial.h:163
E_BLEND_OPERATION BlendOperation
Store the blend operation of choice.
Definition: SMaterial.h:458
const u32 MATERIAL_MAX_TEXTURES
Maximum number of texture an SMaterial can have.
Definition: SMaterial.h:265
void unpack_textureBlendFunc(E_BLEND_FACTOR &srcFact, E_BLEND_FACTOR &dstFact, E_MODULATE_FUNC &modulo, u32 &alphaSource, const f32 param)
Unpack srcFact, dstFact, modulo and alphaSource factors.
Definition: SMaterial.h:137
f32 BlendFactor
Store the blend factors.
Definition: SMaterial.h:464
ColorMask bits, for enabling the color planes.
src & dest (1, 1, 1, 1)
Definition: SMaterial.h:26
SColor DiffuseColor
How much diffuse light coming from a light source is reflected by this material.
Definition: SMaterial.h:376
Default. Only write zbuffer when SMaterial::ZBuffer is true and SMaterial::isTransparent() returns fa...
Definition: SMaterial.h:254
unsigned char u8
8 bit unsigned variable.
Definition: irrTypes.h:22
No color enabled.
Definition: SMaterial.h:88
Choose minimum value of each color channel.
Definition: SMaterial.h:45
Alpha enabled.
Definition: SMaterial.h:90
src & dest (srcA, srcA, srcA, srcA)
Definition: SMaterial.h:31
bool operator!=(const SMaterial &b) const
Inequality operator.
Definition: SMaterial.h:728
Is bilinear filtering enabled? Default: true.
src & dest (destA, destA, destA, destA)
Definition: SMaterial.h:33
E_COLOR_PLANE
Enum values for enabling/disabling color planes for rendering.
Definition: SMaterial.h:85
No blending happens.
Definition: SMaterial.h:41
Use texture alpha channel.
Definition: SMaterial.h:113
E_ANTI_ALIASING_MODE
These flags are used to specify the anti-aliasing and smoothing modes.
Definition: SMaterial.h:186
test succeeds always
Definition: SMaterial.h:79
SMaterial(const SMaterial &other)
Copy constructor.
Definition: SMaterial.h:306
Choose minimum value of each color channel after applying blend factors, not widely supported.
Definition: SMaterial.h:47
A transparent reflecting material with an optional additional non reflecting texture layer.
bool BackfaceCulling
Is backface culling enabled? Default: true.
Definition: SMaterial.h:519
E_MODULATE_FUNC
MaterialTypeParam: e.g. DirectX: D3DTOP_MODULATE, D3DTOP_MODULATE2X, D3DTOP_MODULATE4X.
Definition: SMaterial.h:54
u8 AntiAliasing
Sets the antialiasing mode.
Definition: SMaterial.h:439
Use to turn off anti-aliasing for this material.
Definition: SMaterial.h:189
SColor AmbientColor
How much ambient light (a global light) is reflected by this material.
Definition: SMaterial.h:372
E_COMPARISON_FUNC
Comparison function, e.g. for depth buffer test.
Definition: SMaterial.h:62
Struct for holding material parameters which exist per texture layer.
Use no alpha, somewhat redundant with other settings.
Definition: SMaterial.h:109
core::matrix4 & getTextureMatrix()
Gets the texture transformation matrix.
src & dest (1-destA, 1-destA, 1-destA, 1-destA)
Definition: SMaterial.h:34
Use vertex color for specular light.
Definition: SMaterial.h:224
Normalizes normals. Default: false.
unsigned int u32
32 bit unsigned variable.
Definition: irrTypes.h:62
ITexture * Texture
Texture.
Exact equality.
Definition: SMaterial.h:69
This mode subtracts the color values.
Definition: SMaterial.h:43
Flag for blend factor.
SColor SpecularColor
How much specular light (highlights from a light) is reflected.
Definition: SMaterial.h:384
Use vertex color for both diffuse and ambient light.
Definition: SMaterial.h:226
src (1-destR, 1-destG, 1-destB, 1-destA)
Definition: SMaterial.h:28
Enhanced anti-aliasing for transparent materials.
Definition: SMaterial.h:203
u8 PolygonOffsetFactor
DEPRECATED. Will be removed after Irrlicht 1.9. Please use PolygonOffsetDepthBias instead.
Definition: SMaterial.h:471
E_ALPHA_SOURCE
Source of the alpha value to take.
Definition: SMaterial.h:106
src & dest (1-srcA, 1-srcA, 1-srcA, 1-srcA)
Definition: SMaterial.h:32
f32 FR(u32 x)
Floating-point representation of an integer value.
Definition: irrMath.h:400
bool NormalizeNormals
Should normals be normalized?
Definition: SMaterial.h:529
Is anisotropic filtering? Default: false.
IRRLICHT_API SMaterial IdentityMaterial
global const identity Material
Flag for enabling/disabling mipmap usage.
Choose minimum value of each color channel based on alpha value, not widely supported.
Definition: SMaterial.h:49
bool FogEnable
Is fog enabled? Default: false.
Definition: SMaterial.h:525
Standard solid material.
Class representing a 32 bit ARGB color.
Definition: SColor.h:314
u8 AnisotropicFilter
Is anisotropic filtering enabled? Default: 0, disabled.
bool BilinearFilter
Is bilinear filtering enabled? Default: true.
4x4 matrix. Mostly used as transformation matrix for 3d calculations.
Definition: matrix4.h:45
All planes enabled.
Definition: SMaterial.h:100
May be written to the zbuffer or is it readonly. Default: true.
IRRLICHT_API u32 MATERIAL_MAX_TEXTURES_USED
By default this is identical to MATERIAL_MAX_TEXTURES.
Will this material be lighted? Default: true.
Choose maximum value of each color channel.
Definition: SMaterial.h:46
<= test, default for e.g. depth test
Definition: SMaterial.h:67
Green enabled.
Definition: SMaterial.h:94
Default anti-aliasing mode.
Definition: SMaterial.h:191
SMaterial & operator=(const SMaterial &other)
Assignment operator.
Definition: SMaterial.h:316
Default blending adds the color values.
Definition: SMaterial.h:42
dest (1-srcR, 1-srcG, 1-srcB, 1-srcA)
Definition: SMaterial.h:30
E_MATERIAL_FLAG
Material flags.
bool Lighting
Will this material be lighted? Default: true.
Definition: SMaterial.h:509
bool ZWriteEnable
Is the zbuffer writable or is it read-only. Default: true.
Definition: SMaterial.h:516
SMaterialLayer TextureLayer[MATERIAL_MAX_TEXTURES]
Texture layer array.
Definition: SMaterial.h:363
exclusive less comparison, i.e. <
Definition: SMaterial.h:71
Test never succeeds.
Definition: SMaterial.h:81
E_POLYGON_OFFSET PolygonOffsetDirection
DEPRECATED. Will be removed after Irrlicht 1.9.
Definition: SMaterial.h:476
Choose maximum value of each color channel after applying blend factors, not widely supported.
Definition: SMaterial.h:48
Push pixel towards the far plane, away from the eye.
Definition: SMaterial.h:235
Interface of a Video Driver dependent Texture.
Definition: ITexture.h:153
Makes the material transparent based on the texture alpha channel.
High-quality anti-aliasing, not always supported, automatically enables SIMPLE mode.
Definition: SMaterial.h:193
Succeeds almost always, except for exact equality.
Definition: SMaterial.h:73
void unpack_textureBlendFuncSeparate(E_BLEND_FACTOR &srcRGBFact, E_BLEND_FACTOR &dstRGBFact, E_BLEND_FACTOR &srcAlphaFact, E_BLEND_FACTOR &dstAlphaFact, E_MODULATE_FUNC &modulo, u32 &alphaSource, const f32 param)
Unpack srcRGBFact, dstRGBFact, srcAlphaFact, dstAlphaFact, modulo and alphaSource factors.
Definition: SMaterial.h:149
bool Wireframe
Draw as wireframe or filled triangles? Default: false.
Definition: SMaterial.h:500
src (destR, destG, destB, destA)
Definition: SMaterial.h:27
Red enabled.
Definition: SMaterial.h:92
Don't use vertex color for lighting.
Definition: SMaterial.h:216
Makes the material transparent based on the vertex alpha value.
f32 pack_textureBlendFuncSeparate(const E_BLEND_FACTOR srcRGBFact, const E_BLEND_FACTOR dstRGBFact, const E_BLEND_FACTOR srcAlphaFact, const E_BLEND_FACTOR dstAlphaFact, const E_MODULATE_FUNC modulate=EMFN_MODULATE_1X, const u32 alphaSource=EAS_TEXTURE)
Pack srcRGBFact, dstRGBFact, srcAlphaFact, dstAlphaFact, Modulate and alpha source to MaterialTypePar...
Definition: SMaterial.h:127
Flat or Gouraud shading? Default: true.
Access to all layers texture wrap settings. Overwrites separate layer settings.
Is trilinear filtering enabled? Default: false.
Use vertex color alpha.
Definition: SMaterial.h:111
Use vertex color for emissive light.
Definition: SMaterial.h:222
Struct for holding parameters for a material renderer.
Definition: SMaterial.h:286
Choose maximum value of each color channel based on alpha value, not widely supported.
Definition: SMaterial.h:50
f32 MaterialTypeParam
Free parameter, dependent on the material type.
Definition: SMaterial.h:421
#define _IRR_MATERIAL_MAX_TEXTURES_
Maximum number of texture an SMaterial can have, up to 8 are supported by Irrlicht.
E_TEXTURE_CLAMP
Texture coord clamp mode outside [0.0, 1.0].
Draw as wireframe or filled triangles? Default: false.
Pull pixels towards the camera.
Definition: SMaterial.h:239
Is frontface culling enabled? Default: false.
src (min(srcA, 1-destA), idem, ...)
Definition: SMaterial.h:35
E_POLYGON_OFFSET
DEPRECATED. Will be removed after Irrlicht 1.9.
Definition: SMaterial.h:231
Draw as point cloud or filled triangles? Default: false.
void setTextureMatrix(const core::matrix4 &mat)
Sets the texture transformation matrix to mat.
Blue enabled.
Definition: SMaterial.h:96
Flag for polygon offset.