NL3D::CPSMultiTexturedParticle Class Reference

#include <ps_particle_basic.h>

Inheritance diagram for NL3D::CPSMultiTexturedParticle:

NL3D::CPSQuad NL3D::CPSFace NL3D::CPSFaceLookAt

Detailed Description

This class add multitexturing support to particles. It doesn't support texture animation however. It adds a second texture that is combined with the main texture by using a given operation. An alternate mode must be provided, for gfx boards that doesn't support the op. For now, 2 stages only are supported.

Definition at line 508 of file ps_particle_basic.h.

Public Types

enum  TOperator {
  Add = 0, Modulate, Decal, EnvBumpMap,
  Last = 0xff
}
 we only use a useful set of operations More...


Public Member Functions

 CPSMultiTexturedParticle ()
 ctor

void enableAlternateTex (bool enabled=true)
void enableMultiTexture (bool enabled=true)
 when set to false, this discard the textures that have been set

void enumTexs (std::vector< NLMISC::CSmartPtr< ITexture > > &dest, IDriver &drv)
const NLMISC::CVector2fgetAlternateScrollSpeed (uint stage) const
TOperator getAlternateTexOp () const
float getBumpFactor () const
TOperator getMainTexOp () const
const NLMISC::CVector2fgetScrollSpeed (uint stage) const
ITexturegetTexture2 ()
const ITexturegetTexture2 () const
 Get the main texture for multitexturing.

ITexturegetTexture2Alternate ()
const ITexturegetTexture2Alternate () const
 Get the alternate texture for multitexturing.

bool getUseLocalDate ()
bool getUseLocalDateAlt ()
bool isAlternateTexEnabled () const
bool isMultiTextureEnabled () const
void serialMultiTex (NLMISC::IStream &f) throw (NLMISC::EStream)
 serial this object

void setAlternateScrollSpeed (uint stage, const NLMISC::CVector2f &sp)
void setAlternateTexOp (TOperator op)
 Set the operation for the alternate texture. Convert the texture to / from a bumpmap if needed.

void setBumpFactor (float bumpFactor)
 Set a bump factor (when embm is used).

void setMainTexOp (TOperator op)
void setScrollSpeed (uint stage, const NLMISC::CVector2f &sp)
void setTexture2 (ITexture *tex)
 Set the main texture for multitexturing. Convert the texture to / from a bumpmap if needed (so you just provide its heightmap).

void setTexture2Alternate (ITexture *tex)
 Set the alternate texture for multitexturing. It is used when the main operator is not supported by the gfx board.

void setupMaterial (ITexture *primary, IDriver *drv, CMaterial &mat)
void setUseLocalDate (bool use)
 Use the particle age rather than the global time to compute textures coordinates.

void setUseLocalDateAlt (bool use)
 Use the particle age rather than the global time to compute textures coordinates. (when alternate texture is used).


Static Public Member Functions

bool areBasicCapsForced ()
 test wether basic caps are forced

void forceBasicCaps (bool force=true)

Protected Types

enum  TMultiTexState {
  TouchFlag = 0x01, MultiTextureEnabled = 0x02, AlternateTextureEnabled = 0x04, AlternateTextureUsed = 0x08,
  EnvBumpMapUsed = 0x10, BasicCapsForced = 0x20, ScrollUseLocalDate = 0x40, ScrollUseLocalDateAlternate = 0x80
}

Protected Member Functions

bool areBasicCapsForcedLocal () const
void forceBasicCapsLocal (bool force)
bool isAlternateTextureUsed () const
 test wether the alternate texture is used

bool isEnvBumpMapUsed () const
bool isTouched ()
void setupMultiTexEnv (TOperator op, ITexture *tex1, ITexture *tex2, CMaterial &mat)
void touch ()
void unTouch ()

Protected Attributes

TOperator _AlternateOp
NLMISC::CSmartPtr< ITexture_AlternateTexture2
float _BumpFactor
TOperator _MainOp
uint8 _MultiTexState
NLMISC::CVector2f _TexScroll [2]
 texture scrolling

NLMISC::CVector2f _TexScrollAlternate [2]
 alternate texture scrollMultiTextureEnabled

NLMISC::CSmartPtr< ITexture_Texture2

Static Protected Attributes

bool _ForceBasicCaps = false


Member Enumeration Documentation

enum NL3D::CPSMultiTexturedParticle::TMultiTexState [protected]
 

Enumeration values:
TouchFlag 
MultiTextureEnabled 
AlternateTextureEnabled 
AlternateTextureUsed 
EnvBumpMapUsed 
BasicCapsForced 
ScrollUseLocalDate 
ScrollUseLocalDateAlternate 

Definition at line 626 of file ps_particle_basic.h.

enum NL3D::CPSMultiTexturedParticle::TOperator
 

we only use a useful set of operations

Enumeration values:
Add 
Modulate 
Decal 
EnvBumpMap 
Last 

Definition at line 515 of file ps_particle_basic.h.

Referenced by getAlternateTexOp(), and getMainTexOp().

00515 { Add = 0, Modulate, Decal, EnvBumpMap, Last = 0xff };


Constructor & Destructor Documentation

NL3D::CPSMultiTexturedParticle::CPSMultiTexturedParticle  ) 
 

ctor

Definition at line 631 of file ps_particle_basic.cpp.

00631                                                    : _MultiTexState(TouchFlag), _BumpFactor(1.f)
00632 {       
00633 }


Member Function Documentation

bool NL3D::CPSMultiTexturedParticle::areBasicCapsForced  )  [inline, static]
 

test wether basic caps are forced

Definition at line 598 of file ps_particle_basic.h.

References _ForceBasicCaps.

Referenced by setupMaterial().

00598 { return _ForceBasicCaps; }

bool NL3D::CPSMultiTexturedParticle::areBasicCapsForcedLocal  )  const [inline, protected]
 

Definition at line 638 of file ps_particle_basic.h.

References _MultiTexState, and BasicCapsForced.

Referenced by setupMaterial().

00638 { return (_MultiTexState & BasicCapsForced) != 0; }

void NL3D::CPSMultiTexturedParticle::enableAlternateTex bool  enabled = true  ) 
 

Definition at line 656 of file ps_particle_basic.cpp.

References _AlternateOp, _MultiTexState, _TexScrollAlternate, _Texture2, AlternateTextureEnabled, isAlternateTexEnabled(), isMultiTextureEnabled(), nlassert, NLMISC::CVector2f::set(), touch(), and uint8.

00657 {       
00658         nlassert(isMultiTextureEnabled()); // multitexturing must have been enabled first
00659         if (enabled == isAlternateTexEnabled()) return;
00660 
00661         if (enabled)
00662         {
00663                 _TexScrollAlternate[0].set(0, 0);
00664                 _TexScrollAlternate[1].set(0, 0);
00665                 _AlternateOp = Modulate;
00666                 _MultiTexState |= (uint8) AlternateTextureEnabled;
00667         }
00668         else
00669         {
00670                 _Texture2 = NULL;
00671                 _MultiTexState &= ~(uint8) AlternateTextureEnabled;
00672         }
00673         touch();
00674 }

void NL3D::CPSMultiTexturedParticle::enableMultiTexture bool  enabled = true  ) 
 

when set to false, this discard the textures that have been set

Definition at line 636 of file ps_particle_basic.cpp.

References _AlternateTexture2, _MainOp, _MultiTexState, _TexScroll, _Texture2, isMultiTextureEnabled(), MultiTextureEnabled, NLMISC::CVector2f::set(), touch(), and uint8.

00637 {
00638         if (isMultiTextureEnabled() == enabled) return;
00639         if (!enabled)
00640         {
00641                 _Texture2                  = NULL;
00642                 _AlternateTexture2 = NULL;
00643                 _MultiTexState = 0;
00644         }
00645         else
00646         {               
00647                 _MainOp = Modulate;
00648                 _TexScroll[0].set(0, 0);
00649                 _TexScroll[1].set(0, 0);
00650                 _MultiTexState = (uint8) MultiTextureEnabled;
00651         }
00652         touch();        
00653 }

void NL3D::CPSMultiTexturedParticle::enumTexs std::vector< NLMISC::CSmartPtr< ITexture > > &  dest,
IDriver drv
 

Reimplemented in NL3D::CPSQuad.

Definition at line 968 of file ps_particle_basic.cpp.

References _AlternateTexture2, _MainOp, _Texture2, EnvBumpMap, and NL3D::IDriver::isTextureAddrModeSupported().

00969 {       
00970         if (_MainOp  == EnvBumpMap)
00971         {
00972                 if (drv.isTextureAddrModeSupported(CMaterial::OffsetTexture))
00973                 {
00974                         if (_Texture2) dest.push_back(_Texture2);
00975                 }
00976                 else
00977                 {
00978                         if (_AlternateTexture2) dest.push_back(_AlternateTexture2);
00979                 }
00980                 return;
00981         }       
00982         if (_Texture2) dest.push_back(_Texture2);       
00983 }

void NL3D::CPSMultiTexturedParticle::forceBasicCaps bool  force = true  )  [inline, static]
 

this act as if the system had the most basic caps supported (no EMBM for example...) Should be used only in edition mode for test

Definition at line 595 of file ps_particle_basic.h.

References _ForceBasicCaps.

00595 { _ForceBasicCaps =  force; }

void NL3D::CPSMultiTexturedParticle::forceBasicCapsLocal bool  force  )  [inline, protected]
 

Definition at line 639 of file ps_particle_basic.h.

References _MultiTexState, and BasicCapsForced.

00640         { 
00641                 if (force) _MultiTexState |= BasicCapsForced;
00642                 else _MultiTexState &= ~BasicCapsForced;
00643         }

const NLMISC::CVector2f& NL3D::CPSMultiTexturedParticle::getAlternateScrollSpeed uint  stage  )  const [inline]
 

Definition at line 577 of file ps_particle_basic.h.

References _TexScrollAlternate, nlassert, and uint.

00578         {
00579                 nlassert(stage < 2);
00580                 return _TexScrollAlternate[stage];
00581         }

TOperator NL3D::CPSMultiTexturedParticle::getAlternateTexOp  )  const [inline]
 

Definition at line 550 of file ps_particle_basic.h.

References _AlternateOp, and TOperator.

00551         {               
00552                 return _AlternateOp; 
00553         }

float NL3D::CPSMultiTexturedParticle::getBumpFactor  )  const [inline]
 

Definition at line 610 of file ps_particle_basic.h.

References _BumpFactor.

00610 { return _BumpFactor; }

TOperator NL3D::CPSMultiTexturedParticle::getMainTexOp  )  const [inline]
 

Definition at line 533 of file ps_particle_basic.h.

References _MainOp, and TOperator.

00533 { return _MainOp; }

const NLMISC::CVector2f& NL3D::CPSMultiTexturedParticle::getScrollSpeed uint  stage  )  const [inline]
 

Definition at line 563 of file ps_particle_basic.h.

References _TexScroll, nlassert, and uint.

00564         {
00565                 nlassert(stage < 2);
00566                 return _TexScroll[stage];
00567         }

ITexture* NL3D::CPSMultiTexturedParticle::getTexture2  )  [inline]
 

Definition at line 526 of file ps_particle_basic.h.

References _Texture2.

00526 { return _Texture2; }

const ITexture* NL3D::CPSMultiTexturedParticle::getTexture2  )  const [inline]
 

Get the main texture for multitexturing.

Definition at line 525 of file ps_particle_basic.h.

References _Texture2.

00525 { return _Texture2; }

ITexture* NL3D::CPSMultiTexturedParticle::getTexture2Alternate  )  [inline]
 

Definition at line 545 of file ps_particle_basic.h.

References _AlternateTexture2.

00545 { return _AlternateTexture2; }

const ITexture* NL3D::CPSMultiTexturedParticle::getTexture2Alternate  )  const [inline]
 

Get the alternate texture for multitexturing.

Definition at line 544 of file ps_particle_basic.h.

References _AlternateTexture2.

00544 { return _AlternateTexture2; }

bool NL3D::CPSMultiTexturedParticle::getUseLocalDate  )  [inline]
 

Definition at line 602 of file ps_particle_basic.h.

References _MultiTexState, and ScrollUseLocalDate.

Referenced by NL3D::CPSQuad::updateVbColNUVForRender().

00602 { return (_MultiTexState & ScrollUseLocalDate) != 0; }

bool NL3D::CPSMultiTexturedParticle::getUseLocalDateAlt  )  [inline]
 

Definition at line 606 of file ps_particle_basic.h.

References _MultiTexState, and ScrollUseLocalDateAlternate.

Referenced by NL3D::CPSQuad::updateVbColNUVForRender().

00606 { return (_MultiTexState & ScrollUseLocalDateAlternate) != 0; }

bool NL3D::CPSMultiTexturedParticle::isAlternateTexEnabled  )  const [inline]
 

Definition at line 537 of file ps_particle_basic.h.

References _MultiTexState, AlternateTextureEnabled, and uint8.

Referenced by enableAlternateTex(), and setupMaterial().

00537 { return (_MultiTexState & (uint8) AlternateTextureEnabled) != 0; }

bool NL3D::CPSMultiTexturedParticle::isAlternateTextureUsed  )  const [inline, protected]
 

test wether the alternate texture is used

Definition at line 632 of file ps_particle_basic.h.

References _MultiTexState, and AlternateTextureUsed.

Referenced by NL3D::CPSQuad::getNeededVB(), and NL3D::CPSQuad::updateVbColNUVForRender().

00632 { return (_MultiTexState & AlternateTextureUsed) != 0; }

bool NL3D::CPSMultiTexturedParticle::isEnvBumpMapUsed  )  const [inline, protected]
 

Definition at line 633 of file ps_particle_basic.h.

References _MultiTexState, and EnvBumpMapUsed.

00633 { return (_MultiTexState & EnvBumpMapUsed) != 0; }

bool NL3D::CPSMultiTexturedParticle::isMultiTextureEnabled  )  const [inline]
 

Definition at line 519 of file ps_particle_basic.h.

References _MultiTexState, MultiTextureEnabled, and uint8.

Referenced by NL3D::CPSFaceHelper::drawFaces(), enableAlternateTex(), enableMultiTexture(), setupMaterial(), and NL3D::CPSQuad::updateMatBeforeRendering().

00519 { return (_MultiTexState & (uint8) MultiTextureEnabled) != 0; }

bool NL3D::CPSMultiTexturedParticle::isTouched  )  [inline, protected]
 

Definition at line 637 of file ps_particle_basic.h.

References _MultiTexState, and TouchFlag.

Referenced by setupMaterial().

00637 { return (_MultiTexState & TouchFlag) != 0; }   

void NL3D::CPSMultiTexturedParticle::serialMultiTex NLMISC::IStream f  )  throw (NLMISC::EStream)
 

serial this object

version 1 : bump factor

Definition at line 677 of file ps_particle_basic.cpp.

References sint.

00678 {
00680         sint ver = f.serialVersion(1);
00681         f.serial(_MultiTexState);
00682         if (isMultiTextureEnabled())
00683         {
00684                 f.serialEnum(_MainOp);
00685                 if (_MainOp == EnvBumpMap && ver >= 1)
00686                 {
00687                         f.serial(_BumpFactor);
00688                 }
00689                 ITexture *tex = NULL;
00690                 if (f.isReading())
00691                 {
00692                         f.serialPolyPtr(tex);
00693                         _Texture2 = tex;
00694                 }
00695                 else
00696                 {
00697                         tex = _Texture2;
00698                         f.serialPolyPtr(tex);
00699                 }
00700                 f.serial(_TexScroll[0], _TexScroll[1]);
00701                 
00702                 if (isAlternateTexEnabled())
00703                 {
00704                         f.serialEnum(_AlternateOp);                     
00705                         if (f.isReading())
00706                         {
00707                                 f.serialPolyPtr(tex);
00708                                 _AlternateTexture2 = tex;
00709                         }
00710                         else
00711                         {
00712                                 tex = _AlternateTexture2;
00713                                 f.serialPolyPtr(tex);
00714                         }
00715                         f.serial(_TexScrollAlternate[0], _TexScrollAlternate[1]);
00716                 }
00717                 else
00718                 {
00719                         _AlternateTexture2 = NULL;
00720                 }
00721         }
00722         else
00723         {
00724                 if (f.isReading())
00725                 {
00726                         _Texture2                  = NULL;
00727                         _AlternateTexture2 = NULL;
00728                 }
00729         }       
00730 }

void NL3D::CPSMultiTexturedParticle::setAlternateScrollSpeed uint  stage,
const NLMISC::CVector2f sp
[inline]
 

set the scroll speed for tex 1 & 2 when the alternate op is used

Parameters:
stage can be set to 0 or one

Definition at line 572 of file ps_particle_basic.h.

References _TexScrollAlternate, nlassert, and uint.

00573         {
00574                 nlassert(stage < 2);
00575                 _TexScrollAlternate[stage] = sp;
00576         }

void NL3D::CPSMultiTexturedParticle::setAlternateTexOp TOperator  op  ) 
 

Set the operation for the alternate texture. Convert the texture to / from a bumpmap if needed.

Definition at line 923 of file ps_particle_basic.cpp.

References _AlternateOp, _AlternateTexture2, NL3D::ConvertFromBumpMap(), NL3D::ConvertToBumpMap(), EnvBumpMap, and touch().

00924 { 
00925         _AlternateOp = op;
00926         if (_AlternateOp == EnvBumpMap)
00927         {
00928                 ConvertToBumpMap(_AlternateTexture2);
00929         }
00930         else
00931         {
00932                 ConvertFromBumpMap(_AlternateTexture2);
00933         }
00934         touch();
00935 }

void NL3D::CPSMultiTexturedParticle::setBumpFactor float  bumpFactor  )  [inline]
 

Set a bump factor (when embm is used).

Definition at line 609 of file ps_particle_basic.h.

References _BumpFactor, and touch().

00609 { _BumpFactor = bumpFactor; touch(); }

void NL3D::CPSMultiTexturedParticle::setMainTexOp TOperator  op  ) 
 

Set the operation for the main texture. When EnvBumpMap is used, setTexture2 must be called with a bump map, and the primary texture must be convertible to rgba. Convert the texture to / from a bumpmap if needed

Definition at line 908 of file ps_particle_basic.cpp.

References _MainOp, _Texture2, NL3D::ConvertFromBumpMap(), NL3D::ConvertToBumpMap(), EnvBumpMap, and touch().

00909 { 
00910         _MainOp = op;
00911         if (_MainOp == EnvBumpMap)
00912         {
00913                 ConvertToBumpMap(_Texture2);
00914         }
00915         else
00916         {
00917                 ConvertFromBumpMap(_Texture2);
00918         }
00919         touch();
00920 }

void NL3D::CPSMultiTexturedParticle::setScrollSpeed uint  stage,
const NLMISC::CVector2f sp
[inline]
 

set the scroll speed for tex 1 & 2 when the main op is used

Parameters:
stage can be set to 0 or one

Definition at line 558 of file ps_particle_basic.h.

References _TexScroll, nlassert, and uint.

00559         {
00560                 nlassert(stage < 2);
00561                 _TexScroll[stage] = sp;         
00562         }

void NL3D::CPSMultiTexturedParticle::setTexture2 ITexture tex  ) 
 

Set the main texture for multitexturing. Convert the texture to / from a bumpmap if needed (so you just provide its heightmap).

Definition at line 890 of file ps_particle_basic.cpp.

References _MainOp, _Texture2, NL3D::ConvertFromBumpMap(), NL3D::ConvertToBumpMap(), EnvBumpMap, and touch().

00891 { 
00892         _Texture2 = tex;
00893         if (_MainOp != EnvBumpMap)
00894         {               
00895                 ConvertFromBumpMap(_Texture2);
00896         }
00897         else
00898         {
00899                 if (!dynamic_cast<NL3D::CTextureBump *>((ITexture *) _Texture2))
00900                 {
00901                         ConvertToBumpMap(_Texture2);
00902                 }
00903         }
00904         touch();
00905 }

void NL3D::CPSMultiTexturedParticle::setTexture2Alternate ITexture tex  ) 
 

Set the alternate texture for multitexturing. It is used when the main operator is not supported by the gfx board.

Definition at line 875 of file ps_particle_basic.cpp.

References _AlternateOp, _AlternateTexture2, NL3D::ConvertFromBumpMap(), NL3D::ConvertToBumpMap(), EnvBumpMap, and touch().

00876 { 
00877         _AlternateTexture2 = tex;
00878         if (_AlternateOp != EnvBumpMap)
00879         {               
00880                 ConvertFromBumpMap(_AlternateTexture2);
00881         }
00882         else
00883         {
00884                 ConvertToBumpMap(_AlternateTexture2);           
00885         }
00886         touch();
00887 }

void NL3D::CPSMultiTexturedParticle::setupMaterial ITexture primary,
IDriver drv,
CMaterial mat
 

setup a material from this object and a primary texture drv is used to check the device caps. Must be called before display when multitextureing is used

Definition at line 733 of file ps_particle_basic.cpp.

References _AlternateOp, _AlternateTexture2, _BumpFactor, _ForceBasicCaps, _MainOp, _MultiTexState, _Texture2, AlternateTextureUsed, areBasicCapsForced(), areBasicCapsForcedLocal(), Decal, EnvBumpMap, EnvBumpMapUsed, NL3D::ITexture::generate(), NL3D::CTextureBump::getNormalizationFactor(), isAlternateTexEnabled(), isMultiTextureEnabled(), NL3D::IDriver::isTextureAddrModeSupported(), isTouched(), NL3D::CTextureBump::release(), NL3D::IDriver::setMatrix2DForTextureOffsetAddrMode(), NL3D::CMaterial::setTexture(), setupMultiTexEnv(), NL3D::CMaterial::texEnvOpRGB(), uint8, and unTouch().

Referenced by NL3D::CPSFaceHelper::drawFaces(), and NL3D::CPSQuad::updateMatBeforeRendering().

00734 {
00736         if (isMultiTextureEnabled() && _MainOp  == EnvBumpMap && driver->isTextureAddrModeSupported(CMaterial::OffsetTexture))
00737         {
00738                 CTextureBump *tb = dynamic_cast<CTextureBump *>((ITexture *) _Texture2);
00739                 if (tb != NULL)
00740                 {                                       
00741                         float normFactor = tb->getNormalizationFactor();
00742                         if (normFactor == 0.f) // have we computed the normalization factor ?
00743                         {
00745                                 tb->generate();
00746                                 normFactor = tb->getNormalizationFactor();
00747                                 tb->release();
00748                         }
00749                         const float bMat[] = { _BumpFactor * normFactor, 0.f, 0.f, _BumpFactor * normFactor};   
00750                         driver->setMatrix2DForTextureOffsetAddrMode(1, bMat);
00751                 }               
00752         }
00753 
00754         if (!isTouched() && areBasicCapsForcedLocal() == areBasicCapsForced()) return;
00755         if (!isMultiTextureEnabled())           
00756         {               
00757                 mat.setTexture(0, primary);
00758                 mat.texEnvOpRGB(0, CMaterial::Modulate);
00759                 mat.setTexture(1, NULL);
00760         }
00761         else
00762         {                               
00763                 if (_MainOp  != EnvBumpMap)
00764                 {                       
00765                         setupMultiTexEnv(_MainOp, primary, _Texture2, mat);
00766                         _MultiTexState &= ~(uint8) EnvBumpMapUsed;
00767                         _MultiTexState &= ~(uint8) AlternateTextureUsed;
00768                 }
00769                 else
00770                 {
00771                         if (!_ForceBasicCaps && driver->isTextureAddrModeSupported(CMaterial::OffsetTexture)) // envbumpmap supported ?
00772                         {
00773                                 CTextureBump *tb = dynamic_cast<CTextureBump *>((ITexture *) _Texture2);
00774                                 if (tb != NULL)
00775                                 {                                       
00776                                         float normFactor = tb->getNormalizationFactor();
00777                                         if (normFactor == 0.f) // have we computed the normalization factor ?
00778                                         {
00780                                                 tb->generate();
00781                                                 normFactor = tb->getNormalizationFactor();
00782                                                 tb->release();
00783                                         }                                       
00784                                         setupMultiTexEnv(_MainOp, primary, _Texture2, mat);     
00785                                 }
00786                                 _MultiTexState &= ~(uint8) AlternateTextureUsed;
00787                                 _MultiTexState |= (uint8) EnvBumpMapUsed;                               
00788                         }
00789                         else // switch to alternate
00790                         {
00791                                 if (isAlternateTexEnabled())
00792                                 {
00793                                         _MultiTexState |= (uint8) AlternateTextureUsed;
00794                                         setupMultiTexEnv(_AlternateOp, primary, _AlternateTexture2, mat);
00795                                         _MultiTexState &= ~(uint8) EnvBumpMapUsed;
00796                                 }
00797                                 else // display the texture as it
00798                                 {
00799                                         setupMultiTexEnv(Decal, primary, NULL, mat);
00800                                         _MultiTexState &= ~(uint8) AlternateTextureUsed;
00801                                         _MultiTexState &= ~(uint8) EnvBumpMapUsed;
00802                                 }
00803                         }
00804                 }
00805         }
00806         
00807         (areBasicCapsForced());
00808         unTouch();
00809 }

void NL3D::CPSMultiTexturedParticle::setupMultiTexEnv TOperator  op,
ITexture tex1,
ITexture tex2,
CMaterial mat
[protected]
 

Definition at line 812 of file ps_particle_basic.cpp.

References Decal, NL3D::CMaterial::enableTexAddrMode(), EnvBumpMap, NL3D::CMaterial::setTexAddressingMode(), NL3D::CMaterial::setTexture(), and NL3D::CMaterial::texEnvOpRGB().

Referenced by setupMaterial().

00813 {
00814         switch (op)
00815         {
00816                 case Add:                       
00817                         mat.setTexture(0, tex1);
00818                         mat.setTexture(1, tex2);
00819                         mat.texEnvOpRGB(0, CMaterial::Modulate);
00820                         mat.texEnvOpRGB(1, CMaterial::Add);
00821                         mat.enableTexAddrMode(false);
00822                         break;
00823                 case Modulate:
00824                         mat.setTexture(0, tex1);
00825                         mat.setTexture(1, tex2);
00826                         mat.texEnvOpRGB(0, CMaterial::Modulate);
00827                         mat.texEnvOpRGB(1, CMaterial::Modulate);
00828                         mat.enableTexAddrMode(false);
00829                         break;
00830                 case EnvBumpMap:
00831                         mat.setTexture(0, tex2);
00832                         mat.setTexture(1, tex1);
00833                         mat.texEnvOpRGB(0, CMaterial::Replace);
00834                         mat.texEnvOpRGB(1, CMaterial::Modulate);
00835                         mat.enableTexAddrMode(true);
00836                         mat.setTexAddressingMode(0, CMaterial::FetchTexture);           
00837                         mat.setTexAddressingMode(1, CMaterial::OffsetTexture);
00838                         break;
00839                 case Decal:
00840                         mat.setTexture(0, tex1);
00841                         mat.texEnvOpRGB(0, CMaterial::Replace);
00842                         mat.setTexture(1, NULL);
00843                         mat.enableTexAddrMode(false);
00844                         break;
00845                 default: break;
00846         }
00847 }

void NL3D::CPSMultiTexturedParticle::setUseLocalDate bool  use  ) 
 

Use the particle age rather than the global time to compute textures coordinates.

Definition at line 940 of file ps_particle_basic.cpp.

References _MultiTexState, and ScrollUseLocalDate.

00941 {
00942         if (use) _MultiTexState |= ScrollUseLocalDate;
00943         else _MultiTexState &= ~ ScrollUseLocalDate;
00944 }

void NL3D::CPSMultiTexturedParticle::setUseLocalDateAlt bool  use  ) 
 

Use the particle age rather than the global time to compute textures coordinates. (when alternate texture is used).

Definition at line 948 of file ps_particle_basic.cpp.

References _MultiTexState, and ScrollUseLocalDateAlternate.

00949 {
00950         if (use) _MultiTexState |= ScrollUseLocalDateAlternate;
00951         else _MultiTexState &= ~ ScrollUseLocalDateAlternate;
00952 }

void NL3D::CPSMultiTexturedParticle::touch  )  [inline, protected]
 

Definition at line 635 of file ps_particle_basic.h.

References _MultiTexState, TouchFlag, and uint8.

Referenced by enableAlternateTex(), enableMultiTexture(), setAlternateTexOp(), setBumpFactor(), setMainTexOp(), setTexture2(), setTexture2Alternate(), and NL3D::CPSQuad::updateMatAndVbForTexture().

00635 { _MultiTexState |= (uint8) TouchFlag; }

void NL3D::CPSMultiTexturedParticle::unTouch  )  [inline, protected]
 

Definition at line 636 of file ps_particle_basic.h.

References _MultiTexState, TouchFlag, and uint8.

Referenced by setupMaterial().

00636 { _MultiTexState &= ~ (uint8) TouchFlag; }


Field Documentation

TOperator NL3D::CPSMultiTexturedParticle::_AlternateOp [protected]
 

Definition at line 617 of file ps_particle_basic.h.

Referenced by enableAlternateTex(), getAlternateTexOp(), setAlternateTexOp(), setTexture2Alternate(), and setupMaterial().

NLMISC::CSmartPtr<ITexture> NL3D::CPSMultiTexturedParticle::_AlternateTexture2 [protected]
 

Definition at line 619 of file ps_particle_basic.h.

Referenced by enableMultiTexture(), enumTexs(), getTexture2Alternate(), setAlternateTexOp(), setTexture2Alternate(), and setupMaterial().

float NL3D::CPSMultiTexturedParticle::_BumpFactor [protected]
 

Definition at line 644 of file ps_particle_basic.h.

Referenced by getBumpFactor(), setBumpFactor(), and setupMaterial().

bool NL3D::CPSMultiTexturedParticle::_ForceBasicCaps = false [static, protected]
 

Definition at line 628 of file ps_particle_basic.cpp.

Referenced by areBasicCapsForced(), forceBasicCaps(), and setupMaterial().

TOperator NL3D::CPSMultiTexturedParticle::_MainOp [protected]
 

Definition at line 617 of file ps_particle_basic.h.

Referenced by enableMultiTexture(), enumTexs(), getMainTexOp(), setMainTexOp(), setTexture2(), and setupMaterial().

uint8 NL3D::CPSMultiTexturedParticle::_MultiTexState [protected]
 

Definition at line 629 of file ps_particle_basic.h.

Referenced by areBasicCapsForcedLocal(), enableAlternateTex(), enableMultiTexture(), forceBasicCapsLocal(), getUseLocalDate(), getUseLocalDateAlt(), isAlternateTexEnabled(), isAlternateTextureUsed(), isEnvBumpMapUsed(), isMultiTextureEnabled(), isTouched(), setupMaterial(), setUseLocalDate(), setUseLocalDateAlt(), touch(), and unTouch().

NLMISC::CVector2f NL3D::CPSMultiTexturedParticle::_TexScroll[2] [protected]
 

texture scrolling

Definition at line 622 of file ps_particle_basic.h.

Referenced by enableMultiTexture(), getScrollSpeed(), and setScrollSpeed().

NLMISC::CVector2f NL3D::CPSMultiTexturedParticle::_TexScrollAlternate[2] [protected]
 

alternate texture scrollMultiTextureEnabled

Definition at line 624 of file ps_particle_basic.h.

Referenced by enableAlternateTex(), getAlternateScrollSpeed(), and setAlternateScrollSpeed().

NLMISC::CSmartPtr<ITexture> NL3D::CPSMultiTexturedParticle::_Texture2 [protected]
 

Definition at line 618 of file ps_particle_basic.h.

Referenced by enableAlternateTex(), enableMultiTexture(), enumTexs(), getTexture2(), setMainTexOp(), setTexture2(), and setupMaterial().


The documentation for this class was generated from the following files:
Generated on Tue Mar 16 07:18:51 2004 for NeL by doxygen 1.3.6