arsa  2.7
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 
25  {
26  EBF_ZERO = 0,
37  };
38 
41  {
42  EBO_NONE = 0,
52  };
53 
56  {
60  };
61 
64  {
83  };
84 
87  {
99  ECP_RGB=14,
102  };
103 
105 
108  {
115  };
116 
118 
119  inline f32 pack_textureBlendFunc(const E_BLEND_FACTOR srcFact, const E_BLEND_FACTOR dstFact,
120  const E_MODULATE_FUNC modulate=EMFN_MODULATE_1X, const u32 alphaSource=EAS_TEXTURE)
121  {
122  const u32 tmp = (alphaSource << 20) | (modulate << 16) | (srcFact << 12) | (dstFact << 8) | (srcFact << 4) | dstFact;
123  return FR(tmp);
124  }
125 
127 
128  inline f32 pack_textureBlendFuncSeparate(const E_BLEND_FACTOR srcRGBFact, const E_BLEND_FACTOR dstRGBFact,
129  const E_BLEND_FACTOR srcAlphaFact, const E_BLEND_FACTOR dstAlphaFact,
130  const E_MODULATE_FUNC modulate=EMFN_MODULATE_1X, const u32 alphaSource=EAS_TEXTURE)
131  {
132  const u32 tmp = (alphaSource << 20) | (modulate << 16) | (srcAlphaFact << 12) | (dstAlphaFact << 8) | (srcRGBFact << 4) | dstRGBFact;
133  return FR(tmp);
134  }
135 
137 
138  inline void unpack_textureBlendFunc(E_BLEND_FACTOR &srcFact, E_BLEND_FACTOR &dstFact,
139  E_MODULATE_FUNC &modulo, u32& alphaSource, const f32 param)
140  {
141  const u32 state = IR(param);
142  alphaSource = (state & 0x00F00000) >> 20;
143  modulo = E_MODULATE_FUNC( ( state & 0x000F0000 ) >> 16 );
144  srcFact = E_BLEND_FACTOR ( ( state & 0x000000F0 ) >> 4 );
145  dstFact = E_BLEND_FACTOR ( ( state & 0x0000000F ) );
146  }
147 
149 
150  inline void unpack_textureBlendFuncSeparate(E_BLEND_FACTOR &srcRGBFact, E_BLEND_FACTOR &dstRGBFact,
151  E_BLEND_FACTOR &srcAlphaFact, E_BLEND_FACTOR &dstAlphaFact,
152  E_MODULATE_FUNC &modulo, u32& alphaSource, const f32 param)
153  {
154  const u32 state = IR(param);
155  alphaSource = (state & 0x00F00000) >> 20;
156  modulo = E_MODULATE_FUNC( ( state & 0x000F0000 ) >> 16 );
157  srcAlphaFact = E_BLEND_FACTOR ( ( state & 0x0000F000 ) >> 12 );
158  dstAlphaFact = E_BLEND_FACTOR ( ( state & 0x00000F00 ) >> 8 );
159  srcRGBFact = E_BLEND_FACTOR ( ( state & 0x000000F0 ) >> 4 );
160  dstRGBFact = E_BLEND_FACTOR ( ( state & 0x0000000F ) );
161  }
162 
164  inline bool textureBlendFunc_hasAlpha ( const E_BLEND_FACTOR factor )
165  {
166  switch ( factor )
167  {
168  case EBF_SRC_ALPHA:
170  case EBF_DST_ALPHA:
173  return true;
174  default:
175  return false;
176  }
177  }
178 
179 
181 
188  {
203 
205  };
206 
208 
215  {
228  };
229 
231 
233  {
235 
238 
241  };
242 
245  {
246  "Back",
247  "Front",
248  0
249  };
250 
252  enum E_ZWRITE
253  {
255  EZW_OFF = 0,
256 
263 
266  };
267 
269  const c8* const ZWriteNames[] =
270  {
271  "Off",
272  "Auto",
273  "On",
274  0
275  };
276 
277 
278 
280 
284 
286 
301 
303  // Note for implementors: Serialization is in CNullDriver
304  class SMaterial
305  {
306  public:
309  : MaterialType(EMT_SOLID), AmbientColor(255,255,255,255), DiffuseColor(255,255,255,255),
310  EmissiveColor(0,0,0,0), SpecularColor(255,255,255,255),
316  Wireframe(false), PointCloud(false), GouraudShading(true),
318  FogEnable(false), NormalizeNormals(false), UseMipMaps(true)
319  { }
320 
322 
323  SMaterial(const SMaterial& other)
324  {
325  // These pointers are checked during assignment
326  for (u32 i=0; i<MATERIAL_MAX_TEXTURES_USED; ++i)
327  TextureLayer[i].TextureMatrix = 0;
328  *this = other;
329  }
330 
332 
334  {
335  // Check for self-assignment!
336  if (this == &other)
337  return *this;
338 
339  MaterialType = other.MaterialType;
340 
341  AmbientColor = other.AmbientColor;
342  DiffuseColor = other.DiffuseColor;
345  Shininess = other.Shininess;
348  Thickness = other.Thickness;
349  for (u32 i=0; i<MATERIAL_MAX_TEXTURES_USED; ++i)
350  {
351  TextureLayer[i] = other.TextureLayer[i];
352  }
353 
354  Wireframe = other.Wireframe;
355  PointCloud = other.PointCloud;
357  Lighting = other.Lighting;
358  ZWriteEnable = other.ZWriteEnable;
361  FogEnable = other.FogEnable;
363  ZBuffer = other.ZBuffer;
364  AntiAliasing = other.AntiAliasing;
365  ColorMask = other.ColorMask;
368  BlendFactor = other.BlendFactor;
373  UseMipMaps = other.UseMipMaps;
374 
375  return *this;
376  }
377 
380 
383 
385 
389 
391 
393 
396 
398 
401 
403 
433 
435 
438 
440 
442 
445 
447 
451 
453 
456 
458 
463 
465 
471 
473 
475 
477 
487 
489 
494 
496 
499 
501 
508 
510 
517 
519 
522  bool Wireframe:1;
523 
525  bool PointCloud:1;
526 
529 
531  bool Lighting:1;
532 
534 
537 
540 
543 
545  bool FogEnable:1;
546 
548 
550 
552 
553  bool UseMipMaps:1;
554 
556 
559  {
560  return TextureLayer[i].getTextureMatrix();
561  }
562 
564 
567  {
568  if (i<MATERIAL_MAX_TEXTURES)
569  return TextureLayer[i].getTextureMatrix();
570  else
571  return core::IdentityMatrix;
572  }
573 
575 
577  void setTextureMatrix(u32 i, const core::matrix4& mat)
578  {
579  if (i>=MATERIAL_MAX_TEXTURES)
580  return;
582  }
583 
585 
588  {
589  return i < MATERIAL_MAX_TEXTURES ? TextureLayer[i].Texture : 0;
590  }
591 
593 
596  void setTexture(u32 i, ITexture* tex)
597  {
598  if (i>=MATERIAL_MAX_TEXTURES)
599  return;
600  TextureLayer[i].Texture = tex;
601  }
602 
604 
606  void setFlag(E_MATERIAL_FLAG flag, bool value)
607  {
608  switch (flag)
609  {
610  case EMF_WIREFRAME:
611  Wireframe = value; break;
612  case EMF_POINTCLOUD:
613  PointCloud = value; break;
614  case EMF_GOURAUD_SHADING:
615  GouraudShading = value; break;
616  case EMF_LIGHTING:
617  Lighting = value; break;
618  case EMF_ZBUFFER:
619  ZBuffer = value; break;
620  case EMF_ZWRITE_ENABLE:
621  ZWriteEnable = value ? EZW_AUTO : EZW_OFF; break;
623  BackfaceCulling = value; break;
625  FrontfaceCulling = value; break;
626  case EMF_BILINEAR_FILTER:
627  {
628  for (u32 i=0; i<MATERIAL_MAX_TEXTURES_USED; ++i)
629  TextureLayer[i].BilinearFilter = value;
630  }
631  break;
633  {
634  for (u32 i=0; i<MATERIAL_MAX_TEXTURES_USED; ++i)
635  TextureLayer[i].TrilinearFilter = value;
636  }
637  break;
639  {
640  if (value)
641  for (u32 i=0; i<MATERIAL_MAX_TEXTURES_USED; ++i)
642  TextureLayer[i].AnisotropicFilter = 0xFF;
643  else
644  for (u32 i=0; i<MATERIAL_MAX_TEXTURES_USED; ++i)
645  TextureLayer[i].AnisotropicFilter = 0;
646  }
647  break;
648  case EMF_FOG_ENABLE:
649  FogEnable = value; break;
651  NormalizeNormals = value; break;
652  case EMF_TEXTURE_WRAP:
653  {
654  for (u32 i=0; i<MATERIAL_MAX_TEXTURES_USED; ++i)
655  {
659  }
660  }
661  break;
662  case EMF_ANTI_ALIASING:
664  case EMF_COLOR_MASK:
665  ColorMask = value?ECP_ALL:ECP_NONE; break;
666  case EMF_COLOR_MATERIAL:
668  case EMF_USE_MIP_MAPS:
669  UseMipMaps = value; break;
670  case EMF_BLEND_OPERATION:
672  case EMF_BLEND_FACTOR:
673  break;
674  case EMF_POLYGON_OFFSET:
677  PolygonOffsetSlopeScale = value?1.f:0.f;
678  PolygonOffsetDepthBias = value?1.f:0.f;
679  default:
680  break;
681  }
682  }
683 
685 
687  bool getFlag(E_MATERIAL_FLAG flag) const
688  {
689  switch (flag)
690  {
691  case EMF_WIREFRAME:
692  return Wireframe;
693  case EMF_POINTCLOUD:
694  return PointCloud;
695  case EMF_GOURAUD_SHADING:
696  return GouraudShading;
697  case EMF_LIGHTING:
698  return Lighting;
699  case EMF_ZBUFFER:
700  return ZBuffer!=ECFN_DISABLED;
701  case EMF_ZWRITE_ENABLE:
702  return ZWriteEnable != EZW_OFF;
704  return BackfaceCulling;
706  return FrontfaceCulling;
707  case EMF_BILINEAR_FILTER:
708  return TextureLayer[0].BilinearFilter;
710  return TextureLayer[0].TrilinearFilter;
712  return TextureLayer[0].AnisotropicFilter!=0;
713  case EMF_FOG_ENABLE:
714  return FogEnable;
716  return NormalizeNormals;
717  case EMF_TEXTURE_WRAP:
718  return !(TextureLayer[0].TextureWrapU ||
721  case EMF_ANTI_ALIASING:
722  return (AntiAliasing==1);
723  case EMF_COLOR_MASK:
724  return (ColorMask!=ECP_NONE);
725  case EMF_COLOR_MATERIAL:
726  return (ColorMaterial != ECM_NONE);
727  case EMF_USE_MIP_MAPS:
728  return UseMipMaps;
729  case EMF_BLEND_OPERATION:
730  return BlendOperation != EBO_NONE;
731  case EMF_BLEND_FACTOR:
732  return BlendFactor != 0.f;
733  case EMF_POLYGON_OFFSET:
734  return PolygonOffsetFactor != 0 || PolygonOffsetDepthBias != 0.f;
735  }
736 
737  return false;
738  }
739 
741 
743  inline bool operator!=(const SMaterial& b) const
744  {
745  bool different =
746  MaterialType != b.MaterialType ||
747  AmbientColor != b.AmbientColor ||
748  DiffuseColor != b.DiffuseColor ||
749  EmissiveColor != b.EmissiveColor ||
750  SpecularColor != b.SpecularColor ||
751  Shininess != b.Shininess ||
752  MaterialTypeParam != b.MaterialTypeParam ||
753  MaterialTypeParam2 != b.MaterialTypeParam2 ||
754  Thickness != b.Thickness ||
755  Wireframe != b.Wireframe ||
756  PointCloud != b.PointCloud ||
757  GouraudShading != b.GouraudShading ||
758  Lighting != b.Lighting ||
759  ZBuffer != b.ZBuffer ||
760  ZWriteEnable != b.ZWriteEnable ||
761  BackfaceCulling != b.BackfaceCulling ||
762  FrontfaceCulling != b.FrontfaceCulling ||
763  FogEnable != b.FogEnable ||
764  NormalizeNormals != b.NormalizeNormals ||
765  AntiAliasing != b.AntiAliasing ||
766  ColorMask != b.ColorMask ||
767  ColorMaterial != b.ColorMaterial ||
768  BlendOperation != b.BlendOperation ||
769  BlendFactor != b.BlendFactor ||
770  PolygonOffsetFactor != b.PolygonOffsetFactor ||
771  PolygonOffsetDirection != b.PolygonOffsetDirection ||
772  PolygonOffsetDepthBias != b.PolygonOffsetDepthBias ||
773  PolygonOffsetSlopeScale != b.PolygonOffsetSlopeScale ||
774  UseMipMaps != b.UseMipMaps
775  ;
776  for (u32 i=0; (i<MATERIAL_MAX_TEXTURES_USED) && !different; ++i)
777  {
778  different |= (TextureLayer[i] != b.TextureLayer[i]);
779  }
780  return different;
781  }
782 
784 
786  inline bool operator==(const SMaterial& b) const
787  { return !(b!=*this); }
788 
791  {
792  if (BlendOperation != EBO_NONE && BlendFactor != 0.f)
793  {
794  E_BLEND_FACTOR srcRGBFact = EBF_ZERO;
795  E_BLEND_FACTOR dstRGBFact = EBF_ZERO;
796  E_BLEND_FACTOR srcAlphaFact = EBF_ZERO;
797  E_BLEND_FACTOR dstAlphaFact = EBF_ZERO;
799  u32 alphaSource = 0;
800 
801  unpack_textureBlendFuncSeparate(srcRGBFact, dstRGBFact, srcAlphaFact, dstAlphaFact, modulo, alphaSource, BlendFactor);
802 
803  if (textureBlendFunc_hasAlpha(srcRGBFact) || textureBlendFunc_hasAlpha(dstRGBFact) ||
804  textureBlendFunc_hasAlpha(srcAlphaFact) || textureBlendFunc_hasAlpha(dstAlphaFact))
805  {
806  return true;
807  }
808  }
809  return false;
810  }
811 
815  bool isTransparent() const
816  {
821  return true;
822 
823  return false;
824  }
825  };
826 
828  IRRLICHT_API extern SMaterial IdentityMaterial;
829 } // end namespace video
830 } // end namespace irr
831 
832 #endif
u8 ZBuffer
Is the ZBuffer enabled? Default: ECFN_LESSEQUAL.
Definition: SMaterial.h:450
Is backface culling enabled? Default: true.
This modes subtracts destination from source.
Definition: SMaterial.h:45
const core::matrix4 & getTextureMatrix(u32 i) const
Gets the immutable texture transformation matrix for level i.
Definition: SMaterial.h:566
All typical anti-alias and smooth modes.
Definition: SMaterial.h:201
SMaterial()
Default constructor. Creates a solid, lit material with white colors.
Definition: SMaterial.h:308
point smoothing, often in software and slow, only with OpenGL
Definition: SMaterial.h:199
bool FrontfaceCulling
Is frontface culling enabled? Default: false.
Definition: SMaterial.h:542
Is fog enabled? Default: false.
E_MATERIAL_TYPE MaterialType
Type of the material. Specifies how everything is blended together.
Definition: SMaterial.h:382
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:221
bool getFlag(E_MATERIAL_FLAG flag) const
Gets the Material flag.
Definition: SMaterial.h:687
u8 ColorMaterial
Defines the interpretation of vertex color in the lighting equation.
Definition: SMaterial.h:470
ITexture * getTexture(u32 i) const
Gets the i-th texture.
Definition: SMaterial.h:587
dest (srcR, srcG, srcB, srcA)
Definition: SMaterial.h:30
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:432
Depth test disabled (disable also write to depth buffer)
Definition: SMaterial.h:66
src & dest (0, 0, 0, 0)
Definition: SMaterial.h:26
void setTexture(u32 i, ITexture *tex)
Sets the i-th texture.
Definition: SMaterial.h:596
bool PointCloud
Draw as point cloud or filled triangles? Default: false.
Definition: SMaterial.h:525
All colors, no alpha.
Definition: SMaterial.h:99
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:214
bool UseMipMaps
Shall mipmaps be used if available.
Definition: SMaterial.h:553
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:577
u8 ColorMask
Defines the enabled color planes.
Definition: SMaterial.h:462
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:786
core::matrix4 & getTextureMatrix(u32 i)
Gets the texture transformation matrix for level i.
Definition: SMaterial.h:558
bool GouraudShading
Flat or Gouraud shading? Default: true.
Definition: SMaterial.h:528
f32 PolygonOffsetDepthBias
A constant z-buffer offset for a polygon/line/point.
Definition: SMaterial.h:507
bool isTransparent() const
Definition: SMaterial.h:815
Use vertex color for diffuse light, this is default.
Definition: SMaterial.h:219
#define IRRLICHT_API
Set FPU settings.
u8 TextureWrapU
Texture Clamp Mode.
E_BLEND_OPERATION
Values defining the blend operation.
Definition: SMaterial.h:40
f32 PolygonOffsetSlopeScale
Variable Z-Buffer offset based on the slope of the polygon.
Definition: SMaterial.h:516
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:119
f32 MaterialTypeParam2
Second free parameter, dependent on the material type.
Definition: SMaterial.h:441
f32 Thickness
Thickness of non-3dimensional elements such as lines and points.
Definition: SMaterial.h:444
SColor EmissiveColor
Light emitted by this material. Default is to emit no light.
Definition: SMaterial.h:395
Everything in the Irrlicht Engine can be found in this namespace.
Definition: CARSADPad.h:6
const c8 *const PolygonOffsetDirectionNames[]
Names for polygon offset direction.
Definition: SMaterial.h:244
void setFlag(E_MATERIAL_FLAG flag, bool value)
Sets the Material flag to the given value.
Definition: SMaterial.h:606
ColorMaterial enum for vertex color interpretation.
bool textureBlendFunc_hasAlpha(const E_BLEND_FACTOR factor)
has blend factor alphablending
Definition: SMaterial.h:164
E_BLEND_OPERATION BlendOperation
Store the blend operation of choice.
Definition: SMaterial.h:474
const u32 MATERIAL_MAX_TEXTURES
Maximum number of texture an SMaterial can have.
Definition: SMaterial.h:283
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:138
f32 BlendFactor
Store the blend factors.
Definition: SMaterial.h:486
ColorMask bits, for enabling the color planes.
GLfloat param
src & dest (1, 1, 1, 1)
Definition: SMaterial.h:27
SColor DiffuseColor
How much diffuse light coming from a light source is reflected by this material.
Definition: SMaterial.h:392
unsigned char u8
8 bit unsigned variable.
Definition: irrTypes.h:22
No color enabled.
Definition: SMaterial.h:89
Choose minimum value of each color channel.
Definition: SMaterial.h:46
Alpha enabled.
Definition: SMaterial.h:91
src & dest (srcA, srcA, srcA, srcA)
Definition: SMaterial.h:32
bool operator!=(const SMaterial &b) const
Inequality operator.
Definition: SMaterial.h:743
Is bilinear filtering enabled? Default: true.
src & dest (destA, destA, destA, destA)
Definition: SMaterial.h:34
E_COLOR_PLANE
Enum values for enabling/disabling color planes for rendering.
Definition: SMaterial.h:86
No blending happens.
Definition: SMaterial.h:42
Use texture alpha channel.
Definition: SMaterial.h:114
E_ANTI_ALIASING_MODE
These flags are used to specify the anti-aliasing and smoothing modes.
Definition: SMaterial.h:187
test succeeds always
Definition: SMaterial.h:80
SMaterial(const SMaterial &other)
Copy constructor.
Definition: SMaterial.h:323
Choose minimum value of each color channel after applying blend factors, not widely supported.
Definition: SMaterial.h:48
A transparent reflecting material with an optional additional non reflecting texture layer.
bool BackfaceCulling
Is backface culling enabled? Default: true.
Definition: SMaterial.h:539
E_MODULATE_FUNC
MaterialTypeParam: e.g. DirectX: D3DTOP_MODULATE, D3DTOP_MODULATE2X, D3DTOP_MODULATE4X.
Definition: SMaterial.h:55
u8 AntiAliasing
Sets the antialiasing mode.
Definition: SMaterial.h:455
GLsizei const GLfloat * value
Use to turn off anti-aliasing for this material.
Definition: SMaterial.h:190
SColor AmbientColor
How much ambient light (a global light) is reflected by this material.
Definition: SMaterial.h:388
E_COMPARISON_FUNC
Comparison function, e.g. for depth buffer test.
Definition: SMaterial.h:63
Struct for holding material parameters which exist per texture layer.
Use no alpha, somewhat redundant with other settings.
Definition: SMaterial.h:110
core::matrix4 & getTextureMatrix()
Gets the texture transformation matrix.
const c8 *const ZWriteNames[]
Names for E_ZWRITE.
Definition: SMaterial.h:269
src & dest (1-destA, 1-destA, 1-destA, 1-destA)
Definition: SMaterial.h:35
Use vertex color for specular light.
Definition: SMaterial.h:225
GLfloat f
Normalizes normals. Default: false.
unsigned int u32
32 bit unsigned variable.
Definition: irrTypes.h:62
ITexture * Texture
Texture.
Exact equality.
Definition: SMaterial.h:70
This mode subtracts the color values.
Definition: SMaterial.h:44
Flag for blend factor.
SColor SpecularColor
How much specular light (highlights from a light) is reflected.
Definition: SMaterial.h:400
Use vertex color for both diffuse and ambient light.
Definition: SMaterial.h:227
src (1-destR, 1-destG, 1-destB, 1-destA)
Definition: SMaterial.h:29
Enhanced anti-aliasing for transparent materials.
Definition: SMaterial.h:204
u8 PolygonOffsetFactor
DEPRECATED. Will be removed after Irrlicht 1.9. Please use PolygonOffsetDepthBias instead.
Definition: SMaterial.h:493
E_ALPHA_SOURCE
Source of the alpha value to take.
Definition: SMaterial.h:107
src & dest (1-srcA, 1-srcA, 1-srcA, 1-srcA)
Definition: SMaterial.h:33
f32 FR(u32 x)
Floating-point representation of an integer value.
Definition: irrMath.h:400
bool NormalizeNormals
Should normals be normalized?
Definition: SMaterial.h:549
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:50
bool FogEnable
Is fog enabled? Default: false.
Definition: SMaterial.h:545
Standard solid material.
Class representing a 32 bit ARGB color.
Definition: SColor.h:316
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:101
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:47
<= test, default for e.g. depth test
Definition: SMaterial.h:68
Green enabled.
Definition: SMaterial.h:95
Default anti-aliasing mode.
Definition: SMaterial.h:192
SMaterial & operator=(const SMaterial &other)
Assignment operator.
Definition: SMaterial.h:333
Default blending adds the color values.
Definition: SMaterial.h:43
dest (1-srcR, 1-srcG, 1-srcB, 1-srcA)
Definition: SMaterial.h:31
GLboolean GLboolean GLboolean b
E_MATERIAL_FLAG
Material flags.
E_ZWRITE ZWriteEnable
Is the zbuffer writable or is it read-only. Default: EZW_AUTO.
Definition: SMaterial.h:536
bool Lighting
Will this material be lighted? Default: true.
Definition: SMaterial.h:531
SMaterialLayer TextureLayer[MATERIAL_MAX_TEXTURES]
Texture layer array.
Definition: SMaterial.h:379
exclusive less comparison, i.e. <
Definition: SMaterial.h:72
Test never succeeds.
Definition: SMaterial.h:82
E_POLYGON_OFFSET PolygonOffsetDirection
DEPRECATED. Will be removed after Irrlicht 1.9.
Definition: SMaterial.h:498
Choose maximum value of each color channel after applying blend factors, not widely supported.
Definition: SMaterial.h:49
Push pixel towards the far plane, away from the eye.
Definition: SMaterial.h:236
Interface of a Video Driver dependent Texture.
Definition: ITexture.h:177
Makes the material transparent based on the texture alpha channel.
High-quality anti-aliasing, not always supported, automatically enables SIMPLE mode.
Definition: SMaterial.h:194
Succeeds almost always, except for exact equality.
Definition: SMaterial.h:74
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:150
bool Wireframe
Draw as wireframe or filled triangles? Default: false.
Definition: SMaterial.h:522
src (destR, destG, destB, destA)
Definition: SMaterial.h:28
E_ZWRITE
For SMaterial.ZWriteEnable.
Definition: SMaterial.h:252
Red enabled.
Definition: SMaterial.h:93
Don't use vertex color for lighting.
Definition: SMaterial.h:217
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:128
zwrite always enabled for this material
Definition: SMaterial.h:265
Flat or Gouraud shading? Default: true.
zwrite always disabled for this material
Definition: SMaterial.h:255
Access to all layers texture wrap settings. Overwrites separate layer settings.
Is trilinear filtering enabled? Default: false.
Use vertex color alpha.
Definition: SMaterial.h:112
Use vertex color for emissive light.
Definition: SMaterial.h:223
Struct for holding parameters for a material renderer.
Definition: SMaterial.h:304
Choose maximum value of each color channel based on alpha value, not widely supported.
Definition: SMaterial.h:51
bool isAlphaBlendOperation() const
Check if material needs alpha blending.
Definition: SMaterial.h:790
f32 MaterialTypeParam
Free parameter, dependent on the material type.
Definition: SMaterial.h:437
#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:240
Is frontface culling enabled? Default: false.
src (min(srcA, 1-destA), idem, ...)
Definition: SMaterial.h:36
E_POLYGON_OFFSET
DEPRECATED. Will be removed after Irrlicht 1.9.
Definition: SMaterial.h:232
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:97
Flag for polygon offset.