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

A particle system model : it is built using a CParticleSystemShape. More...

#include <particle_system_model.h>

Inheritance diagram for NL3D::CParticleSystemModel:

NL3D::CTransformShape NL3D::CTransform NL3D::IModel NL3D::ITransformable NLMISC::CRefCount NL3D::IAnimatable List of all members.

User params / animation

enum  TAnimValues {
  OwnerBit = CTransformShape::AnimValueLast, PSParam0, PSParam1, PSParam2,
  PSParam3, PSTrigger, AnimValueLast
}
 for now, we have 4 animatables value in a system. More...

virtual IAnimatedValuegetValue (uint valueId)
 =====================================================================================. More...

virtual const char * getValueName (uint valueId) const
 =====================================================================================. More...

virtual ITrackgetDefaultTrack (uint valueId)
 =====================================================================================. More...

virtual void registerToChannelMixer (CChannelMixer *chanMixer, const std::string &prefix="")
 =====================================================================================. More...

void bypassGlobalUserParamValue (uint userParamIndex, bool byPass=true)
 NB : we don't do this test here for always animated system, as it is done by the CParticleSystemManager, because this code is not sure to be executed if the system has been clipped by a cluster. More...

bool isGlobalUserParamValueBypassed (uint userParamIndex) const
const char * getPSParamName (uint valueId)
 =====================================================================================. More...


Object

 CParticleSystemModel ()
 ===================================================================================== ctor. More...

 ~CParticleSystemModel ()
 =====================================================================================. More...

void registerBasic ()
 =====================================================================================. More...


Public Types


Public Methods

void updateOpacityInfos (void)
 =====================================================================================. More...

const CMatrix & getWorldMatrix (void)
 get the world matrix. More...

virtual void getAABBox (NLMISC::CAABBox &bbox) const
 =====================================================================================. More...

virtual float getNumTriangles (float distance)
 =====================================================================================. More...

Embedded particle system
CParticleSystemgetPS (void)
 Get the particle system contained in this transform shape. More...

const CParticleSystemgetPS (void) const
 Get the particle system (NB : This is shared by a smart ptr) contained in this transform shape. More...

void setParticleSystem (CParticleSystem *ps)
 Set the particle system for this transform shape after it has been instanciated (from a memory stream, or by sharing) see CParticleSystemShape. More...

Life managment
bool isInvalid (void) const
 test wether the system has become invalid. More...

void registerPSModelObserver (IPSModelObserver *obs)
 =====================================================================================. More...

void removePSModelObserver (IPSModelObserver *obs)
 =====================================================================================. More...

bool isPSModelObserver (IPSModelObserver *obs)
 =====================================================================================. More...

void enableAutoGetEllapsedTime (bool enable=true)
 when called with true, this force the model to querry himself the ellapsed time to the scene. More...

void setEllapsedTimeRatio (float value)
 This apply a ratio on the ellapsed time. More...

float getEllapsedTimeRatio () const
bool isAutoGetEllapsedTimeEnabled (void) const
 tells wether the model will querry himself for the ellapsed time. More...

void setEllapsedTime (TAnimationTime ellapsedTime)
 set the ellapsed time (in second) used for animation. More...

TAnimationTime getEllapsedTime (void) const
 get the ellapsed time used for animation. More...

Edition related methods
void enableDisplayTools (bool enable=true)
 activate the display of tool (for edition purpose). More...

bool isToolDisplayEnabled (void) const
void setEditionMode (bool enable=true)
 =====================================================================================. More...

bool getEditionMode (void) const
 test if edition mode is activated. More...

void touchTransparencyState (void)
 edition purpose : touch the system to tell that the transparency state of the system has changed (added/removes opaque/tansparent faces ). More...


Static Public Methods

IModelcreator ()
 create an instance of this class. More...


Private Methods

void reallocRsc ()
 ===================================================================================== Called when the resource (attached system) for this system must be reallocated. More...

bool refreshRscDeletion (const std::vector< CPlane > &worldFrustumPyramid, const NLMISC::CVector &viewerPos)
 =====================================================================================. More...

void releaseRsc ()
 =====================================================================================. More...

void releaseRscAndInvalidate ()
 =====================================================================================. More...

bool checkAgainstPyramid (const std::vector< CPlane > &worldFrustumPyramid) const
 =========================================================================================. More...

void releasePSPointer ()
 =====================================================================================. More...


Private Attributes

CParticleSystemManager::TModelHandle _ModelHandle
CParticleSystemManager::TModelHandle _AnimatedModelHandle
 a handle to say when the resources of the model (_ParticleSystem) are deleted. More...

bool _AutoGetEllapsedTime
NLMISC::CSmartPtr< CParticleSystem_ParticleSystem
CScene_Scene
TAnimationTime _EllapsedTime
float _EllapsedTimeRatio
bool _ToolDisplayEnabled
bool _TransparencyStateTouched
bool _EditionMode
bool _Invalidated
bool _InsertedInVisibleList
 if false, system should be recreated. More...

bool _InClusterAndVisible
std::vector< IPSModelObserver * > _Observers
CAnimatedValueBool _TriggerAnimatedValue
CAnimatedValueFloat _UserParam [MaxPSUserParam]
 user params of the system. More...

uint8 _BypassGlobalUserParam

Friends

class CParticleSystemShape
class CParticleSystemDetailObs
class CParticleSystemClipObs
class CParticleSystemRenderObs
class CParticleSystemManager

Detailed Description

A particle system model : it is built using a CParticleSystemShape.

You should forgot to call the animate() method of the CScene it is part of if you want motion to be performed

Definition at line 60 of file particle_system_model.h.


Member Enumeration Documentation

enum NL3D::CParticleSystemModel::TAnimValues
 

for now, we have 4 animatables value in a system.

Enumeration values:
OwnerBit 
PSParam0 
PSParam1 
PSParam2 
PSParam3 
PSTrigger 
AnimValueLast 

Reimplemented from NL3D::ITransformable.

Definition at line 204 of file particle_system_model.h.


Constructor & Destructor Documentation

NL3D::CParticleSystemModel::CParticleSystemModel  
 

===================================================================================== ctor.

Definition at line 51 of file particle_system_model.cpp.

References _TriggerAnimatedValue, AnimValueLast, NL3D::CTransform::setOpacity, and NL3D::CTransform::setTransparency.

Referenced by creator.

NL3D::CParticleSystemModel::~CParticleSystemModel  
 

=====================================================================================.

Definition at line 149 of file particle_system_model.cpp.

References NL3D::CTransform::_FatherSkeletonModel, _ModelHandle, _Scene, and nlassert.


Member Function Documentation

void NL3D::CParticleSystemModel::bypassGlobalUserParamValue uint    userParamIndex,
bool    byPass = true
 

NB : we don't do this test here for always animated system, as it is done by the CParticleSystemManager, because this code is not sure to be executed if the system has been clipped by a cluster.

Definition at line 789 of file particle_system_model.cpp.

References _BypassGlobalUserParam, NL3D::MaxPSUserParam, nlassert, and nlctassert.

bool NL3D::CParticleSystemModel::checkAgainstPyramid const std::vector< CPlane > &    worldFrustumPyramid const [private]
 

=========================================================================================.

Definition at line 382 of file particle_system_model.cpp.

References _ParticleSystem, NLMISC::CAABBox::clipBack, NL3D::ITransformable::getMatrix, and nlassert.

Referenced by refreshRscDeletion.

IModel* NL3D::CParticleSystemModel::creator   [inline, static]
 

create an instance of this class.

Reimplemented from NL3D::CTransformShape.

Definition at line 239 of file particle_system_model.h.

References CParticleSystemModel, and NL3D::IModel::IModel.

void NL3D::CParticleSystemModel::enableAutoGetEllapsedTime bool    enable = true [inline]
 

when called with true, this force the model to querry himself the ellapsed time to the scene.

This is the default. Otherwise, setEllapsedTime must be called

Definition at line 138 of file particle_system_model.h.

References _AutoGetEllapsedTime.

void NL3D::CParticleSystemModel::enableDisplayTools bool    enable = true [inline]
 

activate the display of tool (for edition purpose).

Definition at line 173 of file particle_system_model.h.

References _ToolDisplayEnabled, and touchTransparencyState.

void NL3D::CParticleSystemModel::getAABBox NLMISC::CAABBox   bbox const [virtual]
 

=====================================================================================.

Reimplemented from NL3D::CTransformShape.

Definition at line 136 of file particle_system_model.cpp.

References _ParticleSystem, and NL3D::CTransformShape::Shape.

ITrack * NL3D::CParticleSystemModel::getDefaultTrack uint    valueId [virtual]
 

=====================================================================================.

Reimplemented from NL3D::CTransform.

Definition at line 339 of file particle_system_model.cpp.

References AnimValueLast, CParticleSystemShape, nlassert, OwnerBit, NL3D::ITransformable::PosValue, PSParam0, PSTrigger, NL3D::ITransformable::RotQuatValue, NL3D::ITransformable::ScaleValue, and NL3D::CTransformShape::Shape.

bool NL3D::CParticleSystemModel::getEditionMode void    const [inline]
 

test if edition mode is activated.

Definition at line 190 of file particle_system_model.h.

References _EditionMode.

TAnimationTime NL3D::CParticleSystemModel::getEllapsedTime void    const [inline]
 

get the ellapsed time used for animation.

Definition at line 164 of file particle_system_model.h.

References _EllapsedTime, and NL3D::TAnimationTime.

float NL3D::CParticleSystemModel::getEllapsedTimeRatio   const [inline]
 

Definition at line 152 of file particle_system_model.h.

References _EllapsedTimeRatio.

float NL3D::CParticleSystemModel::getNumTriangles float    distance [virtual]
 

=====================================================================================.

Reimplemented from NL3D::CTransformShape.

Definition at line 375 of file particle_system_model.cpp.

References _ParticleSystem.

const CParticleSystem* NL3D::CParticleSystemModel::getPS void    const [inline]
 

Get the particle system (NB : This is shared by a smart ptr) contained in this transform shape.

This may be null if the model is not visible.

Definition at line 89 of file particle_system_model.h.

References _ParticleSystem.

CParticleSystem* NL3D::CParticleSystemModel::getPS void    [inline]
 

Get the particle system contained in this transform shape.

(NB: This is shared by a smart ptr)

Returns:
pointer to the system, or NULL if no system is currently hold by this model. this may happen when the system is not visible and that it has been deleted

Definition at line 81 of file particle_system_model.h.

References _ParticleSystem.

const char * NL3D::CParticleSystemModel::getPSParamName uint    valueId [static]
 

=====================================================================================.

Definition at line 322 of file particle_system_model.cpp.

References AnimValueLast, nlassert, and PSParam0.

Referenced by getValueName.

IAnimatedValue * NL3D::CParticleSystemModel::getValue uint    valueId [virtual]
 

=====================================================================================.

Reimplemented from NL3D::ITransformable.

Definition at line 309 of file particle_system_model.cpp.

References _TriggerAnimatedValue, _UserParam, AnimValueLast, nlassert, OwnerBit, PSParam0, and PSTrigger.

const char * NL3D::CParticleSystemModel::getValueName uint    valueId const [virtual]
 

=====================================================================================.

Reimplemented from NL3D::ITransformable.

Definition at line 330 of file particle_system_model.cpp.

References AnimValueLast, getPSParamName, nlassert, OwnerBit, and PSTrigger.

const CMatrix& NL3D::CParticleSystemModel::getWorldMatrix void    [inline]
 

get the world matrix.

Reimplemented from NL3D::CTransform.

Definition at line 230 of file particle_system_model.h.

References NL3D::IModel::getObs, and NL3D::HrcTravId.

Referenced by refreshRscDeletion.

bool NL3D::CParticleSystemModel::isAutoGetEllapsedTimeEnabled void    const [inline]
 

tells wether the model will querry himself for the ellapsed time.

Definition at line 154 of file particle_system_model.h.

References _AutoGetEllapsedTime.

bool NL3D::CParticleSystemModel::isGlobalUserParamValueBypassed uint    userParamIndex const
 

Definition at line 798 of file particle_system_model.cpp.

References _BypassGlobalUserParam, NL3D::MaxPSUserParam, nlassert, and nlctassert.

bool NL3D::CParticleSystemModel::isInvalid void    const [inline]
 

test wether the system has become invalid.

The condition for a system to be invalid are encoded in the system itself (no more particles for example). When a system has become invalid, you may want to remove it most of the time

Definition at line 111 of file particle_system_model.h.

References _Invalidated.

bool NL3D::CParticleSystemModel::isPSModelObserver IPSModelObserver   obs
 

=====================================================================================.

Definition at line 107 of file particle_system_model.cpp.

References _Observers.

Referenced by registerPSModelObserver, and removePSModelObserver.

bool NL3D::CParticleSystemModel::isToolDisplayEnabled void    const [inline]
 

Definition at line 178 of file particle_system_model.h.

References _ToolDisplayEnabled.

void NL3D::CParticleSystemModel::reallocRsc   [private]
 

===================================================================================== Called when the resource (attached system) for this system must be reallocated.

Definition at line 169 of file particle_system_model.cpp.

References _AnimatedModelHandle, _ModelHandle, _ParticleSystem, _Scene, CParticleSystemManager, NL3D::MaxPSUserParam, nlassert, OwnerBit, NL3D::CTransformShape::Shape, and NL3D::IAnimatable::touch.

Referenced by setEditionMode.

bool NL3D::CParticleSystemModel::refreshRscDeletion const std::vector< CPlane > &    worldFrustumPyramid,
const NLMISC::CVector   viewerPos
[private]
 

=====================================================================================.

IMPORTANT: the handle of the model in the p.s manager is automatically removed when this returns true

Definition at line 205 of file particle_system_model.cpp.

References _AnimatedModelHandle, _Invalidated, _ParticleSystem, _Scene, checkAgainstPyramid, CParticleSystemShape, getWorldMatrix, nlassert, releasePSPointer, NL3D::CTransformShape::Shape, and v.

void NL3D::CParticleSystemModel::registerBasic   [static]
 

=====================================================================================.

Reimplemented from NL3D::CTransformShape.

Definition at line 114 of file particle_system_model.cpp.

References NL3D::AnimDetailTravId, NL3D::ClipTravId, NL3D::ParticleSystemModelId, NL3D::RenderTravId, and NL3D::TransformShapeId.

void NL3D::CParticleSystemModel::registerPSModelObserver IPSModelObserver   obs
 

=====================================================================================.

Definition at line 91 of file particle_system_model.cpp.

References _Observers, isPSModelObserver, and nlassert.

void NL3D::CParticleSystemModel::registerToChannelMixer CChannelMixer   chanMixer,
const std::string &    prefix = ""
[virtual]
 

=====================================================================================.

Reimplemented from NL3D::CTransform.

Definition at line 363 of file particle_system_model.cpp.

References NL3D::IAnimatable::addValue, OwnerBit, PSParam0, PSParam1, PSParam2, PSParam3, and PSTrigger.

void NL3D::CParticleSystemModel::releasePSPointer   [private]
 

=====================================================================================.

Definition at line 189 of file particle_system_model.cpp.

References _ParticleSystem, _UserParam, NLMISC::CSmartPtr< CParticleSystem >::getNbRef, and NL3D::MaxPSUserParam.

Referenced by refreshRscDeletion, and releaseRscAndInvalidate.

void NL3D::CParticleSystemModel::releaseRsc   [private]
 

=====================================================================================.

Why do we test this here addtionnaly to the clip traversal ? Simply because the clip observer is not called if the cluster it is inserted in is not parsed. This is not good, because we want to keep few CParticleSystem instance. This method solve that problem. This is called by the particle system manager when each scene has rendered

Definition at line 268 of file particle_system_model.cpp.

References _AnimatedModelHandle, _ModelHandle, _ParticleSystem, _Scene, and nlassert.

void NL3D::CParticleSystemModel::releaseRscAndInvalidate   [private]
 

=====================================================================================.

Definition at line 282 of file particle_system_model.cpp.

References _AnimatedModelHandle, _Invalidated, _ModelHandle, _Observers, _ParticleSystem, _Scene, nlassert, and releasePSPointer.

void NL3D::CParticleSystemModel::removePSModelObserver IPSModelObserver   obs
 

=====================================================================================.

See also:
registerPSModelObserver

Definition at line 98 of file particle_system_model.cpp.

References _Observers, isPSModelObserver, and nlassert.

void NL3D::CParticleSystemModel::setEditionMode bool    enable = true
 

=====================================================================================.

When the model is first allocated, the system resource are not allocated until it becomes visible. This also forces the resources to be allocated. when there are no more particles in it etc. (this also mean that you can safely keep a pointer on it) This flag is not saved.

Definition at line 75 of file particle_system_model.cpp.

References _EditionMode, _ParticleSystem, _Scene, nlassert, reallocRsc, and NL3D::CTransformShape::Shape.

void NL3D::CParticleSystemModel::setEllapsedTime TAnimationTime    ellapsedTime [inline]
 

set the ellapsed time (in second) used for animation.

Definition at line 159 of file particle_system_model.h.

References _EllapsedTime, and NL3D::TAnimationTime.

void NL3D::CParticleSystemModel::setEllapsedTimeRatio float    value [inline]
 

This apply a ratio on the ellapsed time.

This can be used to slow down a system This must be in the >= 0. 1 means the system run at normal speed

Definition at line 146 of file particle_system_model.h.

References _EllapsedTimeRatio, nlassert, and value.

void NL3D::CParticleSystemModel::setParticleSystem CParticleSystem   ps [inline]
 

Set the particle system for this transform shape after it has been instanciated (from a memory stream, or by sharing) see CParticleSystemShape.

Definition at line 97 of file particle_system_model.h.

References _ParticleSystem, nlassert, and updateOpacityInfos.

void NL3D::CParticleSystemModel::touchTransparencyState void    [inline]
 

edition purpose : touch the system to tell that the transparency state of the system has changed (added/removes opaque/tansparent faces ).

Definition at line 195 of file particle_system_model.h.

References _TransparencyStateTouched.

Referenced by enableDisplayTools.

void NL3D::CParticleSystemModel::updateOpacityInfos void   
 

=====================================================================================.

This must be called when the system is instanciated, or when attributes have changed, such as the blending mode

Definition at line 124 of file particle_system_model.cpp.

References _ParticleSystem, _ToolDisplayEnabled, _TransparencyStateTouched, nlassert, NL3D::CTransform::setOpacity, and NL3D::CTransform::setTransparency.

Referenced by setParticleSystem.


Friends And Related Function Documentation

friend class CParticleSystemClipObs [friend]
 

Definition at line 248 of file particle_system_model.h.

friend class CParticleSystemDetailObs [friend]
 

Definition at line 247 of file particle_system_model.h.

friend class CParticleSystemManager [friend]
 

Definition at line 250 of file particle_system_model.h.

Referenced by reallocRsc.

friend class CParticleSystemRenderObs [friend]
 

Definition at line 249 of file particle_system_model.h.

friend class CParticleSystemShape [friend]
 

Definition at line 246 of file particle_system_model.h.

Referenced by getDefaultTrack, and refreshRscDeletion.


Member Data Documentation

CParticleSystemManager::TModelHandle NL3D::CParticleSystemModel::_AnimatedModelHandle [private]
 

a handle to say when the resources of the model (_ParticleSystem) are deleted.

Definition at line 275 of file particle_system_model.h.

Referenced by reallocRsc, refreshRscDeletion, releaseRsc, and releaseRscAndInvalidate.

bool NL3D::CParticleSystemModel::_AutoGetEllapsedTime [private]
 

Definition at line 277 of file particle_system_model.h.

Referenced by enableAutoGetEllapsedTime, and isAutoGetEllapsedTimeEnabled.

uint8 NL3D::CParticleSystemModel::_BypassGlobalUserParam [private]
 

Definition at line 294 of file particle_system_model.h.

Referenced by bypassGlobalUserParamValue, and isGlobalUserParamValueBypassed.

bool NL3D::CParticleSystemModel::_EditionMode [private]
 

Definition at line 286 of file particle_system_model.h.

Referenced by getEditionMode, and setEditionMode.

TAnimationTime NL3D::CParticleSystemModel::_EllapsedTime [private]
 

Definition at line 280 of file particle_system_model.h.

Referenced by getEllapsedTime, and setEllapsedTime.

float NL3D::CParticleSystemModel::_EllapsedTimeRatio [private]
 

Definition at line 281 of file particle_system_model.h.

Referenced by getEllapsedTimeRatio, and setEllapsedTimeRatio.

bool NL3D::CParticleSystemModel::_InClusterAndVisible [private]
 

Definition at line 289 of file particle_system_model.h.

bool NL3D::CParticleSystemModel::_InsertedInVisibleList [private]
 

if false, system should be recreated.

Definition at line 288 of file particle_system_model.h.

bool NL3D::CParticleSystemModel::_Invalidated [private]
 

Definition at line 287 of file particle_system_model.h.

Referenced by isInvalid, refreshRscDeletion, and releaseRscAndInvalidate.

CParticleSystemManager::TModelHandle NL3D::CParticleSystemModel::_ModelHandle [private]
 

Definition at line 271 of file particle_system_model.h.

Referenced by reallocRsc, releaseRsc, releaseRscAndInvalidate, and ~CParticleSystemModel.

std::vector<IPSModelObserver *> NL3D::CParticleSystemModel::_Observers [private]
 

Definition at line 290 of file particle_system_model.h.

Referenced by isPSModelObserver, registerPSModelObserver, releaseRscAndInvalidate, and removePSModelObserver.

NLMISC::CSmartPtr<CParticleSystem> NL3D::CParticleSystemModel::_ParticleSystem [private]
 

Definition at line 278 of file particle_system_model.h.

Referenced by checkAgainstPyramid, getAABBox, getNumTriangles, getPS, reallocRsc, refreshRscDeletion, releasePSPointer, releaseRsc, releaseRscAndInvalidate, setEditionMode, setParticleSystem, and updateOpacityInfos.

CScene* NL3D::CParticleSystemModel::_Scene [private]
 

Definition at line 279 of file particle_system_model.h.

Referenced by reallocRsc, refreshRscDeletion, releaseRsc, releaseRscAndInvalidate, setEditionMode, and ~CParticleSystemModel.

bool NL3D::CParticleSystemModel::_ToolDisplayEnabled [private]
 

Todo:
nico : may optimize this with a bitfield...

Definition at line 284 of file particle_system_model.h.

Referenced by enableDisplayTools, isToolDisplayEnabled, and updateOpacityInfos.

bool NL3D::CParticleSystemModel::_TransparencyStateTouched [private]
 

Definition at line 285 of file particle_system_model.h.

Referenced by touchTransparencyState, and updateOpacityInfos.

CAnimatedValueBool NL3D::CParticleSystemModel::_TriggerAnimatedValue [private]
 

Definition at line 291 of file particle_system_model.h.

Referenced by CParticleSystemModel, and getValue.

CAnimatedValueFloat NL3D::CParticleSystemModel::_UserParam[MaxPSUserParam] [private]
 

user params of the system.

Definition at line 293 of file particle_system_model.h.

Referenced by getValue, and releasePSPointer.


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