|
|
|
|
Documentation |
|
Main Page Namespace List Class Hierarchy Alphabetical List Compound List File List Namespace Members Compound Members File Members Related Pages Search
NL3D::CMaterial Class ReferenceA material represent ALL the states relatives to the aspect of a primitive.
More...
#include <material.h>
Inheritance diagram for NL3D::CMaterial:
List of all members.
Public Types |
typedef std::vector< CLightMap > | TTexturePtrs |
enum | ZFunc {
always = 0,
never,
equal,
notequal,
less,
lessequal,
greater,
greaterequal,
zfuncCount
} |
enum | TBlend {
one = 0,
zero,
srcalpha,
invsrcalpha,
srccolor,
invsrccolor,
blendConstantColor,
blendConstantInvColor,
blendConstantAlpha,
blendConstantInvAlpha,
blendCount
} |
| Blend enums. More...
|
enum | TShader {
Normal = 0,
Bump,
UserColor,
LightMap,
Specular,
Caustics,
PerPixelLighting,
PerPixelLightingNoSpec,
Cloud,
shaderCount
} |
| Normal shader: use simple multitexturing. More...
|
|
enum | TTexOperator {
Replace = 0,
Modulate,
Add,
AddSigned,
InterpolateTexture,
InterpolatePrevious,
InterpolateDiffuse,
InterpolateConstant,
EMBM
} |
| Environements operators: Replace: out= arg0 Modulate: out= arg0 * arg1 Add: out= arg0 + arg1 AddSigned: out= arg0 + arg1 -0.5 Interpolate*: out= arg0*As + arg1*(1-As), where As is taken from the SrcAlpha of Texture/Previous/Diffuse/Constant, respectively if operator is InterpolateTexture/InterpolatePrevious/InterpolateDiffuse/InterpolateConstant. More...
|
enum | TTexSource { Texture = 0,
Previous,
Diffuse,
Constant
} |
| Source argument. More...
|
enum | TTexOperand { SrcColor = 0,
InvSrcColor,
SrcAlpha,
InvSrcAlpha
} |
| Operand for the argument. More...
|
|
All modes are not supported everywhere, so you should check for it in the driver.
The modes are similar to those introduced with DirectX 8.0 Pixel Shaders and OpenGL TEXTURE_SHADERS_NV
|
enum | TTexAddressingMode {
TextureOff = 0,
FetchTexture,
PassThrough,
CullFragment,
OffsetTexture,
OffsetTextureScale,
DependentARTexture,
DependentGBTexture,
DP3,
DP3Texture2D,
DP3CubeMap,
DP3ReflectCubeMap,
DP3ConstEyeReflectCubeMap,
DP3DiffuseCubeMap,
DP3DepthReplace,
TexAddrCount
} |
Public Methods |
void | setShader (TShader val) |
| Set the shader for this material. More...
|
TShader | getShader () const |
| get the current material shadertype. More...
|
bool | getStainedGlassWindow () |
void | setStainedGlassWindow (bool val) |
void | flushTextures (IDriver &driver) |
| Flush textures. Force texture generation. More...
|
void | serial (NLMISC::IStream &f) |
uint32 | getFlags () const |
uint32 | getTouched (void) const |
void | clearTouched (uint32 flag) |
|
| CMaterial () |
| ctor. More...
|
| CMaterial (const CMaterial &mat) |
| see operator=. More...
|
| ~CMaterial () |
| dtor. More...
|
CMaterial & | operator= (const CMaterial &mat) |
| Do not copy DrvInfos, copy all infos and set IDRV_TOUCHED_ALL. More...
|
|
void | setTexture (uint8 stage, ITexture *ptex) |
| set a texture for a special stage. More...
|
ITexture * | getTexture (uint8 stage) const |
bool | texturePresent (uint8 stage) const |
|
void | setBlend (bool active) |
void | setBlendFunc (TBlend src, TBlend dst) |
void | setSrcBlend (TBlend val) |
void | setDstBlend (TBlend val) |
bool | getBlend () const |
TBlend | getSrcBlend (void) const |
TBlend | getDstBlend (void) const |
|
void | enableTexAddrMode (bool enable=true) |
| enable / disable the use of special texture addressing modes When enabled, all texture addressing modes are set to 'None'. More...
|
bool | texAddrEnabled () const |
| test whether texture addressing mode are enabled. More...
|
void | setTexAddressingMode (uint8 stage, TTexAddressingMode mode) |
| Set a texture addressing mode for the given stage. More...
|
TTexAddressingMode | getTexAddressingMode (uint8 stage) |
| Get the texture addressing mode for the given stage. More...
|
|
void | setDoubleSided (bool active) |
bool | getDoubleSided () const |
|
void | setAlphaTest (bool active) |
bool | getAlphaTest () const |
void | setAlphaTestThreshold (float thre) |
| change the threshold against alpha is tested. More...
|
float | getAlphaTestThreshold () const |
|
void | setZFunc (ZFunc val) |
void | setZWrite (bool active) |
void | setZBias (float val) |
| The z bias is a z dispacement of the object to solve z precision problem. The bias is gived in world coordinate units. Positive bias give a lower z priority, negative bias give a higher bias priority. More...
|
ZFunc | getZFunc (void) const |
bool | getZWrite (void) const |
float | getZBias (void) const |
|
void | setColor (CRGBA rgba) |
| The Color is used only if lighting is disabled. Also, color is replaced by per vertex color (if any). More...
|
void | setLighting (bool active, CRGBA emissive=CRGBA(0, 0, 0), CRGBA ambient=CRGBA(0, 0, 0), CRGBA diffuse=CRGBA(0, 0, 0), CRGBA specular=CRGBA(0, 0, 0), float shininess=10) |
| Batch setup lighting. Opacity is in diffuse.A. More...
|
void | setEmissive (CRGBA emissive=CRGBA(0, 0, 0)) |
| Set the emissive part ot material. Usefull only if setLighting(true) has been done. More...
|
void | setAmbient (CRGBA ambient=CRGBA(0, 0, 0)) |
| Set the Ambient part ot material. Usefull only if setLighting(true) has been done. More...
|
void | setDiffuse (CRGBA diffuse=CRGBA(0, 0, 0)) |
| Set the Diffuse part ot material. Usefull only if setLighting(true) has been done. NB: opacity is NOT copied from diffuse.A. More...
|
void | setOpacity (uint8 opa) |
| Set the Opacity part ot material. Usefull only if setLighting(true) has been done. More...
|
void | setSpecular (CRGBA specular=CRGBA(0, 0, 0)) |
| Set the specular part ot material. Usefull only if setLighting(true) has been done. More...
|
void | setShininess (float shininess) |
| Set the shininess part ot material. Usefull only if setLighting(true) has been done. More...
|
void | setLightedVertexColor (bool useLightedVertexColor) |
| Set the color material flag. Used when the material is lighted. True to use the diffuse color of the material when lighted, false to use the color vertex. More...
|
bool | getLightedVertexColor () const |
| Get the lighted vertex color flag. More...
|
bool | isLighted () const |
bool | isLightedVertexColor () const |
| Return true if this material uses color material as diffuse when lighted, else return false if it uses color vertex. More...
|
CRGBA | getColor (void) const |
CRGBA | getEmissive () const |
CRGBA | getAmbient () const |
CRGBA | getDiffuse () const |
| return diffuse part. NB: A==opacity. More...
|
uint8 | getOpacity () const |
CRGBA | getSpecular () const |
float | getShininess () const |
|
void | texEnvOpRGB (uint stage, TTexOperator ope) |
void | texEnvArg0RGB (uint stage, TTexSource src, TTexOperand oper) |
void | texEnvArg1RGB (uint stage, TTexSource src, TTexOperand oper) |
void | texEnvOpAlpha (uint stage, TTexOperator ope) |
void | texEnvArg0Alpha (uint stage, TTexSource src, TTexOperand oper) |
void | texEnvArg1Alpha (uint stage, TTexSource src, TTexOperand oper) |
void | texConstantColor (uint stage, CRGBA color) |
| Setup the constant color for a stage. Used for the TTexSource:Constant. More...
|
uint32 | getTexEnvMode (uint stage) |
| For push/pop only, get the packed version of the environnment mode. More...
|
void | setTexEnvMode (uint stage, uint32 packed) |
| For push/pop only, set the packed version of the environnment mode. More...
|
CRGBA | getTexConstantColor (uint stage) |
void | setTexCoordGen (uint stage, bool generate) |
bool | getTexCoordGen (uint stage) const |
void | enableUserTexMat (uint stage, bool enabled=true) |
bool | isUserTexMatEnabled (uint stage) const |
void | setUserTexMat (uint stage, const NLMISC::CMatrix &m) |
| Set a new texture matrix for the given stage. More...
|
const NLMISC::CMatrix & | getUserTexMat (uint stage) const |
| Get a const ref. More...
|
void | decompUserTexMat (uint stage, float &uTrans, float &vTrans, float &wRot, float &uScale, float &vScale) |
| Decompose a user texture matrix, We assume that this is only a matrix for 2d texture. More...
|
|
void | setUserColor (CRGBA userColor) |
CRGBA | getUserColor () const |
|
void | setLightMap (uint lmapId, ITexture *lmap) |
| Set the ith lightmap. undef results if holes in lightmap array. More...
|
ITexture * | getLightMap (uint lmapId) const |
| Get the ith lightmap. (NULl if none). More...
|
void | setLightMapFactor (uint lmapId, CRGBA factor) |
| Set the lightmap intensity. (default to 255). More...
|
|
void | initUnlit () |
| Init the material as unlit. More...
|
void | initLighted () |
| Init the material as default white lighted material. More...
|
|
void | selectTextureSet (uint index) |
| Select one texture set for all the textures of this material. More...
|
Public Attributes |
uint8 | _TexAddrMode [IDRV_MAT_MAXTEXTURES] |
CTexEnv | _TexEnvs [IDRV_MAT_MAXTEXTURES] |
CRefPtr< IShader > | pShader |
TTexturePtrs | _LightMaps |
Private Attributes |
TShader | _ShaderType |
uint32 | _Flags |
TBlend | _SrcBlend |
TBlend | _DstBlend |
ZFunc | _ZFunction |
float | _ZBias |
CRGBA | _Color |
CRGBA | _Emissive |
CRGBA | _Ambient |
CRGBA | _Diffuse |
CRGBA | _Specular |
float | _Shininess |
float | _AlphaTestThreshold |
uint32 | _Touched |
bool | _StainedGlassWindow |
std::auto_ptr< CUserTexMat > | _TexUserMat |
CSmartPtr< ITexture > | _Textures [IDRV_MAT_MAXTEXTURES] |
Detailed Description
A material represent ALL the states relatives to the aspect of a primitive.
Definition at line 115 of file material.h.
Member Typedef Documentation
typedef std::vector<CLightMap> NL3D::CMaterial::TTexturePtrs
|
|
Member Enumeration Documentation
enum NL3D::CMaterial::TBlend
|
|
enum NL3D::CMaterial::TShader
|
|
|
Normal shader: use simple multitexturing.
- see texEnv*() methods. Bump:
- not implemented yet. UserColor:
- UserColor (see setUserColor()) is blended with precomputed texture/textureAlpha.
- Alpha Blending ignore Alpha of texture (of course :) ), but use Alpha diffuse (vertex/material color). LightMap:
- Texture of stage 0 is blended with sum of lightmaps (see setLightmap()). Vertex Color (or color, or lighting) doesn't affect the final result (neither diffuse part nor specular part). Blending is special. If enabled, Lightmap shader apply a standard transparency srcalpha/invsrcalpha.
- NB: if no texture in stage 0, undefined result.
- UV0 is the UV for decal Texture. UV1 is the UVs for all the lightmaps. Specular:
- Texture of stage 0 is added to the multiplication of Texture Alpha of stage 0 and Texture of stage 1
- This is done in 2 passes PerPixelLighting :
- When not supported by the driver, this is equivalent to the normal shader. This can be querried from the driver
- When supported by the driver, the strongest light is rendered using per pixel lighting. The last tex coordinate must be the S vector of the tangent space basis (oriented in the direction where the s texture coords grows). Other lights are rendered using gouraud shaing. The light setup is done in the driver. PerPixelLighting : The same as PerPixelLighting but with no specular Caustics: NOT IMPLEMENTED Cloud :
- Alpha of texture in stage 0 is blended with alpha of texture in stage 1. Blend done with the alpha color of each stage and the whole is multiplied by the alpha in color vertex [AT0*ADiffuseCol+AT1*(1-ADiffuseCol)]*AStage
-
Enumeration values:
-
Normal |
|
Bump |
|
UserColor |
|
LightMap |
|
Specular |
|
Caustics |
|
PerPixelLighting |
|
PerPixelLightingNoSpec |
|
Cloud |
|
shaderCount |
|
Definition at line 157 of file material.h.
Referenced by getShader. |
enum NL3D::CMaterial::TTexAddressingMode
|
|
|
-
Enumeration values:
-
TextureOff |
|
FetchTexture |
|
PassThrough |
|
CullFragment |
|
OffsetTexture |
|
OffsetTextureScale |
|
DependentARTexture |
|
DependentGBTexture |
|
DP3 |
|
DP3Texture2D |
|
DP3CubeMap |
|
DP3ReflectCubeMap |
|
DP3ConstEyeReflectCubeMap |
|
DP3DiffuseCubeMap |
|
DP3DepthReplace |
|
TexAddrCount |
|
Definition at line 208 of file material.h. |
enum NL3D::CMaterial::TTexOperand
|
|
|
Operand for the argument.
For Alpha arguments, only SrcAlpha and InvSrcAlpha are Valid!!
SrcColor: arg= ColorSource. InvSrcColor: arg= 1-ColorSource. SrcAlpha: arg= AlphaSource. InvSrcAlpha: arg= 1-AlphaSource. -
Enumeration values:
-
SrcColor |
|
InvSrcColor |
|
SrcAlpha |
|
InvSrcAlpha |
|
Definition at line 199 of file material.h. |
enum NL3D::CMaterial::TTexOperator
|
|
|
Environements operators: Replace: out= arg0 Modulate: out= arg0 * arg1 Add: out= arg0 + arg1 AddSigned: out= arg0 + arg1 -0.5 Interpolate*: out= arg0*As + arg1*(1-As), where As is taken from the SrcAlpha of Texture/Previous/Diffuse/Constant, respectively if operator is InterpolateTexture/InterpolatePrevious/InterpolateDiffuse/InterpolateConstant.
EMBM : apply to both color and alpha : the current texture, whose format is DSDT, is used to offset the texture in the next stage. NB : for EMBM and InterpolateConstant, this must be supported by driver. -
Enumeration values:
-
Replace |
|
Modulate |
|
Add |
|
AddSigned |
|
InterpolateTexture |
|
InterpolatePrevious |
|
InterpolateDiffuse |
|
InterpolateConstant |
|
EMBM |
|
Definition at line 181 of file material.h. |
enum NL3D::CMaterial::TTexSource
|
|
|
Source argument.
Texture: the arg is taken from the current texture of the stage. Previous: the arg is taken from the previous enabled stage. If stage 0, Previous==Diffuse. Diffuse: the arg is taken from the primary color vertex. Constant: the arg is taken from the constant color setuped for this texture stage. -
Enumeration values:
-
Texture |
|
Previous |
|
Diffuse |
|
Constant |
|
Definition at line 190 of file material.h. |
enum NL3D::CMaterial::ZFunc
|
|
|
-
Enumeration values:
-
always |
|
never |
|
equal |
|
notequal |
|
less |
|
lessequal |
|
greater |
|
greaterequal |
|
zfuncCount |
|
Definition at line 119 of file material.h.
Referenced by getZFunc. |
Constructor & Destructor Documentation
NL3D::CMaterial::CMaterial |
( |
|
) |
|
|
|
ctor.
By default, shader is normal, SrcBlend is srcalpha, dstblend is invsrcalpha, ZFunction is lessequal, ZBias is 0, Color is White: (255,255,255,255), not double sided.
Definition at line 41 of file material.cpp.
References _AlphaTestThreshold, _Color, _DstBlend, _Flags, _ShaderType, _SrcBlend, _StainedGlassWindow, _Touched, _ZBias, _ZFunction, NL3D::IDRV_MAT_ZWRITE, invsrcalpha, lessequal, Normal, and srcalpha.
Referenced by CMaterial. |
NL3D::CMaterial::CMaterial |
( |
const CMaterial & |
mat |
) |
[inline] |
|
NL3D::CMaterial::~CMaterial |
( |
|
) |
|
|
Member Function Documentation
void NL3D::CMaterial::clearTouched |
( |
uint32 |
flag |
) |
[inline] |
|
void NL3D::CMaterial::decompUserTexMat |
( |
uint |
stage, |
|
|
float & |
uTrans, |
|
|
float & |
vTrans, |
|
|
float & |
wRot, |
|
|
float & |
uScale, |
|
|
float & |
vScale |
|
) |
|
|
|
Decompose a user texture matrix, We assume that this is only a matrix for 2d texture.
Definition at line 461 of file material.cpp.
References _TexUserMat, NLMISC::CMatrix::getI, NLMISC::CMatrix::getJ, NLMISC::CMatrix::getPos, NL3D::IDRV_MAT_MAXTEXTURES, isUserTexMatEnabled, nlassert, NLMISC::CVector::norm, NLMISC::CVector::x, and NLMISC::CVector::y. |
void NL3D::CMaterial::enableTexAddrMode |
( |
bool |
enable = true |
) |
|
|
void NL3D::CMaterial::enableUserTexMat |
( |
uint |
stage, |
|
|
bool |
enabled = true |
|
) |
[inline] |
|
void NL3D::CMaterial::flushTextures |
( |
IDriver & |
driver |
) |
|
|
bool NL3D::CMaterial::getAlphaTest |
( |
|
) |
const [inline] |
|
float NL3D::CMaterial::getAlphaTestThreshold |
( |
|
) |
const [inline] |
|
CRGBA NL3D::CMaterial::getAmbient |
( |
|
) |
const [inline] |
|
bool NL3D::CMaterial::getBlend |
( |
|
) |
const [inline] |
|
CRGBA NL3D::CMaterial::getColor |
( |
void |
|
) |
const [inline] |
|
CRGBA NL3D::CMaterial::getDiffuse |
( |
|
) |
const [inline] |
|
bool NL3D::CMaterial::getDoubleSided |
( |
|
) |
const [inline] |
|
TBlend NL3D::CMaterial::getDstBlend |
( |
void |
|
) |
const [inline] |
|
CRGBA NL3D::CMaterial::getEmissive |
( |
|
) |
const [inline] |
|
uint32 NL3D::CMaterial::getFlags |
( |
|
) |
const [inline] |
|
bool NL3D::CMaterial::getLightedVertexColor |
( |
|
) |
const [inline] |
|
ITexture * NL3D::CMaterial::getLightMap |
( |
uint |
lmapId |
) |
const |
|
uint8 NL3D::CMaterial::getOpacity |
( |
|
) |
const [inline] |
|
TShader NL3D::CMaterial::getShader |
( |
|
) |
const [inline] |
|
float NL3D::CMaterial::getShininess |
( |
|
) |
const [inline] |
|
CRGBA NL3D::CMaterial::getSpecular |
( |
|
) |
const [inline] |
|
TBlend NL3D::CMaterial::getSrcBlend |
( |
void |
|
) |
const [inline] |
|
bool NL3D::CMaterial::getStainedGlassWindow |
( |
|
) |
[inline] |
|
CRGBA NL3D::CMaterial::getTexConstantColor |
( |
uint |
stage |
) |
[inline] |
|
bool NL3D::CMaterial::getTexCoordGen |
( |
uint |
stage |
) |
const [inline] |
|
uint32 NL3D::CMaterial::getTexEnvMode |
( |
uint |
stage |
) |
[inline] |
|
ITexture * NL3D::CMaterial::getTexture |
( |
uint8 |
stage |
) |
const [inline] |
|
uint32 NL3D::CMaterial::getTouched |
( |
void |
|
) |
const [inline] |
|
CRGBA NL3D::CMaterial::getUserColor |
( |
|
) |
const [inline] |
|
float NL3D::CMaterial::getZBias |
( |
void |
|
) |
const [inline] |
|
ZFunc NL3D::CMaterial::getZFunc |
( |
void |
|
) |
const [inline] |
|
bool NL3D::CMaterial::getZWrite |
( |
void |
|
) |
const [inline] |
|
void NL3D::CMaterial::initLighted |
( |
|
) |
|
|
|
Init the material as default white lighted material.
normal shader, lighting .... Default to: normal shader, full black lighting, no texture, ZBias=0, ZFunc= lessequal, ZWrite==true, no blend. All other states are undefined (such as blend function, since blend is disabled).
Definition at line 73 of file material.cpp.
References initUnlit, and setLighting. |
void NL3D::CMaterial::initUnlit |
( |
|
) |
|
|
|
Init the material as unlit.
normal shader, no lighting .... Default to: normal shader, no lighting, color to White(1,1,1,1), no texture, ZBias=0, ZFunc= lessequal, ZWrite==true, no blend. All other states are undefined (such as blend function, since blend is disabled).
Definition at line 57 of file material.cpp.
References NL3D::IDRV_MAT_MAXTEXTURES, lessequal, Normal, setAlphaTestThreshold, setBlend, setColor, setLighting, setShader, setTexture, setZBias, setZFunc, and setZWrite.
Referenced by NL3D::CCloudScape::CCloudScape, NL3D::CNoise3d::init, initLighted, NL3D::SCloudTexture3D::SCloudTexture3D, and NL3D::SCloudTextureClamp::SCloudTextureClamp. |
bool NL3D::CMaterial::isLighted |
( |
|
) |
const [inline] |
|
bool NL3D::CMaterial::isLightedVertexColor |
( |
|
) |
const [inline] |
|
bool NL3D::CMaterial::isUserTexMatEnabled |
( |
uint |
stage |
) |
const [inline] |
|
CMaterial & NL3D::CMaterial::operator= |
( |
const CMaterial & |
mat |
) |
|
|
|
Do not copy DrvInfos, copy all infos and set IDRV_TOUCHED_ALL.
Definition at line 81 of file material.cpp.
References _AlphaTestThreshold, _Ambient, _Color, _Diffuse, _DstBlend, _Emissive, _Flags, _LightMaps, _ShaderType, _Shininess, _Specular, _SrcBlend, _TexAddrMode, _TexEnvs, _Textures, _TexUserMat, _Touched, _ZBias, _ZFunction, NL3D::IDRV_MAT_MAXTEXTURES, and NL3D::IDRV_TOUCHED_ALL.
Referenced by CMaterial. |
void NL3D::CMaterial::selectTextureSet |
( |
uint |
index |
) |
|
|
|
Definition at line 136 of file material.cpp.
References _AlphaTestThreshold, _Ambient, _Color, _Diffuse, _DstBlend, _Emissive, _Flags, _LightMaps, _ShaderType, _Shininess, _Specular, _SrcBlend, _TexAddrMode, _TexEnvs, _Textures, _TexUserMat, _Touched, _ZBias, _ZFunction, NL3D::IDRV_MAT_DEFMAT, NL3D::IDRV_MAT_MAXTEXTURES, NL3D::IDRV_MAT_TEX_ADDR, NL3D::IDRV_MAT_USER_TEX_MAT_ALL, NL3D::IDRV_TOUCHED_ALL, NLMISC::IStream::isReading, isUserTexMatEnabled, nlassert, NLMISC::IStream::serial, NLMISC::IStream::serialCont, NLMISC::IStream::serialEnum, NLMISC::IStream::serialPolyPtr, NLMISC::IStream::serialVersion, setAmbient, NL3D::CMaterial::CTexEnv::setDefault, setDiffuse, setEmissive, and setSpecular. |
void NL3D::CMaterial::setAlphaTest |
( |
bool |
active |
) |
[inline] |
|
void NL3D::CMaterial::setAlphaTestThreshold |
( |
float |
thre |
) |
[inline] |
|
void NL3D::CMaterial::setAmbient |
( |
CRGBA |
ambient = CRGBA(0, 0, 0) |
) |
[inline] |
|
void NL3D::CMaterial::setBlend |
( |
bool |
active |
) |
[inline] |
|
void NL3D::CMaterial::setBlendFunc |
( |
TBlend |
src, |
|
|
TBlend |
dst |
|
) |
[inline] |
|
void NL3D::CMaterial::setColor |
( |
CRGBA |
rgba |
) |
[inline] |
|
void NL3D::CMaterial::setDiffuse |
( |
CRGBA |
diffuse = CRGBA(0, 0, 0) |
) |
[inline] |
|
void NL3D::CMaterial::setDoubleSided |
( |
bool |
active |
) |
[inline] |
|
void NL3D::CMaterial::setDstBlend |
( |
TBlend |
val |
) |
[inline] |
|
void NL3D::CMaterial::setEmissive |
( |
CRGBA |
emissive = CRGBA(0, 0, 0) |
) |
[inline] |
|
void NL3D::CMaterial::setLightedVertexColor |
( |
bool |
useLightedVertexColor |
) |
[inline] |
|
void NL3D::CMaterial::setLighting |
( |
bool |
active, |
|
|
CRGBA |
emissive = CRGBA(0, 0, 0), |
|
|
CRGBA |
ambient = CRGBA(0, 0, 0), |
|
|
CRGBA |
diffuse = CRGBA(0, 0, 0), |
|
|
CRGBA |
specular = CRGBA(0, 0, 0), |
|
|
float |
shininess = 10 |
|
) |
[inline] |
|
void NL3D::CMaterial::setLightMap |
( |
uint |
lmapId, |
|
|
ITexture * |
lmap |
|
) |
|
|
void NL3D::CMaterial::setLightMapFactor |
( |
uint |
lmapId, |
|
|
CRGBA |
factor |
|
) |
|
|
void NL3D::CMaterial::setOpacity |
( |
uint8 |
opa |
) |
[inline] |
|
void NL3D::CMaterial::setShader |
( |
TShader |
val |
) |
|
|
|
Set the shader for this material.
All textures are reseted!!
Definition at line 257 of file material.cpp.
References _ShaderType, _Touched, Constant, Diffuse, NL3D::IDRV_MAT_MAXTEXTURES, NL3D::IDRV_TOUCHED_SHADER, InterpolateTexture, LightMap, Modulate, Previous, Replace, setTexture, SrcAlpha, SrcColor, texEnvArg0Alpha, texEnvArg0RGB, texEnvArg1RGB, texEnvOpAlpha, texEnvOpRGB, Texture, and UserColor.
Referenced by NL3D::CCloudScape::CCloudScape, NL3D::CNoise3d::init, initUnlit, NL3D::SCloudTexture3D::SCloudTexture3D, and NL3D::SCloudTextureClamp::SCloudTextureClamp. |
void NL3D::CMaterial::setShininess |
( |
float |
shininess |
) |
[inline] |
|
void NL3D::CMaterial::setSpecular |
( |
CRGBA |
specular = CRGBA(0, 0, 0) |
) |
[inline] |
|
void NL3D::CMaterial::setSrcBlend |
( |
TBlend |
val |
) |
[inline] |
|
void NL3D::CMaterial::setStainedGlassWindow |
( |
bool |
val |
) |
[inline] |
|
void NL3D::CMaterial::setTexCoordGen |
( |
uint |
stage, |
|
|
bool |
generate |
|
) |
[inline] |
|
void NL3D::CMaterial::setTexEnvMode |
( |
uint |
stage, |
|
|
uint32 |
packed |
|
) |
[inline] |
|
void NL3D::CMaterial::setTexture |
( |
uint8 |
stage, |
|
|
ITexture * |
ptex |
|
) |
|
|
void NL3D::CMaterial::setUserColor |
( |
CRGBA |
userColor |
) |
[inline] |
|
void NL3D::CMaterial::setZBias |
( |
float |
val |
) |
[inline] |
|
void NL3D::CMaterial::setZFunc |
( |
ZFunc |
val |
) |
[inline] |
|
void NL3D::CMaterial::setZWrite |
( |
bool |
active |
) |
[inline] |
|
bool NL3D::CMaterial::texAddrEnabled |
( |
|
) |
const |
|
void NL3D::CMaterial::texConstantColor |
( |
uint |
stage, |
|
|
CRGBA |
color |
|
) |
[inline] |
|
|
Definition at line 247 of file driver_material_inline.h.
References _ShaderType, _TexEnvs, NL3D::CMaterial::CTexEnv::Env, NL3D::IDRV_MAT_MAXTEXTURES, InvSrcAlpha, nlassert, src, and SrcAlpha.
Referenced by NL3D::CCloudScape::CCloudScape, NL3D::SCloudTexture3D::SCloudTexture3D, NL3D::SCloudTextureClamp::SCloudTextureClamp, and setShader. |
|
It maps the EXT_texture_env_combine opengl extension. A stage is enabled if his texture is !=NULL. By default, all stages are setup to Modulate style: AlphaOp=RGBOp= Modulate, RGBArg0= TextureSrcColor, RGBArg1= PreviousSrcColor, AlphaArg0= TextureSrcAlpha, AlphaArg1= PreviousSrcAlpha. ConstantColor default to White(255,255,255,255).
For compatibility problems:
- no scaling is allowed (some cards do not implement this well).
- Texture can be the source only for Arg0 (DirectX restriction). nlassert...
NB: for Alpha Aguments, only operands SrcAlpha and InvSrcAlpha are valid (nlassert..).
Definition at line 214 of file driver_material_inline.h.
References _ShaderType, _TexEnvs, NL3D::CMaterial::CTexEnv::Env, NL3D::IDRV_MAT_MAXTEXTURES, and nlassert.
Referenced by NL3D::CCloudScape::CCloudScape, NL3D::SCloudTexture3D::SCloudTexture3D, and setShader. |
bool NL3D::CMaterial::texturePresent |
( |
uint8 |
stage |
) |
const [inline] |
|
Member Data Documentation
float NL3D::CMaterial::_AlphaTestThreshold [private]
|
|
CRGBA NL3D::CMaterial::_Ambient [private]
|
|
CRGBA NL3D::CMaterial::_Color [private]
|
|
CRGBA NL3D::CMaterial::_Diffuse [private]
|
|
TBlend NL3D::CMaterial::_DstBlend [private]
|
|
CRGBA NL3D::CMaterial::_Emissive [private]
|
|
uint32 NL3D::CMaterial::_Flags [private]
|
|
|
Definition at line 548 of file material.h.
Referenced by CMaterial, enableTexAddrMode, enableUserTexMat, getAlphaTest, getBlend, getDoubleSided, getFlags, getLightedVertexColor, getTexAddressingMode, getTexCoordGen, getZWrite, isLighted, isLightedVertexColor, isUserTexMatEnabled, operator=, serial, setAlphaTest, setBlend, setDoubleSided, setLightedVertexColor, setLighting, setTexAddressingMode, setTexCoordGen, setZWrite, and texAddrEnabled. |
TShader NL3D::CMaterial::_ShaderType [private]
|
|
|
Definition at line 547 of file material.h.
Referenced by CMaterial, flushTextures, getLightMap, getShader, getTexConstantColor, getTexEnvMode, getUserColor, operator=, serial, setLightMap, setLightMapFactor, setShader, setTexEnvMode, setTexture, setUserColor, texConstantColor, texEnvArg0Alpha, texEnvArg0RGB, texEnvArg1Alpha, texEnvArg1RGB, texEnvOpAlpha, and texEnvOpRGB. |
float NL3D::CMaterial::_Shininess [private]
|
|
CRGBA NL3D::CMaterial::_Specular [private]
|
|
TBlend NL3D::CMaterial::_SrcBlend [private]
|
|
bool NL3D::CMaterial::_StainedGlassWindow [private]
|
|
|
Definition at line 568 of file material.h.
Referenced by getTexConstantColor, getTexEnvMode, getUserColor, operator=, serial, setTexEnvMode, setUserColor, texConstantColor, texEnvArg0Alpha, texEnvArg0RGB, texEnvArg1Alpha, texEnvArg1RGB, texEnvOpAlpha, and texEnvOpRGB. |
std::auto_ptr<CUserTexMat> NL3D::CMaterial::_TexUserMat [private]
|
|
uint32 NL3D::CMaterial::_Touched [private]
|
|
|
Definition at line 556 of file material.h.
Referenced by clearTouched, CMaterial, operator=, serial, setAlphaTest, setAlphaTestThreshold, setAmbient, setBlend, setBlendFunc, setColor, setDiffuse, setDoubleSided, setDstBlend, setEmissive, setLightedVertexColor, setLighting, setLightMap, setLightMapFactor, setOpacity, setShader, setShininess, setSpecular, setSrcBlend, setTexture, setZBias, setZFunc, and setZWrite. |
float NL3D::CMaterial::_ZBias [private]
|
|
ZFunc NL3D::CMaterial::_ZFunction [private]
|
|
CRefPtr<IShader> NL3D::CMaterial::pShader
|
|
The documentation for this class was generated from the following files:
|
|