# 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::CParticleSystemInstanceUser Class Reference

This is the implementation of the user class UParticleSystemInstance. More...

#include <particle_system_instance_user.h>

Inheritance diagram for NL3D::CParticleSystemInstanceUser:

NL3D::UParticleSystemInstance NL3D::CTransformUser NL3D::CParticleSystemModel::IPSModelObserver NL3D::UInstance NL3D::UTransform NL3D::CTransformableUser NL3D::UTransform NL3D::UTransformable NL3D::UTransformable NL3D::UTransformable List of all members.

Public Methods

virtual bool isShared () const
virtual void changeMRMDistanceSetup (float distanceFinest, float distanceMiddle, float distanceCoarsest)
 Change MRM Distance setup. More...

virtual void setShapeDistMax (float distMax)
 Change Max Display distance. More...

virtual float getShapeDistMax () const
 see setShapeDistMax(). More...

virtual void enableAsyncTextureMode (bool enable)
 if true, the instance is said in "AsyncTextureMode". More...

virtual bool getAsyncTextureMode () const
virtual void startAsyncTextureLoading ()
 Start to load all textures in AsyncTextures array (if needed) NB: old setup is kept in Material => instance is still rendered with "coherent" textures, until new textures are ready no op if not in async texture mode. More...

virtual bool isAsyncTextureReady ()
 return true if all the async textures of the instances are uploaded. More...

virtual void setAsyncTextureDistance (float dist)
 For Lod of texture, and load balancing, set the approximate distance of the instance to the camera. More...

virtual float getAsyncTextureDistance () const
virtual void setAsyncTextureDirty (bool flag)
 User is free to flag this state, to know if startAsyncTextureLoading() should be called. More...

virtual bool isAsyncTextureDirty () const
 see dirtAsyncTextureState(). More...

virtual float getDistMax () const
virtual void setDistMax (float distMax)
virtual void setCoarseMeshDist (float dist)
virtual float getCoarseMeshDist () const
 CParticleSystemInstanceUser (CScene *scene, IModel *model)
 ~CParticleSystemInstanceUser ()
virtual uint getNumMaterials () const
 return number of materials this mesh instance use. More...

virtual UInstanceMaterialgetMaterial (uint materialId)
 return a local access on a material, to change its values. (NB: overwrited, if animated). More...

virtual void selectTextureSet (uint id)
 Select textures of material among several sets (if available) NB: if success and if getAsyncTextureMode()==true, then setAsyncTextureDirty(true) is called. More...

virtual void getShapeAABBox (NLMISC::CAABBox &bbox) const
 Get the untransformed AABBox of the mesh. More...

virtual bool canStartStop ()
 Test if there is a start/stop caps in the objects (some fxs such as remanence). More...

virtual void start ()
virtual void stop ()
virtual bool isStarted () const
virtual bool emit (uint32 id, uint quantity)
 All the emitters that have the given ID emit their target. More...

virtual bool removeByID (uint32 id)
 All the object with the given id are removed. More...

virtual bool isSystemPresent (void) const
 Tell wether the system is currently instanciated. More...

virtual bool getSystemBBox (NLMISC::CAABBox &bbox)
 Get the bounding box of the system, when it is present. More...

virtual void setUserParam (uint index, float value)
 Set a user param of the system. More...

virtual float getUserParam (uint index) const
 Get the value of a user param. More...

virtual void bypassGlobalUserParamValue (uint userParamIndex, bool byPass=true)
virtual bool isGlobalUserParamValueBypassed (uint userParamIndex) const
virtual bool isValid (void) const
 Test if the system is valid. More...

virtual void registerPSObserver (IPSObserver *observer)
 Register an observer that will be notified when the system becomes invalid nlassert(!isPSObserver(oberver));. More...

virtual bool isPSObserver (IPSObserver *observer)
 test whether 'observer' is an observer of this system. More...

virtual void removePSObserver (IPSObserver *observer)
 remove 'observer' from the observers of this system. More...

virtual uint getNumID () const
 Return the number of objects in the system that are flagged with an ID, or 0 if the system is not present. More...

virtual uint32 getID (uint index) const
 Get the nth ID, or 0 if index is invalid. More...

virtual bool getIDs (std::vector< uint32 > &dest) const
 Get all the IDs in the system. More...

virtual bool setActive (uint32 id, bool active)
virtual bool activateEmitters (bool active)
virtual void invalidPS (CParticleSystemModel *psm)
 called when a system has been invalidated. More...

virtual bool hasParticles () const
virtual bool hasEmmiters () const

Private Attributes

std::vector< IPSObserver * > _Observers
 list of observers. More...

bool _Invalidated
 validity flag. More...


Detailed Description

This is the implementation of the user class UParticleSystemInstance.

Author:
Nicolas Vizerie , Nevrax France
Date:
2001

Definition at line 47 of file particle_system_instance_user.h.


Constructor & Destructor Documentation

NL3D::CParticleSystemInstanceUser::CParticleSystemInstanceUser CScene   scene,
IModel   model
 

Definition at line 38 of file particle_system_instance_user.cpp.

References NL3D_MEM_PS_INSTANCE.

NL3D::CParticleSystemInstanceUser::~CParticleSystemInstanceUser  
 

Definition at line 55 of file particle_system_instance_user.cpp.

References NL3D_MEM_PS_INSTANCE.


Member Function Documentation

bool NL3D::CParticleSystemInstanceUser::activateEmitters bool    active [virtual]
 

Implements NL3D::UParticleSystemInstance.

Definition at line 320 of file particle_system_instance_user.cpp.

References isSystemPresent, NLAISCRIPT::l, NL3D_MEM_PS_INSTANCE, and NL3D::PSEmitter.

void NL3D::CParticleSystemInstanceUser::bypassGlobalUserParamValue uint    userParamIndex,
bool    byPass = true
[virtual]
 

Implements NL3D::UParticleSystemInstance.

Definition at line 458 of file particle_system_instance_user.cpp.

References NL3D::MaxPSUserParam, NL3D_MEM_PS_INSTANCE, and nlwarning.

virtual bool NL3D::CParticleSystemInstanceUser::canStartStop   [inline, virtual]
 

Test if there is a start/stop caps in the objects (some fxs such as remanence).

Implements NL3D::UInstance.

Definition at line 69 of file particle_system_instance_user.h.

References NL3D_MEM_PS_INSTANCE.

void NL3D::CParticleSystemInstanceUser::changeMRMDistanceSetup float    distanceFinest,
float    distanceMiddle,
float    distanceCoarsest
[virtual]
 

Change MRM Distance setup.

Only for mesh which support MRM. NB MeshMultiLod apply it only on Lod0 (if Lod0 is a MRM). NB: This apply to the shape direclty!! ie All instances using same shape will be affected NB: no-op if distanceFinest<0, distanceMiddle<=distanceFinest or if distanceCoarsest<=distanceMiddle.

Parameters:
distanceFinest  The MRM has its max faces when dist<=distanceFinest.
distanceMiddle  The MRM has 50% of its faces at dist==distanceMiddle.
distanceCoarsest  The MRM has faces/Divisor (ie near 0) when dist>=distanceCoarsest.

Implements NL3D::UInstance.

Definition at line 241 of file particle_system_instance_user.cpp.

References NL3D_MEM_PS_INSTANCE.

bool NL3D::CParticleSystemInstanceUser::emit uint32    id,
uint    quantity
[virtual]
 

All the emitters that have the given ID emit their target.

Returns:
false if the id is invalid, or if it isn't an emitter ID

Implements NL3D::UParticleSystemInstance.

Definition at line 190 of file particle_system_instance_user.cpp.

References id, NL3D::IDToLittleEndian, isSystemPresent, NLAISCRIPT::l, NL3D_MEM_PS_INSTANCE, nlassert, and NL3D::PSEmitter.

void NL3D::CParticleSystemInstanceUser::enableAsyncTextureMode bool    enable [virtual]
 

if true, the instance is said in "AsyncTextureMode".

Ie user must fill AsyncTextures field with name of the textures to load. At each startAsyncTextureLoading(), the system start to load async them. Then, isAsyncTextureReady() should be test each frame, to know if loading has completed. By default, AsyncTextureMode=false. When it swap from false to true, each texture file in Materials are replaced with "blank.tga", and true fileNames are copied into AsyncTextures. When it swap from true to false, the inverse is applied. NB: calling enableAsyncTextureMode(true) calls setAsyncTextureDirty(true)

Implements NL3D::UInstance.

Definition at line 417 of file particle_system_instance_user.cpp.

References NL3D_MEM_PS_INSTANCE.

float NL3D::CParticleSystemInstanceUser::getAsyncTextureDistance   const [virtual]
 

See also:
setAsyncTextureDistance()

Implements NL3D::UInstance.

Definition at line 445 of file particle_system_instance_user.cpp.

bool NL3D::CParticleSystemInstanceUser::getAsyncTextureMode   const [virtual]
 

Implements NL3D::UInstance.

Definition at line 423 of file particle_system_instance_user.cpp.

References NL3D_MEM_PS_INSTANCE.

virtual float NL3D::CParticleSystemInstanceUser::getCoarseMeshDist   const [inline, virtual]
 

Implements NL3D::UInstance.

Definition at line 142 of file particle_system_instance_user.h.

virtual float NL3D::CParticleSystemInstanceUser::getDistMax   const [inline, virtual]
 

Implements NL3D::UInstance.

Definition at line 139 of file particle_system_instance_user.h.

uint32 NL3D::CParticleSystemInstanceUser::getID uint    index const [virtual]
 

Get the nth ID, or 0 if index is invalid.

Implements NL3D::UParticleSystemInstance.

Definition at line 258 of file particle_system_instance_user.cpp.

References index, isSystemPresent, and NL3D_MEM_PS_INSTANCE.

bool NL3D::CParticleSystemInstanceUser::getIDs std::vector< uint32 > &    dest const [virtual]
 

Get all the IDs in the system.

Warning:
As IDs are not stored in a vector, it is faster than several calls to getID

Implements NL3D::UParticleSystemInstance.

Definition at line 267 of file particle_system_instance_user.cpp.

References isSystemPresent, and NL3D_MEM_PS_INSTANCE.

UInstanceMaterial & NL3D::CParticleSystemInstanceUser::getMaterial uint    materialId [virtual]
 

return a local access on a material, to change its values. (NB: overwrited, if animated).

Implements NL3D::UInstance.

Definition at line 165 of file particle_system_instance_user.cpp.

References NL3D_MEM_PS_INSTANCE, and nlassert.

uint NL3D::CParticleSystemInstanceUser::getNumID   const [virtual]
 

Return the number of objects in the system that are flagged with an ID, or 0 if the system is not present.

Implements NL3D::UParticleSystemInstance.

Definition at line 249 of file particle_system_instance_user.cpp.

References isSystemPresent, and NL3D_MEM_PS_INSTANCE.

uint NL3D::CParticleSystemInstanceUser::getNumMaterials   const [virtual]
 

return number of materials this mesh instance use.

Implements NL3D::UInstance.

Definition at line 158 of file particle_system_instance_user.cpp.

References NL3D_MEM_PS_INSTANCE.

void NL3D::CParticleSystemInstanceUser::getShapeAABBox NLMISC::CAABBox   bbox const [virtual]
 

Get the untransformed AABBox of the mesh.

NULL (gtSize()==0) if no mesh.

Implements NL3D::UInstance.

Definition at line 47 of file particle_system_instance_user.cpp.

References NL3D_MEM_PS_INSTANCE.

float NL3D::CParticleSystemInstanceUser::getShapeDistMax   const [virtual]
 

see setShapeDistMax().

Implements NL3D::UInstance.

Definition at line 289 of file particle_system_instance_user.cpp.

References NL3D_MEM_PS_INSTANCE.

bool NL3D::CParticleSystemInstanceUser::getSystemBBox NLMISC::CAABBox   bbox [virtual]
 

Get the bounding box of the system, when it is present.

You should call this instead of UInstance::getShapeAABBox() because the bbox may change over time, and thusn its shape doesn't hold any info on it...

Parameters:
bbox  a reference to the bbox to fill
Returns:
true if the bbox has been filled
See also:
isPresent()

Implements NL3D::UParticleSystemInstance.

Definition at line 72 of file particle_system_instance_user.cpp.

References NL3D_MEM_PS_INSTANCE.

float NL3D::CParticleSystemInstanceUser::getUserParam uint    index const [virtual]
 

Get the value of a user param.

Parameters:
index  the index of the user param to get. For now it ranges from 0 to 3
Returns:
the value of the user param (>= 0 and <= 1)
See also:
isSystemPresent()

Implements NL3D::UParticleSystemInstance.

Definition at line 98 of file particle_system_instance_user.cpp.

References index, NL3D::MaxPSUserParam, NL3D_MEM_PS_INSTANCE, and nlwarning.

bool NL3D::CParticleSystemInstanceUser::hasEmmiters   const [virtual]
 

Implements NL3D::UParticleSystemInstance.

Definition at line 350 of file particle_system_instance_user.cpp.

References isSystemPresent, and NL3D_MEM_PS_INSTANCE.

bool NL3D::CParticleSystemInstanceUser::hasParticles   const [virtual]
 

Implements NL3D::UParticleSystemInstance.

Definition at line 341 of file particle_system_instance_user.cpp.

References isSystemPresent, and NL3D_MEM_PS_INSTANCE.

void NL3D::CParticleSystemInstanceUser::invalidPS CParticleSystemModel   psm [virtual]
 

called when a system has been invalidated.

Implements NL3D::CParticleSystemModel::IPSModelObserver.

Definition at line 145 of file particle_system_instance_user.cpp.

References _Invalidated, _Observers, and NL3D_MEM_PS_INSTANCE.

bool NL3D::CParticleSystemInstanceUser::isAsyncTextureDirty   const [virtual]
 

see dirtAsyncTextureState().

Implements NL3D::UInstance.

Definition at line 452 of file particle_system_instance_user.cpp.

bool NL3D::CParticleSystemInstanceUser::isAsyncTextureReady   [virtual]
 

return true if all the async textures of the instances are uploaded.

if was not ready before, this swap the upload textures into the rendered ones so they are rendered return always true if not in async texture mode, or if startAsyncTextureLoading() has not been called since last enableAsyncTextureMode(true)

Implements NL3D::UInstance.

Definition at line 436 of file particle_system_instance_user.cpp.

References NL3D_MEM_PS_INSTANCE.

bool NL3D::CParticleSystemInstanceUser::isGlobalUserParamValueBypassed uint    userParamIndex const [virtual]
 

Implements NL3D::UParticleSystemInstance.

Definition at line 471 of file particle_system_instance_user.cpp.

References NL3D::MaxPSUserParam, NL3D_MEM_PS_INSTANCE, and nlwarning.

bool NL3D::CParticleSystemInstanceUser::isPSObserver IPSObserver *    observer [virtual]
 

test whether 'observer' is an observer of this system.

See also:
removePSObserver() , registerPSObserver()

Implements NL3D::UParticleSystemInstance.

Definition at line 128 of file particle_system_instance_user.cpp.

References _Observers, and NL3D_MEM_PS_INSTANCE.

Referenced by registerPSObserver, and removePSObserver.

bool NL3D::CParticleSystemInstanceUser::isShared   const [virtual]
 

Implements NL3D::UParticleSystemInstance.

Definition at line 358 of file particle_system_instance_user.cpp.

References NL3D_MEM_PS_INSTANCE.

virtual bool NL3D::CParticleSystemInstanceUser::isStarted   const [inline, virtual]
 

Implements NL3D::UInstance.

Definition at line 82 of file particle_system_instance_user.h.

References NL3D_MEM_PS_INSTANCE.

bool NL3D::CParticleSystemInstanceUser::isSystemPresent void    const [virtual]
 

Tell wether the system is currently instanciated.

This may not be the case when the system is not visible You must check this before you use any method that access the system. If you don't, there will be an assertion when you'll try to access it example : UParticleSystemInstance *mySystem = ... ... if (mySystem->isSystemPresent()) { /// perform modification on the system here mySystem->setUserParam(0, 0.5f); }

See also:
isValid()

Implements NL3D::UParticleSystemInstance.

Definition at line 63 of file particle_system_instance_user.cpp.

References NL3D_MEM_PS_INSTANCE.

Referenced by activateEmitters, emit, getID, getIDs, getNumID, hasEmmiters, hasParticles, removeByID, and setActive.

bool NL3D::CParticleSystemInstanceUser::isValid void    const [virtual]
 

Test if the system is valid.

A system is invalid when it should be destroyed. It's then up to the system user to destroy it (thus avoiding invalid pointers...) This usually happens when the system has been created with the flag 'destroy when no more particles' or 'destroy when no more emitter and no more particles' , or when it is out of range. Of course, an invalid system will always return false when isSystemPresent() is called...

Returns:
true if the system has been invalidated. You can remove this object from the scene then...

Implements NL3D::UParticleSystemInstance.

Definition at line 113 of file particle_system_instance_user.cpp.

References _Invalidated, and NL3D_MEM_PS_INSTANCE.

void NL3D::CParticleSystemInstanceUser::registerPSObserver IPSObserver *    observer [virtual]
 

Register an observer that will be notified when the system becomes invalid nlassert(!isPSObserver(oberver));.

See also:
isPSObserver() , removePSObserver()

Implements NL3D::UParticleSystemInstance.

Definition at line 120 of file particle_system_instance_user.cpp.

References _Observers, isPSObserver, NL3D_MEM_PS_INSTANCE, and nlassert.

bool NL3D::CParticleSystemInstanceUser::removeByID uint32    id [virtual]
 

All the object with the given id are removed.

Returns:
false if the id is invalid.

Implements NL3D::UParticleSystemInstance.

Definition at line 218 of file particle_system_instance_user.cpp.

References id, NL3D::IDToLittleEndian, isSystemPresent, NLAISCRIPT::l, NL3D_MEM_PS_INSTANCE, and nlassert.

void NL3D::CParticleSystemInstanceUser::removePSObserver IPSObserver *    observer [virtual]
 

remove 'observer' from the observers of this system.

Not an observer => nlassert

See also:
registerPSObserver() , isPSObserver()

Implements NL3D::UParticleSystemInstance.

Definition at line 136 of file particle_system_instance_user.cpp.

References _Observers, isPSObserver, NL3D_MEM_PS_INSTANCE, and nlassert.

virtual void NL3D::CParticleSystemInstanceUser::selectTextureSet uint    id [inline, virtual]
 

Select textures of material among several sets (if available) NB: if success and if getAsyncTextureMode()==true, then setAsyncTextureDirty(true) is called.

Implements NL3D::UInstance.

Definition at line 63 of file particle_system_instance_user.h.

References id, NL3D_MEM_PS_INSTANCE, and nlassert.

bool NL3D::CParticleSystemInstanceUser::setActive uint32    id,
bool    active
[virtual]
 

Implements NL3D::UParticleSystemInstance.

Definition at line 302 of file particle_system_instance_user.cpp.

References id, NL3D::IDToLittleEndian, isSystemPresent, and NL3D_MEM_PS_INSTANCE.

void NL3D::CParticleSystemInstanceUser::setAsyncTextureDirty bool    flag [virtual]
 

User is free to flag this state, to know if startAsyncTextureLoading() should be called.

Internal system don't use this flag. Default is false

Implements NL3D::UInstance.

Definition at line 449 of file particle_system_instance_user.cpp.

void NL3D::CParticleSystemInstanceUser::setAsyncTextureDistance float    dist [virtual]
 

For Lod of texture, and load balancing, set the approximate distance of the instance to the camera.

Implements NL3D::UInstance.

Definition at line 441 of file particle_system_instance_user.cpp.

References NL3D_MEM_PS_INSTANCE.

virtual void NL3D::CParticleSystemInstanceUser::setCoarseMeshDist float    dist [inline, virtual]
 

Implements NL3D::UInstance.

Definition at line 141 of file particle_system_instance_user.h.

virtual void NL3D::CParticleSystemInstanceUser::setDistMax float    distMax [inline, virtual]
 

Implements NL3D::UInstance.

Definition at line 140 of file particle_system_instance_user.h.

void NL3D::CParticleSystemInstanceUser::setShapeDistMax float    distMax [virtual]
 

Change Max Display distance.

After this distance the shape won't be displayed. setting <0 means -1 and so means DistMax = infinite (default in meshs but multilod meshes). NB: This apply to the shape direclty!! ie All instances using same shape will be affected

Note: If the instance is skinned/sticked to a skeleton, this setup is not taken into account. But you can call USkeleton::setShapeDistMax() to have same effect.

Note (complex): All instances of the same shape which are freezeHRC()-ed and are linked to the QuadGridClipManager (ie not linked to a cluster) may not be updated corretcly. In other words, you should setup this value only at beginning of program, just after creating your instance (more exactly before UScene::render()), and all instances of the same shape should be setuped with same value (or don't call setShapeDistMax() for subsequent instances). If you don't do this, QuadGridClipManager may clip such instances nearer than they should

Implements NL3D::UInstance.

Definition at line 278 of file particle_system_instance_user.cpp.

References NL3D_MEM_PS_INSTANCE.

void NL3D::CParticleSystemInstanceUser::setUserParam uint    index,
float    value
[virtual]
 

Set a user param of the system.

Each user param must be >= 0 and <= 1

Parameters:
index  the index of the user param to modify. For now it ranges from 0 to 3 \value the new value of the parameter
See also:
isSystemPresent()

Implements NL3D::UParticleSystemInstance.

Definition at line 83 of file particle_system_instance_user.cpp.

References index, NL3D::MaxPSUserParam, nlwarning, and value.

virtual void NL3D::CParticleSystemInstanceUser::start   [inline, virtual]
 

Implements NL3D::UInstance.

Definition at line 74 of file particle_system_instance_user.h.

References NL3D_MEM_PS_INSTANCE.

void NL3D::CParticleSystemInstanceUser::startAsyncTextureLoading   [virtual]
 

Start to load all textures in AsyncTextures array (if needed) NB: old setup is kept in Material => instance is still rendered with "coherent" textures, until new textures are ready no op if not in async texture mode.

Implements NL3D::UInstance.

Definition at line 430 of file particle_system_instance_user.cpp.

References NL3D_MEM_PS_INSTANCE.

virtual void NL3D::CParticleSystemInstanceUser::stop void    [inline, virtual]
 

Implements NL3D::UInstance.

Definition at line 78 of file particle_system_instance_user.h.

References NL3D_MEM_PS_INSTANCE.


Member Data Documentation

bool NL3D::CParticleSystemInstanceUser::_Invalidated [private]
 

validity flag.

Definition at line 148 of file particle_system_instance_user.h.

Referenced by invalidPS, and isValid.

std::vector<IPSObserver *> NL3D::CParticleSystemInstanceUser::_Observers [private]
 

list of observers.

Definition at line 146 of file particle_system_instance_user.h.

Referenced by invalidPS, isPSObserver, registerPSObserver, and removePSObserver.


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