arsa  2.7
Classes | Public Member Functions | Public Attributes | List of all members
irr::video::SOverrideMaterial Struct Reference

#include <SOverrideMaterial.h>

Classes

struct  SMaterialTypeReplacement
 

Public Member Functions

 SOverrideMaterial ()
 Default constructor. More...
 
void reset ()
 disable overrides and reset all flags More...
 
void apply (SMaterial &material)
 Apply the enabled overrides. More...
 

Public Attributes

SMaterial Material
 The Material values. More...
 
u32 EnableFlags
 Which values are overridden. More...
 
bool EnableLayerFlags [MATERIAL_MAX_TEXTURES]
 For those flags in EnableFlags which affect layers, set which of the layers are affected. More...
 
bool EnableTextures [MATERIAL_MAX_TEXTURES]
 Which textures are overridden. More...
 
bool EnableLayers [MATERIAL_MAX_TEXTURES]
 Overwrite complete layers (settings of EnableLayerFlags and EnableTextures don't matter then for layer data) More...
 
u16 EnablePasses
 Set in which render passes the material override is active. More...
 
bool Enabled
 Global enable flag, overwritten by the SceneManager in each pass. More...
 
core::array< SMaterialTypeReplacementMaterialTypes
 To overwrite SMaterial::MaterialType. More...
 

Detailed Description

Definition at line 15 of file SOverrideMaterial.h.

Constructor & Destructor Documentation

◆ SOverrideMaterial()

irr::video::SOverrideMaterial::SOverrideMaterial ( )
inline

Default constructor.

Definition at line 62 of file SOverrideMaterial.h.

62  : EnableFlags(0), EnablePasses(0), Enabled(false)
63  {
64  }
u32 EnableFlags
Which values are overridden.
bool Enabled
Global enable flag, overwritten by the SceneManager in each pass.
u16 EnablePasses
Set in which render passes the material override is active.

Member Function Documentation

◆ apply()

void irr::video::SOverrideMaterial::apply ( SMaterial material)
inline

Apply the enabled overrides.

Definition at line 82 of file SOverrideMaterial.h.

83  {
84  if (Enabled)
85  {
86  for (u32 i = 0; i < MaterialTypes.size(); ++i)
87  {
88  const SMaterialTypeReplacement& mtr = MaterialTypes[i];
89  if (mtr.Original < 0 || (s32)mtr.Original == material.MaterialType)
90  material.MaterialType = (E_MATERIAL_TYPE)mtr.Replacement;
91  }
92  for (u32 f=0; f<32; ++f)
93  {
94  const u32 num=(1<<f);
95  if (EnableFlags & num)
96  {
97  switch (num)
98  {
99  case EMF_WIREFRAME: material.Wireframe = Material.Wireframe; break;
100  case EMF_POINTCLOUD: material.PointCloud = Material.PointCloud; break;
101  case EMF_GOURAUD_SHADING: material.GouraudShading = Material.GouraudShading; break;
102  case EMF_LIGHTING: material.Lighting = Material.Lighting; break;
103  case EMF_ZBUFFER: material.ZBuffer = Material.ZBuffer; break;
104  case EMF_ZWRITE_ENABLE: material.ZWriteEnable = Material.ZWriteEnable; break;
105  case EMF_BACK_FACE_CULLING: material.BackfaceCulling = Material.BackfaceCulling; break;
106  case EMF_FRONT_FACE_CULLING: material.FrontfaceCulling = Material.FrontfaceCulling; break;
107  case EMF_BILINEAR_FILTER:
108  for ( u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i)
109  {
110  if ( EnableLayerFlags[i] )
111  {
112  material.TextureLayer[i].BilinearFilter = Material.TextureLayer[i].BilinearFilter;
113  }
114  }
115  break;
117  for ( u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i)
118  {
119  if ( EnableLayerFlags[i] )
120  {
121  material.TextureLayer[i].TrilinearFilter = Material.TextureLayer[i].TrilinearFilter;
122  }
123  }
124  break;
126  for ( u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i)
127  {
128  if ( EnableLayerFlags[i] )
129  {
130  material.TextureLayer[i].AnisotropicFilter = Material.TextureLayer[i].AnisotropicFilter;
131  }
132  }
133  break;
134  case EMF_FOG_ENABLE: material.FogEnable = Material.FogEnable; break;
135  case EMF_NORMALIZE_NORMALS: material.NormalizeNormals = Material.NormalizeNormals; break;
136  case EMF_TEXTURE_WRAP:
137  for ( u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i)
138  {
139  if ( EnableLayerFlags[i] )
140  {
141  material.TextureLayer[i].TextureWrapU = Material.TextureLayer[i].TextureWrapU;
142  material.TextureLayer[i].TextureWrapV = Material.TextureLayer[i].TextureWrapV;
143  material.TextureLayer[i].TextureWrapW = Material.TextureLayer[i].TextureWrapW;
144  }
145  }
146  break;
147  case EMF_ANTI_ALIASING: material.AntiAliasing = Material.AntiAliasing; break;
148  case EMF_COLOR_MASK: material.ColorMask = Material.ColorMask; break;
149  case EMF_COLOR_MATERIAL: material.ColorMaterial = Material.ColorMaterial; break;
150  case EMF_USE_MIP_MAPS: material.UseMipMaps = Material.UseMipMaps; break;
151  case EMF_BLEND_OPERATION: material.BlendOperation = Material.BlendOperation; break;
152  case EMF_BLEND_FACTOR: material.BlendFactor = Material.BlendFactor; break;
153  case EMF_POLYGON_OFFSET:
154  material.PolygonOffsetDirection = Material.PolygonOffsetDirection;
155  material.PolygonOffsetFactor = Material.PolygonOffsetFactor;
156  material.PolygonOffsetDepthBias = Material.PolygonOffsetDepthBias;
157  material.PolygonOffsetSlopeScale = Material.PolygonOffsetSlopeScale;
158  break;
159  }
160  }
161  }
162  for(u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i )
163  {
164  if ( EnableLayers[i] )
165  {
166  material.TextureLayer[i] = Material.TextureLayer[i];
167  }
168  else if ( EnableTextures[i] )
169  {
170  material.TextureLayer[i].Texture = Material.TextureLayer[i].Texture;
171  }
172  }
173  }
174  }
SMaterial Material
The Material values.
u8 ZBuffer
Is the ZBuffer enabled? Default: ECFN_LESSEQUAL.
Definition: SMaterial.h:450
Is backface culling enabled? Default: true.
u32 EnableFlags
Which values are overridden.
bool FrontfaceCulling
Is frontface culling enabled? Default: false.
Definition: SMaterial.h:542
GLuint num
Is fog enabled? Default: false.
E_MATERIAL_TYPE
Abstracted and easy to use fixed function/programmable pipeline material modes.
u8 ColorMaterial
Defines the interpretation of vertex color in the lighting equation.
Definition: SMaterial.h:470
bool PointCloud
Draw as point cloud or filled triangles? Default: false.
Definition: SMaterial.h:525
Is the ZBuffer enabled? Default: true.
bool UseMipMaps
Shall mipmaps be used if available.
Definition: SMaterial.h:553
bool TrilinearFilter
Is trilinear filtering enabled? Default: false.
u8 ColorMask
Defines the enabled color planes.
Definition: SMaterial.h:462
Flag for blend operation.
bool GouraudShading
Flat or Gouraud shading? Default: true.
Definition: SMaterial.h:528
bool EnableLayers[MATERIAL_MAX_TEXTURES]
Overwrite complete layers (settings of EnableLayerFlags and EnableTextures don't matter then for laye...
f32 PolygonOffsetDepthBias
A constant z-buffer offset for a polygon/line/point.
Definition: SMaterial.h:507
u8 TextureWrapU
Texture Clamp Mode.
bool EnableLayerFlags[MATERIAL_MAX_TEXTURES]
For those flags in EnableFlags which affect layers, set which of the layers are affected.
f32 PolygonOffsetSlopeScale
Variable Z-Buffer offset based on the slope of the polygon.
Definition: SMaterial.h:516
bool EnableTextures[MATERIAL_MAX_TEXTURES]
Which textures are overridden.
bool Enabled
Global enable flag, overwritten by the SceneManager in each pass.
ColorMaterial enum for vertex color interpretation.
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
f32 BlendFactor
Store the blend factors.
Definition: SMaterial.h:486
ColorMask bits, for enabling the color planes.
Is bilinear filtering enabled? Default: true.
signed int s32
32 bit signed variable.
Definition: irrTypes.h:70
bool BackfaceCulling
Is backface culling enabled? Default: true.
Definition: SMaterial.h:539
u8 AntiAliasing
Sets the antialiasing mode.
Definition: SMaterial.h:455
GLfloat f
Normalizes normals. Default: false.
unsigned int u32
32 bit unsigned variable.
Definition: irrTypes.h:62
ITexture * Texture
Texture.
Flag for blend factor.
u8 PolygonOffsetFactor
DEPRECATED. Will be removed after Irrlicht 1.9. Please use PolygonOffsetDepthBias instead.
Definition: SMaterial.h:493
bool NormalizeNormals
Should normals be normalized?
Definition: SMaterial.h:549
Is anisotropic filtering? Default: false.
Flag for enabling/disabling mipmap usage.
bool FogEnable
Is fog enabled? Default: false.
Definition: SMaterial.h:545
u8 AnisotropicFilter
Is anisotropic filtering enabled? Default: 0, disabled.
bool BilinearFilter
Is bilinear filtering enabled? Default: true.
May be written to the zbuffer or is it readonly. Default: true.
Will this material be lighted? Default: true.
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
E_POLYGON_OFFSET PolygonOffsetDirection
DEPRECATED. Will be removed after Irrlicht 1.9.
Definition: SMaterial.h:498
core::array< SMaterialTypeReplacement > MaterialTypes
To overwrite SMaterial::MaterialType.
bool Wireframe
Draw as wireframe or filled triangles? Default: false.
Definition: SMaterial.h:522
Flat or Gouraud shading? Default: true.
Access to all layers texture wrap settings. Overwrites separate layer settings.
Is trilinear filtering enabled? Default: false.
Draw as wireframe or filled triangles? Default: false.
Is frontface culling enabled? Default: false.
Draw as point cloud or filled triangles? Default: false.
Flag for polygon offset.

◆ reset()

void irr::video::SOverrideMaterial::reset ( )
inline

disable overrides and reset all flags

Definition at line 67 of file SOverrideMaterial.h.

68  {
69  EnableFlags = 0;
70  EnablePasses = 0;
71  Enabled = false;
72  for (u32 i = 0; i < MATERIAL_MAX_TEXTURES; ++i)
73  {
74  EnableLayerFlags[i] = true; // doesn't do anything unless EnableFlags is set, just saying by default all texture layers are affected by flags
75  EnableTextures[i] = false;
76  EnableLayers[i] = false;
77  }
78  MaterialTypes.clear();
79  }
u32 EnableFlags
Which values are overridden.
bool EnableLayers[MATERIAL_MAX_TEXTURES]
Overwrite complete layers (settings of EnableLayerFlags and EnableTextures don't matter then for laye...
bool EnableLayerFlags[MATERIAL_MAX_TEXTURES]
For those flags in EnableFlags which affect layers, set which of the layers are affected.
bool EnableTextures[MATERIAL_MAX_TEXTURES]
Which textures are overridden.
bool Enabled
Global enable flag, overwritten by the SceneManager in each pass.
const u32 MATERIAL_MAX_TEXTURES
Maximum number of texture an SMaterial can have.
Definition: SMaterial.h:283
unsigned int u32
32 bit unsigned variable.
Definition: irrTypes.h:62
u16 EnablePasses
Set in which render passes the material override is active.
core::array< SMaterialTypeReplacement > MaterialTypes
To overwrite SMaterial::MaterialType.

Member Data Documentation

◆ Enabled

bool irr::video::SOverrideMaterial::Enabled

Global enable flag, overwritten by the SceneManager in each pass.

NOTE: This is generally not set by users of the engine, but the Scenemanager uses the EnablePass array and sets Enabled to true if the Override material is enabled in the current pass. As user you generally only set EnablePasses. The exception is when rendering without SceneManager but using draw calls in the VideoDriver.

Definition at line 43 of file SOverrideMaterial.h.

◆ EnableFlags

u32 irr::video::SOverrideMaterial::EnableFlags

Which values are overridden.

OR'ed values from E_MATERIAL_FLAGS.

Definition at line 22 of file SOverrideMaterial.h.

◆ EnableLayerFlags

bool irr::video::SOverrideMaterial::EnableLayerFlags[MATERIAL_MAX_TEXTURES]

For those flags in EnableFlags which affect layers, set which of the layers are affected.

Definition at line 25 of file SOverrideMaterial.h.

◆ EnableLayers

bool irr::video::SOverrideMaterial::EnableLayers[MATERIAL_MAX_TEXTURES]

Overwrite complete layers (settings of EnableLayerFlags and EnableTextures don't matter then for layer data)

Definition at line 31 of file SOverrideMaterial.h.

◆ EnablePasses

u16 irr::video::SOverrideMaterial::EnablePasses

Set in which render passes the material override is active.

OR'ed values from E_SCENE_NODE_RENDER_PASS.

Definition at line 35 of file SOverrideMaterial.h.

◆ EnableTextures

bool irr::video::SOverrideMaterial::EnableTextures[MATERIAL_MAX_TEXTURES]

Which textures are overridden.

Definition at line 28 of file SOverrideMaterial.h.

◆ Material

SMaterial irr::video::SOverrideMaterial::Material

The Material values.

Definition at line 18 of file SOverrideMaterial.h.

◆ MaterialTypes

core::array<SMaterialTypeReplacement> irr::video::SOverrideMaterial::MaterialTypes

To overwrite SMaterial::MaterialType.

Definition at line 59 of file SOverrideMaterial.h.


The documentation for this struct was generated from the following file: