5#ifndef __S_MATERIAL_H_INCLUDED__
6#define __S_MATERIAL_H_INCLUDED__
118 const u32 tmp = (alphaSource << 12) | (modulate << 8) | (srcFact << 4) | dstFact;
127 const u32 state = IR(param);
128 alphaSource = (state & 0x0000F000) >> 12;
668 {
return !(b!=*
this); }
#define _IRR_MATERIAL_MAX_TEXTURES_
Maximum number of texture an SMaterial can have, up to 8 are supported by Irrlicht.
#define IRRLICHT_API
Set FPU settings.
4x4 matrix. Mostly used as transformation matrix for 3d calculations.
Interface of a Video Driver dependent Texture.
Class representing a 32 bit ARGB color.
Struct for holding parameters for a material renderer.
SColor EmissiveColor
Light emitted by this material. Default is to emit no light.
bool ZWriteEnable
Is the zbuffer writeable or is it read-only. Default: true.
u8 ColorMaterial
Defines the interpretation of vertex color in the lighting equation.
SColor SpecularColor
How much specular light (highlights from a light) is reflected.
SMaterialLayer TextureLayer[MATERIAL_MAX_TEXTURES]
Texture layer array.
bool isTransparent() const
bool operator==(const SMaterial &b) const
Equality operator.
const core::matrix4 & getTextureMatrix(u32 i) const
Gets the immutable texture transformation matrix for level i.
bool getFlag(E_MATERIAL_FLAG flag) const
Gets the Material flag.
f32 MaterialTypeParam2
Second free parameter, dependent on the material type.
SColor AmbientColor
How much ambient light (a global light) is reflected by this material.
void setTexture(u32 i, ITexture *tex)
Sets the i-th texture.
bool PointCloud
Draw as point cloud or filled triangles? Default: false.
void setFlag(E_MATERIAL_FLAG flag, bool value)
Sets the Material flag to the given value.
core::matrix4 & getTextureMatrix(u32 i)
Gets the texture transformation matrix for level i.
u8 ColorMask
Defines the enabled color planes.
f32 Thickness
Thickness of non-3dimensional elements such as lines and points.
SMaterial(const SMaterial &other)
Copy constructor.
void setTextureMatrix(u32 i, const core::matrix4 &mat)
Sets the i-th texture transformation matrix.
bool Wireframe
Draw as wireframe or filled triangles? Default: false.
u8 ZBuffer
Is the ZBuffer enabled? Default: ECFN_LESSEQUAL.
f32 Shininess
Value affecting the size of specular highlights.
E_MATERIAL_TYPE MaterialType
Type of the material. Specifies how everything is blended together.
u8 AntiAliasing
Sets the antialiasing mode.
bool UseMipMaps
Shall mipmaps be used if available.
SMaterial & operator=(const SMaterial &other)
Assignment operator.
bool FrontfaceCulling
Is frontface culling enabled? Default: false.
bool FogEnable
Is fog enabled? Default: false.
ITexture * getTexture(u32 i) const
Gets the i-th texture.
E_POLYGON_OFFSET PolygonOffsetDirection
Flag defining the direction the polygon offset is applied to.
bool GouraudShading
Flat or Gouraud shading? Default: true.
SColor DiffuseColor
How much diffuse light coming from a light source is reflected by this material.
SMaterial()
Default constructor. Creates a solid, lit material with white colors.
bool operator!=(const SMaterial &b) const
Inequality operator.
bool NormalizeNormals
Should normals be normalized?
f32 MaterialTypeParam
Free parameter, dependent on the material type.
bool BackfaceCulling
Is backface culling enabled? Default: true.
u8 PolygonOffsetFactor
Factor specifying how far the polygon offset should be made.
E_BLEND_OPERATION BlendOperation
Store the blend operation of choice.
bool Lighting
Will this material be lighted? Default: true.
Struct for holding material parameters which exist per texture layer.
void setTextureMatrix(const core::matrix4 &mat)
Sets the texture transformation matrix to mat.
bool BilinearFilter
Is bilinear filtering enabled? Default: true.
core::matrix4 & getTextureMatrix()
Gets the texture transformation matrix.
bool TrilinearFilter
Is trilinear filtering enabled? Default: false.
u8 AnisotropicFilter
Is anisotropic filtering enabled? Default: 0, disabled.
ITexture * Texture
Texture.
u8 TextureWrapU
Texture Clamp Mode.
IRRLICHT_API const matrix4 IdentityMatrix
global const identity matrix
E_ALPHA_SOURCE
Source of the alpha value to take.
@ EAS_NONE
Use no alpha, somewhat redundant with other settings.
@ EAS_VERTEX_COLOR
Use vertex color alpha.
@ EAS_TEXTURE
Use texture alpha channel.
E_MODULATE_FUNC
MaterialTypeParam: e.g. DirectX: D3DTOP_MODULATE, D3DTOP_MODULATE2X, D3DTOP_MODULATE4X.
E_COLOR_MATERIAL
These flags allow to define the interpretation of vertex color when lighting is enabled.
@ ECM_NONE
Don't use vertex color for lighting.
@ ECM_EMISSIVE
Use vertex color for emissive light.
@ ECM_DIFFUSE_AND_AMBIENT
Use vertex color for both diffuse and ambient light.
@ ECM_SPECULAR
Use vertex color for specular light.
@ ECM_DIFFUSE
Use vertex color for diffuse light, this is default.
@ ECM_AMBIENT
Use vertex color for ambient light.
const c8 *const PolygonOffsetDirectionNames[]
Names for polygon offset direction.
E_TEXTURE_CLAMP
Texture coord clamp mode outside [0.0, 1.0].
bool textureBlendFunc_hasAlpha(const E_BLEND_FACTOR factor)
EMT_ONETEXTURE_BLEND: has BlendFactor Alphablending.
IRRLICHT_API SMaterial IdentityMaterial
global const identity Material
void unpack_textureBlendFunc(E_BLEND_FACTOR &srcFact, E_BLEND_FACTOR &dstFact, E_MODULATE_FUNC &modulo, u32 &alphaSource, const f32 param)
EMT_ONETEXTURE_BLEND: unpack srcFact & dstFact and Modulo to MaterialTypeParam.
E_BLEND_OPERATION
Values defining the blend operation used when blend is enabled.
@ EBO_NONE
No blending happens.
@ EBO_MIN
Choose minimum value of each color channel.
@ EBO_REVSUBTRACT
This modes subtracts destination from source.
@ EBO_MIN_FACTOR
Choose minimum value of each color channel after applying blend factors, not widely supported.
@ EBO_SUBTRACT
This mode subtracts the color values.
@ EBO_MAX_ALPHA
Choose maximum value of each color channel based on alpha value, not widely supported.
@ EBO_MAX_FACTOR
Choose maximum value of each color channel after applying blend factors, not widely supported.
@ EBO_ADD
Default blending adds the color values.
@ EBO_MIN_ALPHA
Choose minimum value of each color channel based on alpha value, not widely supported.
@ EBO_MAX
Choose maximum value of each color channel.
E_POLYGON_OFFSET
Flags for the definition of the polygon offset feature.
@ EPO_BACK
Push pixel towards the far plane, away from the eye.
@ EPO_FRONT
Pull pixels towards the camera.
E_MATERIAL_FLAG
Material flags.
@ EMF_FRONT_FACE_CULLING
Is frontface culling enabled? Default: false.
@ EMF_POINTCLOUD
Draw as point cloud or filled triangles? Default: false.
@ EMF_NORMALIZE_NORMALS
Normalizes normals. Default: false.
@ EMF_ZBUFFER
Is the ZBuffer enabled? Default: true.
@ EMF_ZWRITE_ENABLE
May be written to the zbuffer or is it readonly. Default: true.
@ EMF_FOG_ENABLE
Is fog enabled? Default: false.
@ EMF_COLOR_MASK
ColorMask bits, for enabling the color planes.
@ EMF_TRILINEAR_FILTER
Is trilinear filtering enabled? Default: false.
@ EMF_TEXTURE_WRAP
Access to all layers texture wrap settings. Overwrites separate layer settings.
@ EMF_COLOR_MATERIAL
ColorMaterial enum for vertex color interpretation.
@ EMF_GOURAUD_SHADING
Flat or Gouraud shading? Default: true.
@ EMF_USE_MIP_MAPS
Flag for enabling/disabling mipmap usage.
@ EMF_ANISOTROPIC_FILTER
Is anisotropic filtering? Default: false.
@ EMF_ANTI_ALIASING
AntiAliasing mode.
@ EMF_BLEND_OPERATION
Flag for blend operation.
@ EMF_WIREFRAME
Draw as wireframe or filled triangles? Default: false.
@ EMF_POLYGON_OFFSET
Flag for polygon offset.
@ EMF_LIGHTING
Will this material be lighted? Default: true.
@ EMF_BACK_FACE_CULLING
Is backface culling enabled? Default: true.
@ EMF_BILINEAR_FILTER
Is bilinear filtering enabled? Default: true.
E_ANTI_ALIASING_MODE
These flags are used to specify the anti-aliasing and smoothing modes.
@ EAAM_SIMPLE
Default anti-aliasing mode.
@ EAAM_QUALITY
High-quality anti-aliasing, not always supported, automatically enables SIMPLE mode.
@ EAAM_LINE_SMOOTH
Line smoothing.
@ EAAM_POINT_SMOOTH
point smoothing, often in software and slow, only with OpenGL
@ EAAM_OFF
Use to turn off anti-aliasing for this material.
@ EAAM_ALPHA_TO_COVERAGE
Enhanced anti-aliasing for transparent materials.
@ EAAM_FULL_BASIC
All typical anti-alias and smooth modes.
E_COLOR_PLANE
Enum values for enabling/disabling color planes for rendering.
@ ECP_GREEN
Green enabled.
@ ECP_RGB
All colors, no alpha.
@ ECP_ALL
All planes enabled.
@ ECP_NONE
No color enabled.
@ ECP_ALPHA
Alpha enabled.
E_MATERIAL_TYPE
Abstracted and easy to use fixed function/programmable pipeline material modes.
@ EMT_TRANSPARENT_ADD_COLOR
A transparent material.
@ EMT_TRANSPARENT_VERTEX_ALPHA
Makes the material transparent based on the vertex alpha value.
@ EMT_TRANSPARENT_REFLECTION_2_LAYER
A transparent reflecting material with an optional additional non reflecting texture layer.
@ EMT_SOLID
Standard solid material.
@ EMT_TRANSPARENT_ALPHA_CHANNEL
Makes the material transparent based on the texture alpha channel.
E_BLEND_FACTOR
Flag for EMT_ONETEXTURE_BLEND, ( BlendFactor ) BlendFunc = source * sourceFactor + dest * destFactor.
@ EBF_ONE_MINUS_DST_COLOR
src (1-destR, 1-destG, 1-destB, 1-destA)
@ EBF_SRC_ALPHA_SATURATE
src (min(srcA, 1-destA), idem, ...)
@ EBF_SRC_ALPHA
src & dest (srcA, srcA, srcA, srcA)
@ EBF_ONE
src & dest (1, 1, 1, 1)
@ EBF_ONE_MINUS_DST_ALPHA
src & dest (1-destA, 1-destA, 1-destA, 1-destA)
@ EBF_SRC_COLOR
dest (srcR, srcG, srcB, srcA)
@ EBF_DST_ALPHA
src & dest (destA, destA, destA, destA)
@ EBF_ZERO
src & dest (0, 0, 0, 0)
@ EBF_ONE_MINUS_SRC_ALPHA
src & dest (1-srcA, 1-srcA, 1-srcA, 1-srcA)
@ EBF_DST_COLOR
src (destR, destG, destB, destA)
@ EBF_ONE_MINUS_SRC_COLOR
dest (1-srcR, 1-srcG, 1-srcB, 1-srcA)
const u32 MATERIAL_MAX_TEXTURES
Maximum number of texture an SMaterial can have.
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)
EMT_ONETEXTURE_BLEND: pack srcFact, dstFact, Modulate and alpha source to MaterialTypeParam.
E_COMPARISON_FUNC
Comparison function, e.g. for depth buffer test.
@ ECFN_LESS
exclusive less comparison, i.e. <
@ ECFN_GREATER
inverse of <=
@ ECFN_GREATEREQUAL
>= test
@ ECFN_NEVER
Test never succeeds, this equals disable.
@ ECFN_LESSEQUAL
<= test, default for e.g. depth test
@ ECFN_ALWAYS
test succeeds always
@ ECFN_EQUAL
Exact equality.
@ ECFN_NOTEQUAL
Succeeds almost always, except for exact equality.
Everything in the Irrlicht Engine can be found in this namespace.
float f32
32 bit floating point variable.
unsigned int u32
32 bit unsigned variable.
unsigned char u8
8 bit unsigned variable.
char c8
8 bit character variable.