NL3D::CInstanceMaterialUser Class Reference

#include <instance_material_user.h>

Inheritance diagram for NL3D::CInstanceMaterialUser:

NL3D::UInstanceMaterial

Detailed Description

UInstanceMaterial implementation.
Author:
Lionel Berenguier

Nevrax France

Date:
2001

Definition at line 53 of file instance_material_user.h.

Public Types

enum  TBlend {
  one = 0, zero, srcalpha, invsrcalpha,
  srccolor, invsrccolor, blendCount
}

Public Member Functions

 CInstanceMaterialUser (CMeshBaseInstance *mbi, CMaterial *mat, CAsyncTextureBlock *asyncTextBlock)
 Constructor.

virtual void emptyTexture (uint stage=0)
virtual sint getLastTextureStage () const
 Get the last stage that got a texture. -1 means there is no textures.

CMaterialgetMaterial () const
virtual ~CInstanceMaterialUser ()
 dtor

Texture matrix
virtual void enableUserTexMat (uint stage, bool enabled=true)
virtual const NLMISC::CMatrixgetUserTexMat (uint stage) const
virtual bool isUserTexMatEnabled (uint stage) const
virtual void setUserTexMat (uint stage, const NLMISC::CMatrix &m)
 Set a new texture matrix for the given stage.

Lighted material mgt. Has effect only if isLighted().
virtual CRGBA getAmbient () const
virtual CRGBA getDiffuse () const
 return diffuse part. NB: A==opacity.

virtual CRGBA getEmissive () const
virtual uint8 getOpacity () const
virtual float getShininess () const
virtual CRGBA getSpecular () const
virtual void setAmbient (CRGBA ambient=CRGBA(0, 0, 0))
 Set the Ambient part ot material. Usefull only if isLighted().

virtual void setDiffuse (CRGBA diffuse=CRGBA(0, 0, 0))
 Set the Diffuse part ot material. Usefull only if isLighted().

virtual void setEmissive (CRGBA emissive=CRGBA(0, 0, 0))
 Set the emissive part ot material. Usefull only if isLighted().

virtual void setOpacity (uint8 opa)
 Set the Opacity part ot material. Usefull only if isLighted().

virtual void setShininess (float shininess)
 Set the shininess part ot material. Usefull only if isLighted().

virtual void setSpecular (CRGBA specular=CRGBA(0, 0, 0))
 Set the specular part ot material. Usefull only if isLighted().

Blending.
virtual bool getBlend () const
virtual TBlend getDstBlend (void) const
virtual TBlend getSrcBlend (void) const
virtual void setAlphaTestThreshold (float at)
virtual void setBlend (bool active)
virtual void setBlendFunc (TBlend src, TBlend dst)
virtual void setDstBlend (TBlend val)
virtual void setSrcBlend (TBlend val)
virtual void setZWrite (bool active)
UnLighted material mgt. Has effect only if !isLighted().
virtual CRGBA getColor (void) const
virtual void setColor (CRGBA rgba)
constantColor
virtual NLMISC::CRGBA getConstantColor (uint stage) const
virtual void setConstantColor (uint stage, NLMISC::CRGBA color)
Texture files specific
virtual std::string getTextureFileName (uint stage=0) const
 Get the fileName used by the n-th texture file. (must be a texture file or an assertion is raised).

virtual bool isTextureFile (uint stage=0) const
 Check wether the texture of the n-th stage is a texture file.

virtual void setTextureFileName (const std::string &fileName, uint stage=0)
Texture UserColor. No effect if !isUserColor(). (getUserColor() return CRGBA(0,0,0,0))
virtual CRGBA getUserColor () const
virtual void setUserColor (CRGBA userColor)
Modes.
virtual bool isLighted () const
virtual bool isUserColor () const

Private Attributes

CAsyncTextureBlock_AsyncTextureBlock
CMaterial_Material
CMeshBaseInstance_MBI


Member Enumeration Documentation

enum NL3D::UInstanceMaterial::TBlend [inherited]
 

Enumeration values:
one 
zero 
srcalpha 
invsrcalpha 
srccolor 
invsrccolor 
blendCount 

Definition at line 59 of file u_instance_material.h.


Constructor & Destructor Documentation

NL3D::CInstanceMaterialUser::CInstanceMaterialUser CMeshBaseInstance mbi,
CMaterial mat,
CAsyncTextureBlock asyncTextBlock
[inline]
 

Constructor.

Definition at line 57 of file instance_material_user.h.

References _AsyncTextureBlock, _MBI, NL3D_MEM_MATERIAL_INSTANCE, and nlassert.

00058         {
00059                 NL3D_MEM_MATERIAL_INSTANCE
00060                 nlassert(mat && mbi && asyncTextBlock);
00061                 _MBI= mbi;
00062                 _Material= mat;
00063                 _AsyncTextureBlock= asyncTextBlock;
00064         }

virtual NL3D::CInstanceMaterialUser::~CInstanceMaterialUser  )  [inline, virtual]
 

dtor

Definition at line 66 of file instance_material_user.h.

References NL3D_MEM_MATERIAL_INSTANCE.

00067         {
00068                 NL3D_MEM_MATERIAL_INSTANCE
00069         }


Member Function Documentation

void NL3D::CInstanceMaterialUser::emptyTexture uint  stage = 0  )  [virtual]
 

Implements NL3D::UInstanceMaterial.

Definition at line 112 of file instance_material_user.cpp.

References NL3D::IDRV_MAT_MAXTEXTURES, NL3D_MEM_MATERIAL_INSTANCE, nlwarning, NL3D::CMaterial::setTexture(), and uint.

00113 {
00114         NL3D_MEM_MATERIAL_INSTANCE
00115         if (stage >= IDRV_MAT_MAXTEXTURES)
00116         {
00117                 nlwarning("UInstanceMaterialUser::emptyTexture : invalid stage");
00118                 return;
00119         }
00120         _Material->setTexture(stage, NULL);
00121 }

virtual void NL3D::CInstanceMaterialUser::enableUserTexMat uint  stage,
bool  enabled = true
[inline, virtual]
 

Implements NL3D::UInstanceMaterial.

Definition at line 292 of file instance_material_user.h.

References NL3D::CMaterial::enableUserTexMat(), NL3D::IDRV_MAT_MAXTEXTURES, NL3D_MEM_MATERIAL_INSTANCE, nlwarning, and uint.

00293         {
00294                 NL3D_MEM_MATERIAL_INSTANCE
00295                 if (stage >= IDRV_MAT_MAXTEXTURES)
00296                 {
00297                         nlwarning("UInstanceMaterial::enableUserTexMat : stage %d is invalid", stage);
00298                         return;
00299                 }
00300                 _Material->enableUserTexMat(stage, enabled);
00301         }

virtual CRGBA NL3D::CInstanceMaterialUser::getAmbient  )  const [inline, virtual]
 

Implements NL3D::UInstanceMaterial.

Definition at line 127 of file instance_material_user.h.

References NL3D::CMaterial::getAmbient(), and NL3D_MEM_MATERIAL_INSTANCE.

00128         {
00129                 NL3D_MEM_MATERIAL_INSTANCE
00130                 return _Material->getAmbient();
00131         }

virtual bool NL3D::CInstanceMaterialUser::getBlend  )  const [inline, virtual]
 

Implements NL3D::UInstanceMaterial.

Definition at line 271 of file instance_material_user.h.

References NL3D::CMaterial::getBlend(), and NL3D_MEM_MATERIAL_INSTANCE.

00272         {
00273                 NL3D_MEM_MATERIAL_INSTANCE
00274                 return _Material->getBlend();
00275         }

virtual CRGBA NL3D::CInstanceMaterialUser::getColor void   )  const [inline, virtual]
 

Implements NL3D::UInstanceMaterial.

Definition at line 163 of file instance_material_user.h.

References NL3D::CMaterial::getColor(), and NL3D_MEM_MATERIAL_INSTANCE.

00164         {
00165                 NL3D_MEM_MATERIAL_INSTANCE
00166                 return _Material->getColor();
00167         }

virtual NLMISC::CRGBA NL3D::CInstanceMaterialUser::getConstantColor uint  stage  )  const [inline, virtual]
 

Implements NL3D::UInstanceMaterial.

Definition at line 201 of file instance_material_user.h.

References NL3D::CMaterial::getTexConstantColor(), NL3D::IDRV_MAT_MAXTEXTURES, NL3D_MEM_MATERIAL_INSTANCE, nlwarning, and uint.

00202         {
00203                 NL3D_MEM_MATERIAL_INSTANCE
00204                 if (stage >= IDRV_MAT_MAXTEXTURES)
00205                 {
00206                         nlwarning("UInstanceMaterialUser::getConstantColor : invalid stage");
00207                         return NLMISC::CRGBA::Black;
00208                 }
00209                 return _Material->getTexConstantColor(stage);
00210 
00211         }

virtual CRGBA NL3D::CInstanceMaterialUser::getDiffuse  )  const [inline, virtual]
 

return diffuse part. NB: A==opacity.

Implements NL3D::UInstanceMaterial.

Definition at line 132 of file instance_material_user.h.

References NL3D::CMaterial::getDiffuse(), and NL3D_MEM_MATERIAL_INSTANCE.

00133         {
00134                 NL3D_MEM_MATERIAL_INSTANCE
00135                 return _Material->getDiffuse();
00136         }

virtual TBlend NL3D::CInstanceMaterialUser::getDstBlend void   )  const [inline, virtual]
 

Implements NL3D::UInstanceMaterial.

Definition at line 281 of file instance_material_user.h.

References NL3D::CMaterial::getDstBlend(), NL3D_MEM_MATERIAL_INSTANCE, and uint32.

00282         {
00283                 NL3D_MEM_MATERIAL_INSTANCE
00284                 return (UInstanceMaterial::TBlend)(uint32)_Material->getDstBlend();
00285         }

virtual CRGBA NL3D::CInstanceMaterialUser::getEmissive  )  const [inline, virtual]
 

Implements NL3D::UInstanceMaterial.

Definition at line 122 of file instance_material_user.h.

References NL3D::CMaterial::getEmissive(), and NL3D_MEM_MATERIAL_INSTANCE.

00123         {
00124                 NL3D_MEM_MATERIAL_INSTANCE
00125                 return _Material->getEmissive();
00126         }

virtual sint NL3D::CInstanceMaterialUser::getLastTextureStage  )  const [inline, virtual]
 

Get the last stage that got a texture. -1 means there is no textures.

Implements NL3D::UInstanceMaterial.

Definition at line 224 of file instance_material_user.h.

References NL3D::CMaterial::getTexture(), NL3D::IDRV_MAT_MAXTEXTURES, NL3D_MEM_MATERIAL_INSTANCE, sint, and uint.

00225         {
00226                 NL3D_MEM_MATERIAL_INSTANCE
00227                 sint lastStage = -1;
00228                 for(uint k = 0; k < IDRV_MAT_MAXTEXTURES; ++k)
00229                 {
00230                         if (_Material->getTexture(k) != NULL)
00231                         {
00232                                 lastStage = k;
00233                         }
00234                 }
00235                 return lastStage;
00236         }

CMaterial* NL3D::CInstanceMaterialUser::getMaterial  )  const [inline]
 

Definition at line 351 of file instance_material_user.h.

References NL3D_MEM_MATERIAL_INSTANCE.

00352         {
00353                 NL3D_MEM_MATERIAL_INSTANCE
00354                 return _Material;
00355         }

virtual uint8 NL3D::CInstanceMaterialUser::getOpacity  )  const [inline, virtual]
 

Implements NL3D::UInstanceMaterial.

Definition at line 137 of file instance_material_user.h.

References NL3D::CMaterial::getOpacity(), NL3D_MEM_MATERIAL_INSTANCE, and uint8.

00138         {
00139                 NL3D_MEM_MATERIAL_INSTANCE
00140                 return _Material->getOpacity();
00141         }

virtual float NL3D::CInstanceMaterialUser::getShininess  )  const [inline, virtual]
 

Implements NL3D::UInstanceMaterial.

Definition at line 147 of file instance_material_user.h.

References NL3D::CMaterial::getShininess(), and NL3D_MEM_MATERIAL_INSTANCE.

00148         {
00149                 NL3D_MEM_MATERIAL_INSTANCE
00150                 return _Material->getShininess();
00151         }

virtual CRGBA NL3D::CInstanceMaterialUser::getSpecular  )  const [inline, virtual]
 

Implements NL3D::UInstanceMaterial.

Definition at line 142 of file instance_material_user.h.

References NL3D::CMaterial::getSpecular(), and NL3D_MEM_MATERIAL_INSTANCE.

00143         {
00144                 NL3D_MEM_MATERIAL_INSTANCE
00145                 return _Material->getSpecular();
00146         }

virtual TBlend NL3D::CInstanceMaterialUser::getSrcBlend void   )  const [inline, virtual]
 

Implements NL3D::UInstanceMaterial.

Definition at line 276 of file instance_material_user.h.

References NL3D::CMaterial::getSrcBlend(), NL3D_MEM_MATERIAL_INSTANCE, and uint32.

00277         {
00278                 NL3D_MEM_MATERIAL_INSTANCE
00279                 return (UInstanceMaterial::TBlend)(uint32)_Material->getSrcBlend();
00280         }

std::string NL3D::CInstanceMaterialUser::getTextureFileName uint  stage = 0  )  const [virtual]
 

Get the fileName used by the n-th texture file. (must be a texture file or an assertion is raised).

Implements NL3D::UInstanceMaterial.

Definition at line 50 of file instance_material_user.cpp.

References _AsyncTextureBlock, _MBI, NL3D::CMeshBaseInstance::getAsyncTextureMode(), NL3D::CMaterial::getTexture(), NL3D::IDRV_MAT_MAXTEXTURES, NL3D::CAsyncTextureBlock::isTextureFile(), NL3D_MEM_MATERIAL_INSTANCE, nlassert, nlwarning, NL3D::CAsyncTextureBlock::TextureNames, and uint.

00051 {               
00052         NL3D_MEM_MATERIAL_INSTANCE
00053         if (stage >= IDRV_MAT_MAXTEXTURES)
00054         {
00055                 nlwarning("UInstanceMaterialUser::getTextureFileName : invalid stage");
00056                 return "";
00057         }
00058 
00059         // If Async mode
00060         if(_MBI->getAsyncTextureMode())
00061         {
00062                 nlassert(_AsyncTextureBlock->isTextureFile(stage));
00063                 // return name of the async one.
00064                 return _AsyncTextureBlock->TextureNames[stage];
00065         }
00066         else
00067         {
00068                 // return the name in the material
00069                 return NLMISC::safe_cast<CTextureFile *>(_Material->getTexture(stage))->getFileName();
00070         }
00071 }

virtual CRGBA NL3D::CInstanceMaterialUser::getUserColor  )  const [inline, virtual]
 

Implements NL3D::UInstanceMaterial.

Definition at line 179 of file instance_material_user.h.

References NL3D::CMaterial::getUserColor(), isUserColor(), and NL3D_MEM_MATERIAL_INSTANCE.

00180         {
00181                 NL3D_MEM_MATERIAL_INSTANCE
00182                 if(isUserColor())
00183                         return _Material->getUserColor();
00184                 else
00185                         return CRGBA(0,0,0,0);
00186         }

virtual const NLMISC::CMatrix& NL3D::CInstanceMaterialUser::getUserTexMat uint  stage  )  const [inline, virtual]
 

Get a const ref. on the texture matrix of the n-th stage.

Implements NL3D::UInstanceMaterial.

Definition at line 326 of file instance_material_user.h.

References NL3D::CMaterial::getUserTexMat(), NL3D::IDRV_MAT_MAXTEXTURES, NL3D::CMaterial::isUserTexMatEnabled(), NL3D_MEM_MATERIAL_INSTANCE, nlwarning, and uint.

00327         {
00328                 NL3D_MEM_MATERIAL_INSTANCE
00329                 if (stage >= IDRV_MAT_MAXTEXTURES)
00330                 {
00331                         nlwarning("UInstanceMaterial::enableUserTexMat : stage %d is invalid", stage);
00332                         return CMatrix::Identity;
00333                 }
00334                 if (!_Material->isUserTexMatEnabled(stage))
00335                 {
00336                         nlwarning("UInstanceMaterial::setUserTexMat : texture stage %d has no user matrix.", stage);
00337                         return CMatrix::Identity;
00338                 }
00339                 return _Material->getUserTexMat(stage);
00340         }

virtual bool NL3D::CInstanceMaterialUser::isLighted  )  const [inline, virtual]
 

Implements NL3D::UInstanceMaterial.

Definition at line 75 of file instance_material_user.h.

References NL3D::CMaterial::isLighted(), and NL3D_MEM_MATERIAL_INSTANCE.

00076         {
00077                 NL3D_MEM_MATERIAL_INSTANCE
00078                 return _Material->isLighted();
00079         }

bool NL3D::CInstanceMaterialUser::isTextureFile uint  stage = 0  )  const [virtual]
 

Check wether the texture of the n-th stage is a texture file.

Implements NL3D::UInstanceMaterial.

Definition at line 38 of file instance_material_user.cpp.

References NL3D::CMaterial::getTexture(), NL3D::IDRV_MAT_MAXTEXTURES, NL3D_MEM_MATERIAL_INSTANCE, nlwarning, and uint.

00039 {
00040         NL3D_MEM_MATERIAL_INSTANCE
00041         if (stage >= IDRV_MAT_MAXTEXTURES)
00042         {
00043                 nlwarning("UInstanceMaterialUser::isTextureFile : invalid stage");
00044                 return false;
00045         }
00046         return dynamic_cast<CTextureFile *>(_Material->getTexture(stage)) != NULL;
00047 }

virtual bool NL3D::CInstanceMaterialUser::isUserColor  )  const [inline, virtual]
 

Implements NL3D::UInstanceMaterial.

Definition at line 80 of file instance_material_user.h.

References NL3D::CMaterial::getShader(), and NL3D_MEM_MATERIAL_INSTANCE.

Referenced by getUserColor(), and setUserColor().

00081         {
00082                 NL3D_MEM_MATERIAL_INSTANCE
00083                 return _Material->getShader()==CMaterial::UserColor;
00084         }

virtual bool NL3D::CInstanceMaterialUser::isUserTexMatEnabled uint  stage  )  const [inline, virtual]
 

Implements NL3D::UInstanceMaterial.

Definition at line 302 of file instance_material_user.h.

References NL3D::IDRV_MAT_MAXTEXTURES, NL3D::CMaterial::isUserTexMatEnabled(), NL3D_MEM_MATERIAL_INSTANCE, nlwarning, and uint.

00303         {
00304                 NL3D_MEM_MATERIAL_INSTANCE
00305                 if (stage >= IDRV_MAT_MAXTEXTURES)
00306                 {
00307                         nlwarning("UInstanceMaterial::enableUserTexMat : stage %d is invalid", stage);
00308                         return false;
00309                 }
00310                 return _Material->isUserTexMatEnabled(stage);
00311         }

virtual void NL3D::CInstanceMaterialUser::setAlphaTestThreshold float  at  )  [inline, virtual]
 

Implements NL3D::UInstanceMaterial.

Definition at line 260 of file instance_material_user.h.

References NL3D_MEM_MATERIAL_INSTANCE, and NL3D::CMaterial::setAlphaTestThreshold().

00261         {
00262                 NL3D_MEM_MATERIAL_INSTANCE
00263                 _Material->setAlphaTestThreshold(at);
00264         }

virtual void NL3D::CInstanceMaterialUser::setAmbient CRGBA  ambient = CRGBA(0, 0, 0)  )  [inline, virtual]
 

Set the Ambient part ot material. Usefull only if isLighted().

Implements NL3D::UInstanceMaterial.

Definition at line 96 of file instance_material_user.h.

References NL3D_MEM_MATERIAL_INSTANCE, and NL3D::CMaterial::setAmbient().

00097         {
00098                 NL3D_MEM_MATERIAL_INSTANCE
00099                 _Material->setAmbient( ambient);
00100         }

virtual void NL3D::CInstanceMaterialUser::setBlend bool  active  )  [inline, virtual]
 

Implements NL3D::UInstanceMaterial.

Definition at line 240 of file instance_material_user.h.

References NL3D_MEM_MATERIAL_INSTANCE, and NL3D::CMaterial::setBlend().

00241         {
00242                 NL3D_MEM_MATERIAL_INSTANCE
00243                 _Material->setBlend(active);
00244         }

virtual void NL3D::CInstanceMaterialUser::setBlendFunc TBlend  src,
TBlend  dst
[inline, virtual]
 

Implements NL3D::UInstanceMaterial.

Definition at line 245 of file instance_material_user.h.

References NL3D_MEM_MATERIAL_INSTANCE, NL3D::CMaterial::setBlendFunc(), src, and uint32.

00246         {
00247                 NL3D_MEM_MATERIAL_INSTANCE
00248                 _Material->setBlendFunc((CMaterial::TBlend)(uint32)src, (CMaterial::TBlend)(uint32)dst);
00249         }

virtual void NL3D::CInstanceMaterialUser::setColor CRGBA  rgba  )  [inline, virtual]
 

Implements NL3D::UInstanceMaterial.

Definition at line 158 of file instance_material_user.h.

References NL3D_MEM_MATERIAL_INSTANCE, and NL3D::CMaterial::setColor().

00159         {
00160                 NL3D_MEM_MATERIAL_INSTANCE
00161                 _Material->setColor(rgba) ;
00162         }

virtual void NL3D::CInstanceMaterialUser::setConstantColor uint  stage,
NLMISC::CRGBA  color
[inline, virtual]
 

Implements NL3D::UInstanceMaterial.

Definition at line 191 of file instance_material_user.h.

References NL3D::IDRV_MAT_MAXTEXTURES, NL3D_MEM_MATERIAL_INSTANCE, nlwarning, NL3D::CMaterial::texConstantColor(), and uint.

00192         {
00193                 NL3D_MEM_MATERIAL_INSTANCE
00194                 if (stage >= IDRV_MAT_MAXTEXTURES)
00195                 {
00196                         nlwarning("UInstanceMaterialUser::setConstantColor : invalid stage");
00197                         return;
00198                 }
00199                 _Material->texConstantColor(stage, color);
00200         }

virtual void NL3D::CInstanceMaterialUser::setDiffuse CRGBA  diffuse = CRGBA(0, 0, 0)  )  [inline, virtual]
 

Set the Diffuse part ot material. Usefull only if isLighted().

Implements NL3D::UInstanceMaterial.

Definition at line 101 of file instance_material_user.h.

References NL3D_MEM_MATERIAL_INSTANCE, and NL3D::CMaterial::setDiffuse().

00102         {
00103                 NL3D_MEM_MATERIAL_INSTANCE
00104                 _Material->setDiffuse( diffuse);
00105         }

virtual void NL3D::CInstanceMaterialUser::setDstBlend TBlend  val  )  [inline, virtual]
 

Implements NL3D::UInstanceMaterial.

Definition at line 255 of file instance_material_user.h.

References NL3D_MEM_MATERIAL_INSTANCE, NL3D::CMaterial::setDstBlend(), and uint32.

00256         {
00257                 NL3D_MEM_MATERIAL_INSTANCE
00258                 _Material->setDstBlend((CMaterial::TBlend)(uint32)val);
00259         }

virtual void NL3D::CInstanceMaterialUser::setEmissive CRGBA  emissive = CRGBA(0, 0, 0)  )  [inline, virtual]
 

Set the emissive part ot material. Usefull only if isLighted().

Implements NL3D::UInstanceMaterial.

Definition at line 91 of file instance_material_user.h.

References NL3D_MEM_MATERIAL_INSTANCE, and NL3D::CMaterial::setEmissive().

00092         {
00093                 NL3D_MEM_MATERIAL_INSTANCE
00094                 _Material->setEmissive(emissive);
00095         }

virtual void NL3D::CInstanceMaterialUser::setOpacity uint8  opa  )  [inline, virtual]
 

Set the Opacity part ot material. Usefull only if isLighted().

Implements NL3D::UInstanceMaterial.

Definition at line 106 of file instance_material_user.h.

References NL3D_MEM_MATERIAL_INSTANCE, NL3D::CMaterial::setOpacity(), and uint8.

00107         {
00108                 NL3D_MEM_MATERIAL_INSTANCE
00109                 _Material->setOpacity( opa );
00110         }

virtual void NL3D::CInstanceMaterialUser::setShininess float  shininess  )  [inline, virtual]
 

Set the shininess part ot material. Usefull only if isLighted().

Implements NL3D::UInstanceMaterial.

Definition at line 116 of file instance_material_user.h.

References NL3D_MEM_MATERIAL_INSTANCE, and NL3D::CMaterial::setShininess().

00117         {
00118                 NL3D_MEM_MATERIAL_INSTANCE
00119                 _Material->setShininess( shininess );
00120         }

virtual void NL3D::CInstanceMaterialUser::setSpecular CRGBA  specular = CRGBA(0, 0, 0)  )  [inline, virtual]
 

Set the specular part ot material. Usefull only if isLighted().

Implements NL3D::UInstanceMaterial.

Definition at line 111 of file instance_material_user.h.

References NL3D_MEM_MATERIAL_INSTANCE, and NL3D::CMaterial::setSpecular().

00112         {
00113                 NL3D_MEM_MATERIAL_INSTANCE
00114                 _Material->setSpecular( specular);
00115         }

virtual void NL3D::CInstanceMaterialUser::setSrcBlend TBlend  val  )  [inline, virtual]
 

Implements NL3D::UInstanceMaterial.

Definition at line 250 of file instance_material_user.h.

References NL3D_MEM_MATERIAL_INSTANCE, NL3D::CMaterial::setSrcBlend(), and uint32.

00251         {
00252                 NL3D_MEM_MATERIAL_INSTANCE
00253                 _Material->setSrcBlend((CMaterial::TBlend)(uint32)val);
00254         }

void NL3D::CInstanceMaterialUser::setTextureFileName const std::string &  fileName,
uint  stage = 0
[virtual]
 

Set the fileName used by the n-th texture file. (must be a texture file or an assertion is raised) NB: if success and if instanceOwner->getAsyncTextureMode()==true, then instanceOwner->setAsyncTextureDirty(true) is called

Implements NL3D::UInstanceMaterial.

Definition at line 74 of file instance_material_user.cpp.

References _AsyncTextureBlock, _MBI, NL3D::CMeshBaseInstance::getAsyncTextureMode(), NL3D::CMaterial::getTexture(), NL3D::IDRV_MAT_MAXTEXTURES, NL3D::CAsyncTextureBlock::isTextureFile(), NL3D_MEM_MATERIAL_INSTANCE, nlwarning, NL3D::CMeshBaseInstance::setAsyncTextureDirty(), NL3D::CTextureFile::setFileName(), NL3D::CMaterial::setTexture(), NL3D::CAsyncTextureBlock::TextureNames, and uint.

00075 {
00076         NL3D_MEM_MATERIAL_INSTANCE
00077         if (stage >= IDRV_MAT_MAXTEXTURES)
00078         {
00079                 nlwarning("UInstanceMaterialUser::setTextureFileName : invalid stage");
00080                 return;
00081         }
00082 
00083         // If Async mode
00084         if(_MBI->getAsyncTextureMode())
00085         {
00086                 if(!_AsyncTextureBlock->isTextureFile(stage))
00087                 {
00088                         nlwarning("UInstanceMaterialUser::setTextureFileName : the texture is not a texture file");
00089                         return;
00090                 }
00091                 // replace the fileName
00092                 _AsyncTextureBlock->TextureNames[stage]= fileName;
00093                 // Flag the instance.
00094                 _MBI->setAsyncTextureDirty(true);
00095         }
00096         else
00097         {
00098                 CTextureFile *otherTex = dynamic_cast<CTextureFile *>(_Material->getTexture(stage));
00099                 if (!otherTex)
00100                 {
00101                         nlwarning("UInstanceMaterialUser::setTextureFileName : the texture is not a texture file");
00102                         return;
00103                 }
00104                 CTextureFile *tf = new CTextureFile(*otherTex);
00105                 tf->setFileName(fileName);
00106                 NLMISC::CSmartPtr<ITexture> old = _Material->getTexture(stage);
00107                 _Material->setTexture(stage, tf);
00108         }
00109 }

virtual void NL3D::CInstanceMaterialUser::setUserColor CRGBA  userColor  )  [inline, virtual]
 

Implements NL3D::UInstanceMaterial.

Definition at line 173 of file instance_material_user.h.

References isUserColor(), NL3D_MEM_MATERIAL_INSTANCE, and NL3D::CMaterial::setUserColor().

00174         {
00175                 NL3D_MEM_MATERIAL_INSTANCE
00176                 if(isUserColor())
00177                         _Material->setUserColor(userColor);
00178         }

virtual void NL3D::CInstanceMaterialUser::setUserTexMat uint  stage,
const NLMISC::CMatrix m
[inline, virtual]
 

Set a new texture matrix for the given stage.

Implements NL3D::UInstanceMaterial.

Definition at line 312 of file instance_material_user.h.

References NL3D::IDRV_MAT_MAXTEXTURES, NL3D::CMaterial::isUserTexMatEnabled(), NL3D_MEM_MATERIAL_INSTANCE, nlwarning, NL3D::CMaterial::setUserTexMat(), and uint.

00313         {
00314                 NL3D_MEM_MATERIAL_INSTANCE
00315                 if (stage >= IDRV_MAT_MAXTEXTURES)
00316                 {
00317                         nlwarning("UInstanceMaterial::enableUserTexMat : stage %d is invalid", stage);
00318                         return;
00319                 }
00320                 if (!_Material->isUserTexMatEnabled(stage))
00321                 {
00322                         nlwarning("UInstanceMaterial::setUserTexMat : texture stage %d has no user matrix.", stage);
00323                 }
00324                 _Material->setUserTexMat(stage, m);
00325         }

virtual void NL3D::CInstanceMaterialUser::setZWrite bool  active  )  [inline, virtual]
 

Implements NL3D::UInstanceMaterial.

Definition at line 265 of file instance_material_user.h.

References NL3D_MEM_MATERIAL_INSTANCE, and NL3D::CMaterial::setZWrite().

00266         {
00267                 NL3D_MEM_MATERIAL_INSTANCE
00268                 _Material->setZWrite(active);
00269         }


Field Documentation

CAsyncTextureBlock* NL3D::CInstanceMaterialUser::_AsyncTextureBlock [private]
 

Definition at line 346 of file instance_material_user.h.

Referenced by CInstanceMaterialUser(), getTextureFileName(), and setTextureFileName().

CMaterial* NL3D::CInstanceMaterialUser::_Material [private]
 

Definition at line 345 of file instance_material_user.h.

CMeshBaseInstance* NL3D::CInstanceMaterialUser::_MBI [private]
 

Definition at line 344 of file instance_material_user.h.

Referenced by CInstanceMaterialUser(), getTextureFileName(), and setTextureFileName().


The documentation for this class was generated from the following files:
Generated on Tue Mar 16 06:47:48 2004 for NeL by doxygen 1.3.6