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

this class is a located : it belongs to a particle system, and it represents any kind of object that has a position in the world. More...

#include <ps_located.h>

Inheritance diagram for NL3D::CPSLocated

Inheritance graph
[legend]
Collaboration diagram for NL3D::CPSLocated:

Collaboration graph
[legend]
List of all members.

Public Methods

 CPSLocated ()
 Constructor. More...

virtual ~CPSLocated ()
 dtor. More...

void bind (CPSLocatedBindable *lb)
 sorted insertion (by decreasing priority order) of a bindable (particle e.g an aspect, emitter) in a located. More...

void remove (const CPSLocatedBindable *lb)
 remove a bound object from the located if the object doesnt exist -> nlassert it is deleted. More...

uint32 getNbBoundObjects (void) const
 count the number of bound objects. More...

const CPSLocatedBindablegetBoundObject (uint32 index) const
 get a reference to a bound object. More...

sint32 newElement (const NLMISC::CVector &pos = CVector::Null , const CVector &speed = CVector::Null, CPSLocatedBindable *emitterLocated = NULL, uint32 indexInEmitter = 0)
 Generate one more instance in a located. More...

void deleteElement (uint32 index)
 delete an element. More...

uint32 getNewElementIndex (void) const
 Get the index of the new element that is created Valid only after the newElement method (overridable) of a LocatedBindable is called : you get the index of the located being generated, if you need its pos, speed, or mass. More...

bool computeBBox (NLMISC::CAABBox &aabbox) const
 Compute the aabbox of this located, (expressed in world basis. More...

void setMaxMass (float mass)
 Set the maximum mass of located to be generated. More...

float getMaxMass (void) const
 Get the maximum mass of located to be generated. More...

void setMinMass (float mass)
 Set the minimum mass of located to be generated. More...

float getMinMass (void) const
 Get the minimum mass of located to be generated. More...

float setMass (float min, float max)
 Set both min and max mass. More...

void setLifeTime (CAnimationTime min, CAnimationTime max)
 Set the duration of locateds. More...

CAnimationTime getMinLife (void) const
 Retrieve min duration of locateds. They must not be immortal -> nlassert. More...

CAnimationTime getMaxLife (void) const
 Retrieve max duration of locateds. They must not be immortal -> nlassert. More...

void setLastForever (void)
 set immortality for located. More...

bool getLastForever (void) const
 retrieve immortality for locateds. More...

TPSAttribFloatgetInvMass (void)
 get mass inverse attrib ref. More...

const TPSAttribFloatgetInvMass (void) const
 get mass inverse attrib const ref. More...

TPSAttribVectorgetPos (void)
 get Pos attrib ref. More...

const TPSAttribVectorgetPos (void) const
 get Pos attrib const ref. More...

TPSAttribVectorgetSpeed (void)
 get Speed attrib ref. More...

const TPSAttribVectorgetSpeed (void) const
 get Speed attrib const ref. More...

TPSAttribTimegetTime (void)
 get Time attrib ref. More...

const TPSAttribTimegetTime (void) const
 get Time attrib const ref. More...

TPSAttribTimegetTimeIncrement (void)
 get TotalTime attrib ref. More...

const TPSAttribTimegetTimeIncrement (void) const
 get TotalTime attrib const ref. More...

virtual void step (TPSProcessPass pass, CAnimationTime ellapsedTime)
 process the system. More...

uint32 getSize (void) const
 get the current number of instance in this located container. More...

uint32 getMaxSize (void) const
 get the max number of instance in this located container. More...

void resize (uint32 newSize)
 Resize the located container. More...

void serial (NLMISC::IStream &f)
 serialization. More...

IDrivergetDriver () const
 Shortcut to get an instance of the 3d driver. More...

 NLMISC_DECLARE_CLASS (CPSLocated)
void setupDriverModelMatrix (void)
 Setup the driver model matrix. It is set accordingly to the basis used for rendering. More...

CVector computeI (void) const
 Compute a vector that will map to (1 0 0) after view and model transform. More...

CVector computeK (void) const
 Compute a vector that will map to (0 0 1) after view and model transform. More...

void queryCollisionInfo (void)
 call this if you need collision infos. More...

void releaseCollisionInfo (void)
 Release the collideInfos attribute. More...

TPSAttribCollisionInfogetCollisionInfo (void)
 get a ref to the collision infos. More...

const TPSAttribCollisionInfogetCollisionInfo (void) const
 get a const ref to the collision infos. More...

void collisionOccured (const CPSCollisionInfo &ci, uint32 index)
 A collider must call this when a collision occurs If the collider was nearer that another one it will be taken in account \index the index of instance that collided. More...

void registerDtorObserver (CPSTargetLocatedBindable *observerInterface)
 Register a dtor observer; (that derives from CPSTargetLocatedBindable) Each observer will be called when this object dtor is called This allow for objects that hold this as a target to know when the located is suppressed (example : collision objects hold located as targets) When an observer is detroyed, it MUST call removeDtorObserver, unless the located has been destroyed which will be notified by the call of releaseTargetRsc in CPSTargetLocatedBindable The same observer can only register once, otherwise, an assertion occurs. More...

void unregisterDtorObserver (CPSTargetLocatedBindable *anObserver)
 remove a dtor observer (not present -> nlassert). More...


Static Public Methods

const CMatrix& getConversionMatrix (const CPSLocated *A, const CPSLocated *B)
 get a matrix that helps to express located B coordinate in located A basis. More...


Protected Types

typedef std::vector< CPSLocatedBindable *> TLocatedBoundCont
typedef std::stack<CPostNewElementRequestInfoTNewElementRequestStack
typedef std::vector<CPSTargetLocatedBindable *> TDtorObserversVect

Protected Methods

void updateNewElementRequestStack (void)
 generate the located that were posted. More...

void postNewElement (const NLMISC::CVector &pos = CVector::Null , const CVector &speed = CVector::Null)
 Post a request for the generation of a new located. More...

void resetCollisionInfo (void)
 this prepare the located ofr collision tests. More...


Protected Attributes

TLocatedBoundCont _LocatedBoundCont
uint32 _MaxSize
uint32 _Size
bool _LastForever
TPSAttribFloat _InvMass
TPSAttribVector _Pos
TPSAttribVector _Speed
TPSAttribTime _Time
TPSAttribTime _TimeIncrement
TPSAttribCollisionInfo_CollisionInfo
 Used to solve collision detection it is not always instanciated. More...

uint32 _CollisionInfoNbRef
float _MinMass
float _MaxMass
float _MaxLife
float _MinLife
TNewElementRequestStack _RequestStack
 this stack is used after each update to generate located. More...

bool _UpdateLock
 this is used to tell wether a newElement or a deleteElement if being performed During these method, creation should use postNewElement to generate new elements Because of the data structures (each located bindable are updated one after each other) inconsistency can happen, when a located generated another located of the same type when he's deleted. More...

TDtorObserversVect _DtorObserversVect

Detailed Description

this class is a located : it belongs to a particle system, and it represents any kind of object that has a position in the world.

A located don't do anything by itself. You must bind objects to it, such as a particle, a force and so on. It is important to remember that a located holds all instance of object of one type (force, emitter, particles or both...), not only one.

Definition at line 99 of file ps_located.h.


Member Typedef Documentation

typedef std::vector<CPSTargetLocatedBindable *> NL3D::CPSLocated::TDtorObserversVect [protected]
 

Definition at line 455 of file ps_located.h.

typedef std::vector< CPSLocatedBindable *> NL3D::CPSLocated::TLocatedBoundCont [protected]
 

Definition at line 369 of file ps_located.h.

typedef std::stack<CPostNewElementRequestInfo> NL3D::CPSLocated::TNewElementRequestStack [protected]
 

Definition at line 423 of file ps_located.h.


Constructor & Destructor Documentation

NL3D::CPSLocated::CPSLocated ( )
 

Constructor.

Definition at line 43 of file ps_located.cpp.

NL3D::CPSLocated::~CPSLocated ( ) [virtual]
 

dtor.

Definition at line 54 of file ps_located.cpp.


Member Function Documentation

NL3D::CPSLocated::NLMISC_DECLARE_CLASS ( CPSLocated )
 

void NL3D::CPSLocated::bind ( CPSLocatedBindable * lb )
 

sorted insertion (by decreasing priority order) of a bindable (particle e.g an aspect, emitter) in a located.

Definition at line 83 of file ps_located.cpp.

void NL3D::CPSLocated::collisionOccured ( const CPSCollisionInfo & ci,
uint32 index ) [inline]
 

A collider must call this when a collision occurs If the collider was nearer that another one it will be taken in account \index the index of instance that collided.

Definition at line 495 of file ps_located.h.

bool NL3D::CPSLocated::computeBBox ( NLMISC::CAABBox & box ) const [virtual]
 

Compute the aabbox of this located, (expressed in world basis.

Returns:
true if there is any aabbox
Parameters:
aabbox   a ref to the result box

Reimplemented from NL3D::CParticleSystemProcess.

Definition at line 450 of file ps_located.cpp.

CVector NL3D::CPSLocated::computeI ( void ) const [inline]
 

Compute a vector that will map to (1 0 0) after view and model transform.

This allow to have object that always faces the user, whatever basis they are in

Definition at line 467 of file ps_located.h.

CVector NL3D::CPSLocated::computeK ( void ) const [inline]
 

Compute a vector that will map to (0 0 1) after view and model transform.

This allow to have object that always faces the user, whatever basis they are in

Definition at line 481 of file ps_located.h.

void NL3D::CPSLocated::deleteElement ( uint32 index )
 

delete an element.

Definition at line 206 of file ps_located.cpp.

const CPSLocatedBindable * NL3D::CPSLocated::getBoundObject ( uint32 index ) const [inline]
 

get a reference to a bound object.

Definition at line 132 of file ps_located.h.

const TPSAttribCollisionInfo & NL3D::CPSLocated::getCollisionInfo ( void ) const [inline]
 

get a const ref to the collision infos.

Definition at line 325 of file ps_located.h.

TPSAttribCollisionInfo & NL3D::CPSLocated::getCollisionInfo ( void ) [inline]
 

get a ref to the collision infos.

Definition at line 318 of file ps_located.h.

const CMatrix & NL3D::CPSLocated::getConversionMatrix ( const CPSLocated * A,
const CPSLocated * B ) [inline, static]
 

get a matrix that helps to express located B coordinate in located A basis.

Definition at line 506 of file ps_located.h.

IDriver * NL3D::CPSLocated::getDriver ( ) const [inline]
 

Shortcut to get an instance of the 3d driver.

Definition at line 285 of file ps_located.h.

const TPSAttribFloat & NL3D::CPSLocated::getInvMass ( void ) const [inline]
 

get mass inverse attrib const ref.

Definition at line 233 of file ps_located.h.

TPSAttribFloat & NL3D::CPSLocated::getInvMass ( void ) [inline]
 

get mass inverse attrib ref.

Definition at line 231 of file ps_located.h.

bool NL3D::CPSLocated::getLastForever ( void ) const [inline]
 

retrieve immortality for locateds.

Definition at line 228 of file ps_located.h.

CAnimationTime NL3D::CPSLocated::getMaxLife ( void ) const [inline]
 

Retrieve max duration of locateds. They must not be immortal -> nlassert.

Definition at line 216 of file ps_located.h.

float NL3D::CPSLocated::getMaxMass ( void ) const [inline]
 

Get the maximum mass of located to be generated.

Definition at line 183 of file ps_located.h.

uint32 NL3D::CPSLocated::getMaxSize ( void ) const [inline]
 

get the max number of instance in this located container.

See also:
resize()

Definition at line 271 of file ps_located.h.

CAnimationTime NL3D::CPSLocated::getMinLife ( void ) const [inline]
 

Retrieve min duration of locateds. They must not be immortal -> nlassert.

Definition at line 210 of file ps_located.h.

float NL3D::CPSLocated::getMinMass ( void ) const [inline]
 

Get the minimum mass of located to be generated.

Definition at line 187 of file ps_located.h.

uint32 NL3D::CPSLocated::getNbBoundObjects ( void ) const [inline]
 

count the number of bound objects.

Definition at line 127 of file ps_located.h.

uint32 NL3D::CPSLocated::getNewElementIndex ( void ) const [inline]
 

Get the index of the new element that is created Valid only after the newElement method (overridable) of a LocatedBindable is called : you get the index of the located being generated, if you need its pos, speed, or mass.

Definition at line 170 of file ps_located.h.

const TPSAttribVector & NL3D::CPSLocated::getPos ( void ) const [inline]
 

get Pos attrib const ref.

Definition at line 238 of file ps_located.h.

TPSAttribVector & NL3D::CPSLocated::getPos ( void ) [inline]
 

get Pos attrib ref.

Definition at line 236 of file ps_located.h.

uint32 NL3D::CPSLocated::getSize ( void ) const [inline]
 

get the current number of instance in this located container.

Definition at line 263 of file ps_located.h.

const TPSAttribVector & NL3D::CPSLocated::getSpeed ( void ) const [inline]
 

get Speed attrib const ref.

Definition at line 243 of file ps_located.h.

TPSAttribVector & NL3D::CPSLocated::getSpeed ( void ) [inline]
 

get Speed attrib ref.

Definition at line 241 of file ps_located.h.

const TPSAttribTime & NL3D::CPSLocated::getTime ( void ) const [inline]
 

get Time attrib const ref.

Definition at line 248 of file ps_located.h.

TPSAttribTime & NL3D::CPSLocated::getTime ( void ) [inline]
 

get Time attrib ref.

Definition at line 246 of file ps_located.h.

const TPSAttribTime & NL3D::CPSLocated::getTimeIncrement ( void ) const [inline]
 

get TotalTime attrib const ref.

Definition at line 253 of file ps_located.h.

TPSAttribTime & NL3D::CPSLocated::getTimeIncrement ( void ) [inline]
 

get TotalTime attrib ref.

Definition at line 251 of file ps_located.h.

sint32 NL3D::CPSLocated::newElement ( const NLMISC::CVector & pos = CVector::Null,
const CVector & speed = CVector::Null,
CPSLocatedBindable * emitterLocated = NULL,
uint32 indexInEmitter = 0 )
 

Generate one more instance in a located.

The coordinate are given in the chosen basis for the located. If the emitterLocated ptr is not null, then the coordinate are taken from the emitterLocated basis and are expressed in this located basis. other attributes are generated according to other properties of this class Will succeed only if it hasn't reach the max number of allowed instances return will be -1 if call failed or an index to the created object. Index is only valid after creation. Any processing pass on the system will make it invalid. It can be used with any attribute modification method of located and located bindable

Parameters:
indexInEmitter   The index of the emitter (in the emitterLocated object)

void NL3D::CPSLocated::postNewElement ( const NLMISC::CVector & pos = CVector::Null,
const CVector & speed = CVector::Null ) [protected]
 

Post a request for the generation of a new located.

it is called by newElement when _UpdateLock is set (when called during newElement or deleteElement)

void NL3D::CPSLocated::queryCollisionInfo ( void )
 

call this if you need collision infos.

The collide info attribute is not included by default to save memory. The first call will create the attribute, and others will add references. You can then access the infos by calling getCollisioInfo You must call releaseCollideInfo after use.

Definition at line 523 of file ps_located.cpp.

void NL3D::CPSLocated::registerDtorObserver ( CPSTargetLocatedBindable * anObserver )
 

Register a dtor observer; (that derives from CPSTargetLocatedBindable) Each observer will be called when this object dtor is called This allow for objects that hold this as a target to know when the located is suppressed (example : collision objects hold located as targets) When an observer is detroyed, it MUST call removeDtorObserver, unless the located has been destroyed which will be notified by the call of releaseTargetRsc in CPSTargetLocatedBindable The same observer can only register once, otherwise, an assertion occurs.

Definition at line 114 of file ps_located.cpp.

void NL3D::CPSLocated::releaseCollisionInfo ( void )
 

Release the collideInfos attribute.

Definition at line 538 of file ps_located.cpp.

void NL3D::CPSLocated::remove ( const CPSLocatedBindable * p )
 

remove a bound object from the located if the object doesnt exist -> nlassert it is deleted.

Definition at line 105 of file ps_located.cpp.

void NL3D::CPSLocated::resetCollisionInfo ( void ) [protected]
 

this prepare the located ofr collision tests.

Definition at line 551 of file ps_located.cpp.

void NL3D::CPSLocated::resize ( uint32 newSize )
 

Resize the located container.

Definition at line 243 of file ps_located.cpp.

void NL3D::CPSLocated::serial ( NLMISC::IStream & f ) [virtual]
 

serialization.

Reimplemented from NL3D::CParticleSystemProcess.

Definition at line 265 of file ps_located.cpp.

void NL3D::CPSLocated::setLastForever ( void ) [inline]
 

set immortality for located.

Definition at line 223 of file ps_located.h.

void NL3D::CPSLocated::setLifeTime ( CAnimationTime min,
CAnimationTime max ) [inline]
 

Set the duration of locateds.

Any previous call to setLastForever() is discraded They must not be immortal -> nlassert

Definition at line 202 of file ps_located.h.

float NL3D::CPSLocated::setMass ( float min,
float max ) [inline]
 

Set both min and max mass.

Definition at line 189 of file ps_located.h.

void NL3D::CPSLocated::setMaxMass ( float mass ) [inline]
 

Set the maximum mass of located to be generated.

Definition at line 181 of file ps_located.h.

void NL3D::CPSLocated::setMinMass ( float mass ) [inline]
 

Set the minimum mass of located to be generated.

Definition at line 185 of file ps_located.h.

void NL3D::CPSLocated::setupDriverModelMatrix ( void )
 

Setup the driver model matrix. It is set accordingly to the basis used for rendering.

Definition at line 508 of file ps_located.cpp.

void NL3D::CPSLocated::step ( TPSProcessPass pass,
CAnimationTime ellapsedTime ) [virtual]
 

process the system.

Reimplemented from NL3D::CParticleSystemProcess.

Definition at line 341 of file ps_located.cpp.

void NL3D::CPSLocated::unregisterDtorObserver ( CPSTargetLocatedBindable * anObserver )
 

remove a dtor observer (not present -> nlassert).

Definition at line 121 of file ps_located.cpp.

void NL3D::CPSLocated::updateNewElementRequestStack ( void ) [protected]
 

generate the located that were posted.

Definition at line 440 of file ps_located.cpp.


Member Data Documentation

TPSAttribCollisionInfo * NL3D::CPSLocated::_CollisionInfo [protected]
 

Used to solve collision detection it is not always instanciated.

Definition at line 397 of file ps_located.h.

uint32 NL3D::CPSLocated::_CollisionInfoNbRef [protected]
 

Definition at line 402 of file ps_located.h.

TDtorObserversVect NL3D::CPSLocated::_DtorObserversVect [protected]
 

Definition at line 457 of file ps_located.h.

TPSAttribFloat NL3D::CPSLocated::_InvMass [protected]
 

Definition at line 389 of file ps_located.h.

bool NL3D::CPSLocated::_LastForever [protected]
 

Definition at line 384 of file ps_located.h.

TLocatedBoundCont NL3D::CPSLocated::_LocatedBoundCont [protected]
 

Definition at line 373 of file ps_located.h.

float NL3D::CPSLocated::_MaxLife [protected]
 

Definition at line 408 of file ps_located.h.

float NL3D::CPSLocated::_MaxMass [protected]
 

Definition at line 407 of file ps_located.h.

uint32 NL3D::CPSLocated::_MaxSize [protected]
 

Definition at line 376 of file ps_located.h.

float NL3D::CPSLocated::_MinLife [protected]
 

Definition at line 408 of file ps_located.h.

float NL3D::CPSLocated::_MinMass [protected]
 

Definition at line 407 of file ps_located.h.

TPSAttribVector NL3D::CPSLocated::_Pos [protected]
 

Definition at line 390 of file ps_located.h.

TNewElementRequestStack NL3D::CPSLocated::_RequestStack [protected]
 

this stack is used after each update to generate located.

Definition at line 426 of file ps_located.h.

uint32 NL3D::CPSLocated::_Size [protected]
 

Definition at line 380 of file ps_located.h.

TPSAttribVector NL3D::CPSLocated::_Speed [protected]
 

Definition at line 391 of file ps_located.h.

TPSAttribTime NL3D::CPSLocated::_Time [protected]
 

Definition at line 392 of file ps_located.h.

TPSAttribTime NL3D::CPSLocated::_TimeIncrement [protected]
 

Definition at line 393 of file ps_located.h.

bool NL3D::CPSLocated::_UpdateLock [protected]
 

this is used to tell wether a newElement or a deleteElement if being performed During these method, creation should use postNewElement to generate new elements Because of the data structures (each located bindable are updated one after each other) inconsistency can happen, when a located generated another located of the same type when he's deleted.

Definition at line 440 of file ps_located.h.


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