NL3D::UMaterial Class Reference

Game Interface for Material. More...

#include <u_material.h>

List of all members.

Public Types

enum  ZFunc {
  always = 0, never, equal, notequal,
  less, lessequal, greater, greaterequal,
  zfuncCount
}
enum  TBlend {
  one = 0, zero, srcalpha, invsrcalpha,
  srccolor, invsrccolor, blendCount
}
Texture Env Modes.



enum  TTexOperator {
  Replace = 0, Modulate, Add, AddSigned,
  InterpolateTexture, InterpolatePrevious, InterpolateDiffuse, InterpolateConstant,
  EMBM, Mad
}
 

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...

Public Member Functions

 UMaterial ()
 Proxy interface.
 UMaterial (class CMaterial *object)
void attach (class CMaterial *object)
 Attach an object to this proxy.
void detach ()
 Detach the object.
bool empty () const
 Return true if the proxy is empty() (not attached).
class CMaterialgetObjectPtr () const
 For advanced usage, get the internal object ptr.
Texture.



void setTexture (uint stage, UTexture *ptex)
bool texturePresent (uint stage)
void selectTextureSet (uint id)
 select from a texture set for this material (if available)
void setTexture (UTexture *ptex)
bool texturePresent ()
Blending.



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
Texture environnement.



void texEnvOpRGB (uint stage, TTexOperator ope)
void texEnvArg0RGB (uint stage, TTexSource src, TTexOperand oper)
void texEnvArg1RGB (uint stage, TTexSource src, TTexOperand oper)
void texEnvArg2RGB (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 texEnvArg2Alpha (uint stage, TTexSource src, TTexOperand oper)
ZBuffer.



void setZFunc (ZFunc val)
void setZWrite (bool active)
void setZBias (float val)
ZFunc getZFunc (void) const
bool getZWrite (void) const
float getZBias (void) const
Alpha test.



void setAlphaTest (bool active)
bool getAlphaTest () const
void setAlphaTestThreshold (float threshold)
 change the threshold against alpha is tested.
float getAlphaTestThreshold () const
Color/Lighting..



void setColor (CRGBA rgba)
 The Color is used only if lighting is disabled. Also, color is replaced by per vertex color (if any).
CRGBA getColor (void) const
Lighted material mgt. Relevant only if isLighted(). Used for get of UShape



bool isLighted () const
CRGBA getEmissive () const
CRGBA getAmbient () const
CRGBA getDiffuse () const
 return diffuse part. NB: A==opacity.
uint8 getOpacity () const
CRGBA getSpecular () const
float getShininess () const
Culling



void setDoubleSided (bool doubleSided=true)
bool getDoubleSided () const
Misc



void initUnlit ()
 Init the material as unlit.
bool isSupportedByDriver (UDriver &drv, bool forceBaseCaps=false)

Private Attributes

CMaterial_Object

Detailed Description

Game Interface for Material.

Material for gamers are Unlighted materials!! Only normal material unlighted is supported.

Author:
Lionel Berenguier
Nevrax France
Date:
2001

Definition at line 48 of file u_material.h.


Member Enumeration Documentation

Enumerator:
one 
zero 
srcalpha 
invsrcalpha 
srccolor 
invsrccolor 
blendCount 

Definition at line 52 of file u_material.h.

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.

Enumerator:
SrcColor 
InvSrcColor 
SrcAlpha 
InvSrcAlpha 

Definition at line 86 of file u_material.h.

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.

Multiply-Add (Mad) out= arg0 * arg1 + arg2. Must be supported by driver 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.

Enumerator:
Replace 
Modulate 
Add 
AddSigned 
InterpolateTexture 
InterpolatePrevious 
InterpolateDiffuse 
InterpolateConstant 
EMBM 
Mad 

Definition at line 68 of file u_material.h.

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.

Enumerator:
Texture 
Previous 
Diffuse 
Constant 

Definition at line 77 of file u_material.h.

Enumerator:
always 
never 
equal 
notequal 
less 
lessequal 
greater 
greaterequal 
zfuncCount 

Definition at line 51 of file u_material.h.


Constructor & Destructor Documentation

NL3D::UMaterial::UMaterial (  )  [inline]

Proxy interface.

Constructors

Definition at line 199 of file u_material.h.

References _Object.

NL3D::UMaterial::UMaterial ( class CMaterial object  )  [inline]

Definition at line 200 of file u_material.h.

References _Object.


Member Function Documentation

void NL3D::UMaterial::attach ( class CMaterial object  )  [inline]

Attach an object to this proxy.

Definition at line 202 of file u_material.h.

References _Object.

Referenced by NL3D::CDriverUser::setDisplay().

void NL3D::UMaterial::detach (  )  [inline]

Detach the object.

Definition at line 204 of file u_material.h.

References _Object.

Referenced by NL3D::CDriverUser::deleteMaterial().

bool NL3D::UMaterial::empty (  )  const [inline]

Return true if the proxy is empty() (not attached).

Definition at line 206 of file u_material.h.

References _Object.

Referenced by NL3D::CBloomEffect::~CBloomEffect().

bool NL3D::UMaterial::getAlphaTest (  )  const

Definition at line 54 of file u_material.cpp.

References getObjectPtr().

float NL3D::UMaterial::getAlphaTestThreshold (  )  const

Definition at line 70 of file u_material.cpp.

References getObjectPtr().

CRGBA NL3D::UMaterial::getAmbient (  )  const

Definition at line 345 of file u_material.cpp.

References getObjectPtr().

bool NL3D::UMaterial::getBlend (  )  const

Definition at line 157 of file u_material.cpp.

References getObjectPtr().

CRGBA NL3D::UMaterial::getColor ( void   )  const

Definition at line 301 of file u_material.cpp.

References getObjectPtr().

CRGBA NL3D::UMaterial::getDiffuse (  )  const

return diffuse part. NB: A==opacity.

Definition at line 351 of file u_material.cpp.

References getObjectPtr().

bool NL3D::UMaterial::getDoubleSided (  )  const

Definition at line 317 of file u_material.cpp.

References getObjectPtr().

UMaterial::TBlend NL3D::UMaterial::getDstBlend ( void   )  const

Definition at line 173 of file u_material.cpp.

References NL3D::CMaterial::getDstBlend(), and getObjectPtr().

CRGBA NL3D::UMaterial::getEmissive (  )  const

Definition at line 339 of file u_material.cpp.

References getObjectPtr().

class CMaterial* NL3D::UMaterial::getObjectPtr (  )  const [inline]
uint8 NL3D::UMaterial::getOpacity (  )  const

Definition at line 357 of file u_material.cpp.

References getObjectPtr().

float NL3D::UMaterial::getShininess (  )  const

Definition at line 369 of file u_material.cpp.

References getObjectPtr().

CRGBA NL3D::UMaterial::getSpecular (  )  const

Definition at line 363 of file u_material.cpp.

References getObjectPtr().

UMaterial::TBlend NL3D::UMaterial::getSrcBlend ( void   )  const

Definition at line 165 of file u_material.cpp.

References getObjectPtr(), and NL3D::CMaterial::getSrcBlend().

float NL3D::UMaterial::getZBias ( void   )  const

Definition at line 285 of file u_material.cpp.

References getObjectPtr().

UMaterial::ZFunc NL3D::UMaterial::getZFunc ( void   )  const

Definition at line 269 of file u_material.cpp.

References getObjectPtr(), and NL3D::CMaterial::getZFunc().

bool NL3D::UMaterial::getZWrite ( void   )  const

Definition at line 277 of file u_material.cpp.

References getObjectPtr().

void NL3D::UMaterial::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 325 of file u_material.cpp.

References getObjectPtr().

Referenced by NL3D::CBloomEffect::init(), NL3D::CDriverUser::release(), and NL3D::CDriverUser::setDisplay().

bool NL3D::UMaterial::isLighted (  )  const

Definition at line 333 of file u_material.cpp.

References getObjectPtr().

bool NL3D::UMaterial::isSupportedByDriver ( UDriver drv,
bool  forceBaseCaps = false 
)

Definition at line 38 of file u_material.cpp.

References getObjectPtr().

void NL3D::UMaterial::selectTextureSet ( uint  id  ) 

select from a texture set for this material (if available)

Definition at line 117 of file u_material.cpp.

References getObjectPtr().

void NL3D::UMaterial::setAlphaTest ( bool  active  ) 
void NL3D::UMaterial::setAlphaTestThreshold ( float  threshold  ) 

change the threshold against alpha is tested.

Default is 0.5f.

Parameters:
thre threshold, should be in [0..1], not clamped.

Definition at line 62 of file u_material.cpp.

References getObjectPtr().

Referenced by CEGUI::NeLTexture::loadFromMemory().

void NL3D::UMaterial::setBlend ( bool  active  ) 
void NL3D::UMaterial::setBlendFunc ( TBlend  src,
TBlend  dst 
)
void NL3D::UMaterial::setColor ( CRGBA  rgba  ) 

The Color is used only if lighting is disabled. Also, color is replaced by per vertex color (if any).

Definition at line 293 of file u_material.cpp.

References getObjectPtr().

Referenced by NL3D::CDriverUser::drawBitmap(), NL3D::CDriverUser::drawLine(), NL3D::CDriverUser::drawQuad(), NL3D::CDriverUser::drawTriangle(), and NL3D::CBloomEffect::init().

void NL3D::UMaterial::setDoubleSided ( bool  doubleSided = true  ) 

Definition at line 309 of file u_material.cpp.

References getObjectPtr().

Referenced by CEGUI::NeLTexture::loadFromFile(), and CEGUI::NeLTexture::loadFromMemory().

void NL3D::UMaterial::setDstBlend ( TBlend  val  ) 

Definition at line 149 of file u_material.cpp.

References getObjectPtr().

void NL3D::UMaterial::setSrcBlend ( TBlend  val  ) 

Definition at line 141 of file u_material.cpp.

References getObjectPtr().

void NL3D::UMaterial::setTexture ( UTexture ptex  ) 

Definition at line 78 of file u_material.cpp.

References setTexture().

void NL3D::UMaterial::setTexture ( uint  stage,
UTexture ptex 
)
void NL3D::UMaterial::setZBias ( float  val  ) 

Definition at line 261 of file u_material.cpp.

References getObjectPtr().

void NL3D::UMaterial::setZFunc ( ZFunc  val  ) 
void NL3D::UMaterial::setZWrite ( bool  active  ) 

Definition at line 253 of file u_material.cpp.

References getObjectPtr().

Referenced by NL3D::CDriverUser::setDisplay().

void NL3D::UMaterial::texEnvArg0Alpha ( uint  stage,
TTexSource  src,
TTexOperand  oper 
)

Definition at line 221 of file u_material.cpp.

References getObjectPtr().

Referenced by CEGUI::NeLTexture::loadFromMemory().

void NL3D::UMaterial::texEnvArg0RGB ( uint  stage,
TTexSource  src,
TTexOperand  oper 
)

Definition at line 189 of file u_material.cpp.

References getObjectPtr().

Referenced by CEGUI::NeLTexture::loadFromMemory().

void NL3D::UMaterial::texEnvArg1Alpha ( uint  stage,
TTexSource  src,
TTexOperand  oper 
)

Definition at line 229 of file u_material.cpp.

References getObjectPtr().

Referenced by CEGUI::NeLTexture::loadFromMemory().

void NL3D::UMaterial::texEnvArg1RGB ( uint  stage,
TTexSource  src,
TTexOperand  oper 
)

Definition at line 197 of file u_material.cpp.

References getObjectPtr().

Referenced by CEGUI::NeLTexture::loadFromMemory().

void NL3D::UMaterial::texEnvArg2Alpha ( uint  stage,
TTexSource  src,
TTexOperand  oper 
)

Definition at line 237 of file u_material.cpp.

References getObjectPtr().

void NL3D::UMaterial::texEnvArg2RGB ( uint  stage,
TTexSource  src,
TTexOperand  oper 
)

Definition at line 205 of file u_material.cpp.

References getObjectPtr().

void NL3D::UMaterial::texEnvOpAlpha ( uint  stage,
TTexOperator  ope 
)

Definition at line 213 of file u_material.cpp.

References getObjectPtr().

Referenced by CEGUI::NeLTexture::loadFromMemory().

void NL3D::UMaterial::texEnvOpRGB ( uint  stage,
TTexOperator  ope 
)

Definition at line 181 of file u_material.cpp.

References getObjectPtr().

Referenced by CEGUI::NeLTexture::loadFromMemory().

bool NL3D::UMaterial::texturePresent (  ) 

Definition at line 102 of file u_material.cpp.

bool NL3D::UMaterial::texturePresent ( uint  stage  ) 

Definition at line 109 of file u_material.cpp.

References getObjectPtr().


Member Data Documentation

Definition at line 210 of file u_material.h.

Referenced by attach(), detach(), empty(), getObjectPtr(), and UMaterial().


The documentation for this class was generated from the following files:

Generated on Thu Jan 7 08:30:13 2010 for NeL by  doxygen 1.6.1