Nirtcpp 2.1.0
Nirtcpp is a high-performance c++ graphics engine.
Loading...
Searching...
No Matches
SMaterial.hpp
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 nirtcpp/nirtcpp.hpp
4
5#ifndef S_MATERIAL_HPP_INCLUDED
6#define S_MATERIAL_HPP_INCLUDED
7
8#include <nirtcpp/core/engine/SColor.hpp>
9#include <nirtcpp/core/engine/matrix4.hpp>
10#include <nirtcpp/core/engine/irrArray.hpp>
11#include <nirtcpp/core/engine/irrMath.hpp>
12#include <nirtcpp/core/engine/EMaterialTypes.hpp>
13#include <nirtcpp/core/engine/EMaterialFlags.hpp>
14#include <nirtcpp/core/engine/SMaterialLayer.hpp>
15
16namespace nirt
17{
18namespace video
19{
20 class ITexture;
21
38
53
56 {
57 EMFN_MODULATE_1X = 1,
58 EMFN_MODULATE_2X = 2,
59 EMFN_MODULATE_4X = 4
60 };
61
84
103
105
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
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
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
206
208
229
231
233 {
235
238
240 EPO_FRONT=1
241 };
242
245 {
246 "Back",
247 "Front",
248 0
249 };
250
253 {
256
263
265 EZW_ON
266 };
267
269 const c8* const ZWriteNames[] =
270 {
271 "Off",
272 "Auto",
273 "On",
274 0
275 };
276
277
278
280
283 const u32 MATERIAL_MAX_TEXTURES = _NIRT_MATERIAL_MAX_TEXTURES_;
284
286
299 NIRTCPP_API extern u32 MATERIAL_MAX_TEXTURES_USED;
300
302 // Note for implementors: Serialization is in CNullDriver
304 {
305 public:
319
322
325
327
331
333
335
338
340
343
345
375
377
380
382
384
387
389
393
395
398
400
405
407
413
415
417
419
429
431
438
440
447
449
454
456
459
461
464 bool Wireframe:1;
465
468
471
473 bool Lighting:1;
474
476
479
482
485
487 bool FogEnable:1;
488
490
492
494
496
498
504
506
509 {
511 return TextureLayer[i].getTextureMatrix();
512 else
514 }
515
517
520 {
522 return;
524 }
525
527
530 {
531 return i < MATERIAL_MAX_TEXTURES ? TextureLayer[i].Texture : 0;
532 }
533
535
538 void setTexture(u32 i, ITexture* tex)
539 {
541 return;
542 TextureLayer[i].Texture = tex;
543 }
544
546
548 void setFlag(E_MATERIAL_FLAG flag, bool value)
549 {
550 switch (flag)
551 {
552 case EMF_WIREFRAME:
553 Wireframe = value; break;
554 case EMF_POINTCLOUD:
555 PointCloud = value; break;
557 GouraudShading = value; break;
558 case EMF_LIGHTING:
559 Lighting = value; break;
560 case EMF_ZBUFFER:
561 ZBuffer = value; break;
563 ZWriteEnable = value ? EZW_AUTO : EZW_OFF; break;
565 BackfaceCulling = value; break;
567 FrontfaceCulling = value; break;
569 {
570 for (u32 i=0; i<MATERIAL_MAX_TEXTURES_USED; ++i)
571 TextureLayer[i].BilinearFilter = value;
572 }
573 break;
575 {
576 for (u32 i=0; i<MATERIAL_MAX_TEXTURES_USED; ++i)
577 TextureLayer[i].TrilinearFilter = value;
578 }
579 break;
581 {
582 if (value)
583 for (u32 i=0; i<MATERIAL_MAX_TEXTURES_USED; ++i)
584 TextureLayer[i].AnisotropicFilter = 0xFF;
585 else
586 for (u32 i=0; i<MATERIAL_MAX_TEXTURES_USED; ++i)
587 TextureLayer[i].AnisotropicFilter = 0;
588 }
589 break;
590 case EMF_FOG_ENABLE:
591 FogEnable = value; break;
593 NormalizeNormals = value; break;
594 case EMF_TEXTURE_WRAP:
595 {
596 for (u32 i=0; i<MATERIAL_MAX_TEXTURES_USED; ++i)
597 {
599 TextureLayer[i].TextureWrapV = (E_TEXTURE_CLAMP)value;
600 TextureLayer[i].TextureWrapW = (E_TEXTURE_CLAMP)value;
601 }
602 }
603 break;
605 AntiAliasing = value?EAAM_SIMPLE:EAAM_OFF; break;
606 case EMF_COLOR_MASK:
607 ColorMask = value?ECP_ALL:ECP_NONE; break;
609 ColorMaterial = value?ECM_DIFFUSE:ECM_NONE; break;
610 case EMF_USE_MIP_MAPS:
611 UseMipMaps = value; break;
613 BlendOperation = value?EBO_ADD:EBO_NONE; break;
614 case EMF_BLEND_FACTOR:
615 break;
617 PolygonOffsetFactor = value?1:0;
619 PolygonOffsetSlopeScale = value?1.f:0.f;
620 PolygonOffsetDepthBias = value?1.f:0.f;
621 break;
622 default:
623 break;
624 }
625 }
626
628
630 bool getFlag(E_MATERIAL_FLAG flag) const
631 {
632 switch (flag)
633 {
634 case EMF_WIREFRAME:
635 return Wireframe;
636 case EMF_POINTCLOUD:
637 return PointCloud;
639 return GouraudShading;
640 case EMF_LIGHTING:
641 return Lighting;
642 case EMF_ZBUFFER:
643 return ZBuffer!=ECFN_DISABLED;
645 return ZWriteEnable != EZW_OFF;
647 return BackfaceCulling;
649 return FrontfaceCulling;
655 return TextureLayer[0].AnisotropicFilter!=0;
656 case EMF_FOG_ENABLE:
657 return FogEnable;
659 return NormalizeNormals;
660 case EMF_TEXTURE_WRAP:
661 return !(TextureLayer[0].TextureWrapU ||
662 TextureLayer[0].TextureWrapV ||
663 TextureLayer[0].TextureWrapW);
665 return (AntiAliasing==1);
666 case EMF_COLOR_MASK:
667 return (ColorMask!=ECP_NONE);
669 return (ColorMaterial != ECM_NONE);
670 case EMF_USE_MIP_MAPS:
671 return UseMipMaps;
673 return BlendOperation != EBO_NONE;
674 case EMF_BLEND_FACTOR:
675 return BlendFactor != 0.f;
677 return PolygonOffsetFactor != 0 || PolygonOffsetDepthBias != 0.f;
678 }
679
680 return false;
681 }
682
684
686 inline bool operator!=(const SMaterial& b) const
687 {
688 bool different =
694 Shininess != b.Shininess ||
697 Thickness != b.Thickness ||
698 Wireframe != b.Wireframe ||
699 PointCloud != b.PointCloud ||
701 Lighting != b.Lighting ||
702 ZBuffer != b.ZBuffer ||
706 FogEnable != b.FogEnable ||
709 ColorMask != b.ColorMask ||
718 ;
719 for (u32 i=0; (i<MATERIAL_MAX_TEXTURES_USED) && !different; ++i)
720 {
721 different |= (TextureLayer[i] != b.TextureLayer[i]);
722 }
723 return different;
724 }
725
727
729 inline bool operator==(const SMaterial& b) const
730 { return !(b!=*this); }
731
734 {
735 if (BlendOperation != EBO_NONE && BlendFactor != 0.f)
736 {
737 E_BLEND_FACTOR srcRGBFact = EBF_ZERO;
738 E_BLEND_FACTOR dstRGBFact = EBF_ZERO;
739 E_BLEND_FACTOR srcAlphaFact = EBF_ZERO;
740 E_BLEND_FACTOR dstAlphaFact = EBF_ZERO;
741 E_MODULATE_FUNC modulo = EMFN_MODULATE_1X;
742 u32 alphaSource = 0;
743
744 unpack_textureBlendFuncSeparate(srcRGBFact, dstRGBFact, srcAlphaFact, dstAlphaFact, modulo, alphaSource, BlendFactor);
745
746 if (textureBlendFunc_hasAlpha(srcRGBFact) || textureBlendFunc_hasAlpha(dstRGBFact) ||
747 textureBlendFunc_hasAlpha(srcAlphaFact) || textureBlendFunc_hasAlpha(dstAlphaFact))
748 {
749 return true;
750 }
751 }
752 return false;
753 }
754
768 };
769
771 NIRTCPP_API extern SMaterial IdentityMaterial;
772} // end namespace video
773} // end namespace nirt
774
775#endif
4x4 matrix. Mostly used as transformation matrix for 3d calculations.
Definition matrix4.hpp:49
Interface of a Video Driver dependent Texture.
Definition ITexture.hpp:186
Class representing a 32 bit ARGB color.
Definition SColor.hpp:317
Class for holding material parameters which exist per texture layer.
Definition SMaterialLayer.hpp:50
bool TrilinearFilter
Is trilinear filtering enabled? Default: false.
Definition SMaterialLayer.hpp:199
ITexture * Texture
Texture.
Definition SMaterialLayer.hpp:185
u8 TextureWrapU
Texture Clamp Mode.
Definition SMaterialLayer.hpp:189
u8 AnisotropicFilter
Is anisotropic filtering enabled? Default: 0, disabled.
Definition SMaterialLayer.hpp:208
void setTextureMatrix(const core::matrix4 &mat)
Sets the texture transformation matrix to mat.
Definition SMaterialLayer.hpp:145
core::matrix4 & getTextureMatrix()
Gets the texture transformation matrix.
Definition SMaterialLayer.hpp:121
bool BilinearFilter
Is bilinear filtering enabled? Default: true.
Definition SMaterialLayer.hpp:194
Class for holding parameters for a material renderer.
Definition SMaterial.hpp:304
bool UseMipMaps
Shall mipmaps be used if available.
Definition SMaterial.hpp:495
f32 PolygonOffsetDepthBias
A constant z-buffer offset for a polygon/line/point.
Definition SMaterial.hpp:437
bool PointCloud
Draw as point cloud or filled triangles? Default: false.
Definition SMaterial.hpp:467
SColor DiffuseColor
How much diffuse light coming from a light source is reflected by this material.
Definition SMaterial.hpp:334
bool operator!=(const SMaterial &b) const
Inequality operator.
Definition SMaterial.hpp:686
bool isAlphaBlendOperation() const
Check if material needs alpha blending.
Definition SMaterial.hpp:733
bool Wireframe
Draw as wireframe or filled triangles? Default: false.
Definition SMaterial.hpp:464
bool getFlag(E_MATERIAL_FLAG flag) const
Gets the Material flag.
Definition SMaterial.hpp:630
void setFlag(E_MATERIAL_FLAG flag, bool value)
Sets the Material flag to the given value.
Definition SMaterial.hpp:548
void setTexture(u32 i, ITexture *tex)
Sets the i-th texture.
Definition SMaterial.hpp:538
f32 Thickness
Thickness of non-3dimensional elements such as lines and points.
Definition SMaterial.hpp:386
bool NormalizeNormals
Should normals be normalized?
Definition SMaterial.hpp:491
SMaterial()
Default constructor. Creates a solid, lit material with white colors.
Definition SMaterial.hpp:307
E_BLEND_OPERATION BlendOperation
Store the blend operation of choice.
Definition SMaterial.hpp:416
f32 MaterialTypeParam2
Second free parameter, dependent on the material type.
Definition SMaterial.hpp:383
u8 AntiAliasing
Sets the antialiasing mode.
Definition SMaterial.hpp:397
bool GouraudShading
Flat or Gouraud shading? Default: true.
Definition SMaterial.hpp:470
bool BackfaceCulling
Is backface culling enabled? Default: true.
Definition SMaterial.hpp:481
SColor AmbientColor
How much ambient light (a global light) is reflected by this material.
Definition SMaterial.hpp:330
SColor EmissiveColor
Light emitted by this material. Default is to emit no light.
Definition SMaterial.hpp:337
bool isTransparent() const
Definition SMaterial.hpp:758
u8 ColorMaterial
Defines the interpretation of vertex color in the lighting equation.
Definition SMaterial.hpp:412
E_ZWRITE ZWriteEnable
Is the zbuffer writable or is it read-only. Default: EZW_AUTO.
Definition SMaterial.hpp:478
ITexture * getTexture(u32 i) const
Gets the i-th texture.
Definition SMaterial.hpp:529
SMaterialLayer TextureLayer[MATERIAL_MAX_TEXTURES]
Texture layer array.
Definition SMaterial.hpp:321
f32 BlendFactor
Store the blend factors.
Definition SMaterial.hpp:428
E_POLYGON_OFFSET PolygonOffsetDirection
DEPRECATED. Will be removed after Nirtcpp 1.9.
Definition SMaterial.hpp:458
u8 ZBuffer
Is the ZBuffer enabled? Default: ECFN_LESSEQUAL.
Definition SMaterial.hpp:392
bool FrontfaceCulling
Is frontface culling enabled? Default: false.
Definition SMaterial.hpp:484
bool Lighting
Will this material be lighted? Default: true.
Definition SMaterial.hpp:473
core::matrix4 & getTextureMatrix(u32 i)
Gets the texture transformation matrix for level i.
Definition SMaterial.hpp:500
f32 Shininess
Value affecting the size of specular highlights.
Definition SMaterial.hpp:374
E_MATERIAL_TYPE MaterialType
Type of the material. Specifies how everything is blended together.
Definition SMaterial.hpp:324
bool operator==(const SMaterial &b) const
Equality operator.
Definition SMaterial.hpp:729
SColor SpecularColor
How much specular light (highlights from a light) is reflected.
Definition SMaterial.hpp:342
u8 PolygonOffsetFactor
DEPRECATED. Will be removed after Nirtcpp 1.9. Please use PolygonOffsetDepthBias instead.
Definition SMaterial.hpp:453
f32 MaterialTypeParam
Free parameter, dependent on the material type.
Definition SMaterial.hpp:379
f32 PolygonOffsetSlopeScale
Variable Z-Buffer offset based on the slope of the polygon.
Definition SMaterial.hpp:446
void setTextureMatrix(u32 i, const core::matrix4 &mat)
Sets the i-th texture transformation matrix.
Definition SMaterial.hpp:519
u8 ColorMask
Defines the enabled color planes.
Definition SMaterial.hpp:404
bool FogEnable
Is fog enabled? Default: false.
Definition SMaterial.hpp:487
const core::matrix4 & getTextureMatrix(u32 i) const
Gets the immutable texture transformation matrix for level i.
Definition SMaterial.hpp:508
NIRTCPP_API const matrix4 IdentityMatrix
global const identity matrix
const c8 *const ZWriteNames[]
Names for E_ZWRITE.
Definition SMaterial.hpp:269
E_MATERIAL_FLAG
Material flags.
Definition EMaterialFlags.hpp:15
@ EMF_GOURAUD_SHADING
Flat or Gouraud shading? Default: true.
Definition EMaterialFlags.hpp:23
@ EMF_FOG_ENABLE
Is fog enabled? Default: false.
Definition EMaterialFlags.hpp:58
@ EMF_TEXTURE_WRAP
Access to all layers texture wrap settings. Overwrites separate layer settings.
Definition EMaterialFlags.hpp:72
@ EMF_POINTCLOUD
Draw as point cloud or filled triangles? Default: false.
Definition EMaterialFlags.hpp:20
@ EMF_ZWRITE_ENABLE
May be written to the zbuffer or is it readonly. Default: true.
Definition EMaterialFlags.hpp:33
@ EMF_POLYGON_OFFSET
Flag for polygon offset.
Definition EMaterialFlags.hpp:90
@ EMF_COLOR_MASK
ColorMask bits, for enabling the color planes.
Definition EMaterialFlags.hpp:78
@ EMF_USE_MIP_MAPS
Flag for enabling/disabling mipmap usage.
Definition EMaterialFlags.hpp:84
@ EMF_TRILINEAR_FILTER
Is trilinear filtering enabled? Default: false.
Definition EMaterialFlags.hpp:48
@ EMF_BLEND_FACTOR
Flag for blend factor.
Definition EMaterialFlags.hpp:93
@ EMF_BACK_FACE_CULLING
Is backface culling enabled? Default: true.
Definition EMaterialFlags.hpp:36
@ EMF_BILINEAR_FILTER
Is bilinear filtering enabled? Default: true.
Definition EMaterialFlags.hpp:43
@ EMF_BLEND_OPERATION
Flag for blend operation.
Definition EMaterialFlags.hpp:87
@ EMF_WIREFRAME
Draw as wireframe or filled triangles? Default: false.
Definition EMaterialFlags.hpp:17
@ EMF_NORMALIZE_NORMALS
Normalizes normals. Default: false.
Definition EMaterialFlags.hpp:66
@ EMF_LIGHTING
Will this material be lighted? Default: true.
Definition EMaterialFlags.hpp:26
@ EMF_ZBUFFER
Is the ZBuffer enabled? Default: true.
Definition EMaterialFlags.hpp:29
@ EMF_FRONT_FACE_CULLING
Is frontface culling enabled? Default: false.
Definition EMaterialFlags.hpp:40
@ EMF_COLOR_MATERIAL
ColorMaterial enum for vertex color interpretation.
Definition EMaterialFlags.hpp:81
@ EMF_ANISOTROPIC_FILTER
Is anisotropic filtering? Default: false.
Definition EMaterialFlags.hpp:55
@ EMF_ANTI_ALIASING
AntiAliasing mode.
Definition EMaterialFlags.hpp:75
E_ANTI_ALIASING_MODE
These flags are used to specify the anti-aliasing and smoothing modes.
Definition SMaterial.hpp:188
@ EAAM_ALPHA_TO_COVERAGE
Enhanced anti-aliasing for transparent materials.
Definition SMaterial.hpp:204
@ EAAM_SIMPLE
Default anti-aliasing mode.
Definition SMaterial.hpp:192
@ EAAM_LINE_SMOOTH
Definition SMaterial.hpp:197
@ EAAM_FULL_BASIC
All typical anti-alias and smooth modes.
Definition SMaterial.hpp:201
@ EAAM_QUALITY
High-quality anti-aliasing, not always supported, automatically enables SIMPLE mode.
Definition SMaterial.hpp:194
@ EAAM_OFF
Use to turn off anti-aliasing for this material.
Definition SMaterial.hpp:190
@ EAAM_POINT_SMOOTH
point smoothing, often in software and slow, only with OpenGL
Definition SMaterial.hpp:199
E_TEXTURE_CLAMP
Texture coord clamp mode outside [0.0, 1.0].
Definition SMaterialLayer.hpp:19
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.hpp:150
E_ALPHA_SOURCE
Source of the alpha value to take.
Definition SMaterial.hpp:108
@ EAS_VERTEX_COLOR
Use vertex color alpha.
Definition SMaterial.hpp:112
@ EAS_TEXTURE
Use texture alpha channel.
Definition SMaterial.hpp:114
@ EAS_NONE
Use no alpha, somewhat redundant with other settings.
Definition SMaterial.hpp:110
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.hpp:138
E_MODULATE_FUNC
MaterialTypeParam: e.g. DirectX: D3DTOP_MODULATE, D3DTOP_MODULATE2X, D3DTOP_MODULATE4X.
Definition SMaterial.hpp:56
bool textureBlendFunc_hasAlpha(const E_BLEND_FACTOR factor)
has blend factor alphablending
Definition SMaterial.hpp:164
E_COLOR_PLANE
Enum values for enabling/disabling color planes for rendering.
Definition SMaterial.hpp:87
@ ECP_ALL
All planes enabled.
Definition SMaterial.hpp:101
@ ECP_RGB
All colors, no alpha.
Definition SMaterial.hpp:99
@ ECP_NONE
No color enabled.
Definition SMaterial.hpp:89
@ ECP_RED
Red enabled.
Definition SMaterial.hpp:93
@ ECP_GREEN
Green enabled.
Definition SMaterial.hpp:95
@ ECP_ALPHA
Alpha enabled.
Definition SMaterial.hpp:91
@ ECP_BLUE
Blue enabled.
Definition SMaterial.hpp:97
E_POLYGON_OFFSET
DEPRECATED. Will be removed after Nirtcpp 1.9.
Definition SMaterial.hpp:233
@ EPO_BACK
Push pixel towards the far plane, away from the eye.
Definition SMaterial.hpp:236
@ EPO_FRONT
Pull pixels towards the camera.
Definition SMaterial.hpp:240
E_BLEND_FACTOR
Definition SMaterial.hpp:25
@ EBF_ONE_MINUS_DST_ALPHA
src & dest (1-destA, 1-destA, 1-destA, 1-destA)
Definition SMaterial.hpp:35
@ EBF_ZERO
src & dest (0, 0, 0, 0)
Definition SMaterial.hpp:26
@ EBF_ONE_MINUS_SRC_COLOR
dest (1-srcR, 1-srcG, 1-srcB, 1-srcA)
Definition SMaterial.hpp:31
@ EBF_SRC_COLOR
dest (srcR, srcG, srcB, srcA)
Definition SMaterial.hpp:30
@ EBF_DST_ALPHA
src & dest (destA, destA, destA, destA)
Definition SMaterial.hpp:34
@ EBF_DST_COLOR
src (destR, destG, destB, destA)
Definition SMaterial.hpp:28
@ EBF_ONE_MINUS_DST_COLOR
src (1-destR, 1-destG, 1-destB, 1-destA)
Definition SMaterial.hpp:29
@ EBF_SRC_ALPHA
src & dest (srcA, srcA, srcA, srcA)
Definition SMaterial.hpp:32
@ EBF_ONE_MINUS_SRC_ALPHA
src & dest (1-srcA, 1-srcA, 1-srcA, 1-srcA)
Definition SMaterial.hpp:33
@ EBF_ONE
src & dest (1, 1, 1, 1)
Definition SMaterial.hpp:27
@ EBF_SRC_ALPHA_SATURATE
src (min(srcA, 1-destA), idem, ...)
Definition SMaterial.hpp:36
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.hpp:119
const c8 *const PolygonOffsetDirectionNames[]
Names for polygon offset direction.
Definition SMaterial.hpp:244
E_ZWRITE
For SMaterial.ZWriteEnable.
Definition SMaterial.hpp:253
@ EZW_ON
zwrite always enabled for this material
Definition SMaterial.hpp:265
@ EZW_OFF
zwrite always disabled for this material
Definition SMaterial.hpp:255
@ EZW_AUTO
Definition SMaterial.hpp:262
NIRTCPP_API SMaterial IdentityMaterial
global const identity Material
const u32 MATERIAL_MAX_TEXTURES
Maximum number of texture an SMaterial can have.
Definition SMaterial.hpp:283
NIRTCPP_API u32 MATERIAL_MAX_TEXTURES_USED
By default this is identical to MATERIAL_MAX_TEXTURES.
E_COMPARISON_FUNC
Comparison function, e.g. for depth buffer test.
Definition SMaterial.hpp:64
@ ECFN_GREATER
inverse of <=
Definition SMaterial.hpp:78
@ ECFN_ALWAYS
test succeeds always
Definition SMaterial.hpp:80
@ ECFN_EQUAL
Exact equality.
Definition SMaterial.hpp:70
@ ECFN_DISABLED
Depth test disabled (disable also write to depth buffer)
Definition SMaterial.hpp:66
@ ECFN_LESSEQUAL
<= test, default for e.g. depth test
Definition SMaterial.hpp:68
@ ECFN_NEVER
Test never succeeds.
Definition SMaterial.hpp:82
@ ECFN_NOTEQUAL
Succeeds almost always, except for exact equality.
Definition SMaterial.hpp:74
@ ECFN_LESS
exclusive less comparison, i.e. <
Definition SMaterial.hpp:72
@ ECFN_GREATEREQUAL
>= test
Definition SMaterial.hpp:76
E_BLEND_OPERATION
Values defining the blend operation.
Definition SMaterial.hpp:41
@ EBO_REVSUBTRACT
This modes subtracts destination from source.
Definition SMaterial.hpp:45
@ EBO_SUBTRACT
This mode subtracts the color values.
Definition SMaterial.hpp:44
@ EBO_MAX_FACTOR
Choose maximum value of each color channel after applying blend factors, not widely supported.
Definition SMaterial.hpp:49
@ EBO_MIN_FACTOR
Choose minimum value of each color channel after applying blend factors, not widely supported.
Definition SMaterial.hpp:48
@ EBO_MAX_ALPHA
Choose maximum value of each color channel based on alpha value, not widely supported.
Definition SMaterial.hpp:51
@ EBO_ADD
Default blending adds the color values.
Definition SMaterial.hpp:43
@ EBO_MIN_ALPHA
Choose minimum value of each color channel based on alpha value, not widely supported.
Definition SMaterial.hpp:50
@ EBO_MIN
Choose minimum value of each color channel.
Definition SMaterial.hpp:46
@ EBO_NONE
No blending happens.
Definition SMaterial.hpp:42
@ EBO_MAX
Choose maximum value of each color channel.
Definition SMaterial.hpp:47
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.hpp:128
E_COLOR_MATERIAL
These flags allow to define the interpretation of vertex color when lighting is enabled.
Definition SMaterial.hpp:215
@ ECM_AMBIENT
Use vertex color for ambient light.
Definition SMaterial.hpp:221
@ ECM_DIFFUSE
Use vertex color for diffuse light, this is default.
Definition SMaterial.hpp:219
@ ECM_SPECULAR
Use vertex color for specular light.
Definition SMaterial.hpp:225
@ ECM_EMISSIVE
Use vertex color for emissive light.
Definition SMaterial.hpp:223
@ ECM_DIFFUSE_AND_AMBIENT
Use vertex color for both diffuse and ambient light.
Definition SMaterial.hpp:227
@ ECM_NONE
Don't use vertex color for lighting.
Definition SMaterial.hpp:217
E_MATERIAL_TYPE
Abstracted and easy to use fixed function/programmable pipeline material modes.
Definition EMaterialTypes.hpp:15
@ EMT_TRANSPARENT_VERTEX_ALPHA
Makes the material transparent based on the vertex alpha value.
Definition EMaterialTypes.hpp:116
@ EMT_TRANSPARENT_ALPHA_CHANNEL
Makes the material transparent based on the texture alpha channel.
Definition EMaterialTypes.hpp:101
@ EMT_SOLID
Standard solid material.
Definition EMaterialTypes.hpp:19
@ EMT_TRANSPARENT_ADD_COLOR
A transparent material.
Definition EMaterialTypes.hpp:88
@ EMT_TRANSPARENT_REFLECTION_2_LAYER
A transparent reflecting material with an optional additional non reflecting texture layer.
Definition EMaterialTypes.hpp:122
As of Nirtcpp 1.6, position2d is a synonym for vector2d.
Definition vector3d.hpp:11
unsigned char u8
8 bit unsigned variable.
Definition irrTypes.hpp:24
unsigned int u32
32 bit unsigned variable.
Definition irrTypes.hpp:64
char c8
8 bit character variable.
Definition irrTypes.hpp:37
float f32
32 bit floating point variable.
Definition irrTypes.hpp:110

Nirtcpp    @cppfx.xyz

Esvcpp    esv::print