# Home    # nevrax.com   
Nevrax
Nevrax.org
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
Docs
 
Documentation  
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  

NL3D::CPSMultiTexturedParticle Class Reference

This class add multitexturing support to particles. More...

#include <ps_particle_basic.h>

Inheritance diagram for NL3D::CPSMultiTexturedParticle:

NL3D::CPSQuad NL3D::CPSFace NL3D::CPSFaceLookAt List of all members.

Public Types

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


Public Methods

 CPSMultiTexturedParticle ()
 ctor. More...

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

bool isMultiTextureEnabled () const
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). More...

const ITexturegetTexture2 () const
 Get the main texture for multitexturing. More...

ITexturegetTexture2 ()
void setMainTexOp (TOperator op)
 Set the operation for the main texture. More...

TOperator getMainTexOp () const
void enableAlternateTex (bool enabled=true)
bool isAlternateTexEnabled () const
void setTexture2Alternate (ITexture *tex)
 Set the alternate texture for multitexturing. It is used when the main operator is not supported by the gfx board. More...

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

ITexturegetTexture2Alternate ()
void setAlternateTexOp (TOperator op)
 Set the operation for the alternate texture. Convert the texture to / from a bumpmap if needed. More...

TOperator getAlternateTexOp () const
void setScrollSpeed (uint stage, const NLMISC::CVector2f &sp)
 set the scroll speed for tex 1 & 2 when the main op is used. More...

const NLMISC::CVector2fgetScrollSpeed (uint stage) const
void setAlternateScrollSpeed (uint stage, const NLMISC::CVector2f &sp)
 set the scroll speed for tex 1 & 2 when the alternate op is used. More...

const NLMISC::CVector2fgetAlternateScrollSpeed (uint stage) const
void serialMultiTex (NLMISC::IStream &f) throw (NLMISC::EStream)
 serial this object. More...

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

void setUseLocalDate (bool use)
 Use the particle age rather than the global time to compute textures coordinates. More...

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

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

float getBumpFactor () const

Static Public Methods

void forceBasicCaps (bool force=true)
 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. More...

bool areBasicCapsForced ()
 test wether basic caps are forced. More...


Protected Types

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

Protected Methods

void setupMultiTexEnv (TOperator op, ITexture *tex1, ITexture *tex2, CMaterial &mat)
bool isAlternateTextureUsed () const
 test wether the alternate texture is used. More...

bool isEnvBumpMapUsed () const
void touch ()
void unTouch ()
bool isTouched ()
bool areBasicCapsForcedLocal () const
void forceBasicCapsLocal (bool force)

Protected Attributes

TOperator _MainOp
TOperator _AlternateOp
NLMISC::CSmartPtr< ITexture_Texture2
NLMISC::CSmartPtr< ITexture_AlternateTexture2
NLMISC::CVector2f _TexScroll [2]
 texture scrolling. More...

NLMISC::CVector2f _TexScrollAlternate [2]
 alternate texture scrollMultiTextureEnabled. More...

uint8 _MultiTexState
float _BumpFactor

Static Protected Attributes

bool _ForceBasicCaps = false

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 482 of file ps_particle_basic.h.


Member Enumeration Documentation

enum NL3D::CPSMultiTexturedParticle::TMultiTexState [protected]
 

Enumeration values:
TouchFlag 
MultiTextureEnabled 
AlternateTextureEnabled 
AlternateTextureUsed 
EnvBumpMapUsed 
BasicCapsForced 
ScrollUseLocalDate 
ScrollUseLocalDateAlternate 

Definition at line 597 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 489 of file ps_particle_basic.h.

Referenced by getAlternateTexOp, and getMainTexOp.


Constructor & Destructor Documentation

NL3D::CPSMultiTexturedParticle::CPSMultiTexturedParticle  
 

ctor.

Definition at line 611 of file ps_particle_basic.cpp.


Member Function Documentation

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

test wether basic caps are forced.

Definition at line 572 of file ps_particle_basic.h.

References _ForceBasicCaps.

Referenced by setupMaterial.

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

Definition at line 609 of file ps_particle_basic.h.

References _MultiTexState, and BasicCapsForced.

Referenced by setupMaterial.

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

Definition at line 636 of file ps_particle_basic.cpp.

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

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

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

Definition at line 616 of file ps_particle_basic.cpp.

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

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 569 of file ps_particle_basic.h.

References _ForceBasicCaps.

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

Definition at line 610 of file ps_particle_basic.h.

References _MultiTexState, and BasicCapsForced.

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

Definition at line 551 of file ps_particle_basic.h.

References _TexScrollAlternate, and nlassert.

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

Definition at line 524 of file ps_particle_basic.h.

References _AlternateOp, and TOperator.

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

Definition at line 584 of file ps_particle_basic.h.

References _BumpFactor.

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

Definition at line 507 of file ps_particle_basic.h.

References _MainOp, and TOperator.

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

Definition at line 537 of file ps_particle_basic.h.

References _TexScroll, and nlassert.

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

Definition at line 500 of file ps_particle_basic.h.

References _Texture2.

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

Get the main texture for multitexturing.

Definition at line 499 of file ps_particle_basic.h.

References _Texture2.

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

Definition at line 519 of file ps_particle_basic.h.

References _AlternateTexture2.

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

Get the alternate texture for multitexturing.

Definition at line 518 of file ps_particle_basic.h.

References _AlternateTexture2.

bool NL3D::CPSMultiTexturedParticle::getUseLocalDate   [inline]
 

Definition at line 576 of file ps_particle_basic.h.

References _MultiTexState, and ScrollUseLocalDate.

Referenced by NL3D::CPSQuad::updateVbColNUVForRender.

bool NL3D::CPSMultiTexturedParticle::getUseLocalDateAlt   [inline]
 

Definition at line 580 of file ps_particle_basic.h.

References _MultiTexState, and ScrollUseLocalDateAlternate.

Referenced by NL3D::CPSQuad::updateVbColNUVForRender.

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

Definition at line 511 of file ps_particle_basic.h.

References _MultiTexState, and AlternateTextureEnabled.

Referenced by enableAlternateTex, and setupMaterial.

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

test wether the alternate texture is used.

Definition at line 603 of file ps_particle_basic.h.

References _MultiTexState, and AlternateTextureUsed.

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

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

Definition at line 604 of file ps_particle_basic.h.

References _MultiTexState, and EnvBumpMapUsed.

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

Definition at line 493 of file ps_particle_basic.h.

References _MultiTexState, and MultiTextureEnabled.

Referenced by enableAlternateTex, enableMultiTexture, setupMaterial, and NL3D::CPSQuad::updateMatBeforeRendering.

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

Definition at line 608 of file ps_particle_basic.h.

References _MultiTexState, and TouchFlag.

Referenced by setupMaterial.

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

serial this object.

Definition at line 657 of file ps_particle_basic.cpp.

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 546 of file ps_particle_basic.h.

References _TexScrollAlternate, and nlassert.

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 903 of file ps_particle_basic.cpp.

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

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

Set a bump factor (when embm is used).

Definition at line 583 of file ps_particle_basic.h.

References _BumpFactor, and 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 888 of file ps_particle_basic.cpp.

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

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 532 of file ps_particle_basic.h.

References _TexScroll, and nlassert.

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 870 of file ps_particle_basic.cpp.

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

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 855 of file ps_particle_basic.cpp.

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

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 713 of file ps_particle_basic.cpp.

References _AlternateOp, _AlternateTexture2, _BumpFactor, _ForceBasicCaps, _MainOp, _MultiTexState, _Texture2, AlternateTextureUsed, areBasicCapsForced, areBasicCapsForcedLocal, Decal, EnvBumpMap, EnvBumpMapUsed, isAlternateTexEnabled, isMultiTextureEnabled, isTouched, setupMultiTexEnv, and unTouch.

Referenced by NL3D::CPSQuad::updateMatBeforeRendering.

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

Definition at line 792 of file ps_particle_basic.cpp.

References Add, Decal, EnvBumpMap, and Modulate.

Referenced by setupMaterial.

void NL3D::CPSMultiTexturedParticle::setUseLocalDate bool    use
 

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

Definition at line 920 of file ps_particle_basic.cpp.

References _MultiTexState, and ScrollUseLocalDate.

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 928 of file ps_particle_basic.cpp.

References _MultiTexState, and ScrollUseLocalDateAlternate.

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

Definition at line 606 of file ps_particle_basic.h.

References _MultiTexState, and TouchFlag.

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

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

Definition at line 607 of file ps_particle_basic.h.

References _MultiTexState, and TouchFlag.

Referenced by setupMaterial.


Member Data Documentation

TOperator NL3D::CPSMultiTexturedParticle::_AlternateOp [protected]
 

Definition at line 588 of file ps_particle_basic.h.

Referenced by enableAlternateTex, getAlternateTexOp, NL3D::CPSQuad::getNeededVB, setAlternateTexOp, setTexture2Alternate, and setupMaterial.

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

Definition at line 590 of file ps_particle_basic.h.

Referenced by enableMultiTexture, getTexture2Alternate, setAlternateTexOp, setTexture2Alternate, setupMaterial, and NL3D::CPSQuad::updateVbColNUVForRender.

float NL3D::CPSMultiTexturedParticle::_BumpFactor [protected]
 

Definition at line 615 of file ps_particle_basic.h.

Referenced by getBumpFactor, setBumpFactor, and setupMaterial.

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

Definition at line 608 of file ps_particle_basic.cpp.

Referenced by areBasicCapsForced, forceBasicCaps, and setupMaterial.

TOperator NL3D::CPSMultiTexturedParticle::_MainOp [protected]
 

Definition at line 588 of file ps_particle_basic.h.

Referenced by enableMultiTexture, getMainTexOp, NL3D::CPSQuad::getNeededVB, setMainTexOp, setTexture2, and setupMaterial.

uint8 NL3D::CPSMultiTexturedParticle::_MultiTexState [protected]
 

Definition at line 600 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 593 of file ps_particle_basic.h.

Referenced by enableMultiTexture, NL3D::CPSQuad::getNeededVB, getScrollSpeed, setScrollSpeed, and NL3D::CPSQuad::updateVbColNUVForRender.

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

alternate texture scrollMultiTextureEnabled.

Definition at line 595 of file ps_particle_basic.h.

Referenced by enableAlternateTex, getAlternateScrollSpeed, NL3D::CPSQuad::getNeededVB, setAlternateScrollSpeed, and NL3D::CPSQuad::updateVbColNUVForRender.

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

Definition at line 589 of file ps_particle_basic.h.

Referenced by enableAlternateTex, enableMultiTexture, getTexture2, setMainTexOp, setTexture2, setupMaterial, and NL3D::CPSQuad::updateVbColNUVForRender.


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