From 0ea5fc66924303d1bf73ba283a383e2aadee02f2 Mon Sep 17 00:00:00 2001 From: neodarz Date: Sat, 11 Aug 2018 20:21:34 +0200 Subject: Initial commit --- docs/doxygen/nel/a03179.html | 6954 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 6954 insertions(+) create mode 100644 docs/doxygen/nel/a03179.html (limited to 'docs/doxygen/nel/a03179.html') diff --git a/docs/doxygen/nel/a03179.html b/docs/doxygen/nel/a03179.html new file mode 100644 index 00000000..cb46c636 --- /dev/null +++ b/docs/doxygen/nel/a03179.html @@ -0,0 +1,6954 @@ + + +NeL: NL3D::CPSEmitter class Reference + + + +
+

NL3D::CPSEmitter Class Reference

#include <ps_emitter.h> +

+

Inheritance diagram for NL3D::CPSEmitter: +

+ +NL3D::CPSLocatedBindable +NLMISC::IStreamable +NLMISC::IClassable +NL3D::CPSEmitterDirectionnal +NL3D::CPSEmitterOmni +NL3D::CPSEmitterRectangle +NL3D::CPSSphericalEmitter +NL3D::CPSEmitterConic +NL3D::CPSRadialEmitter + +

Detailed Description

+Base class for all emitters in a particle system. Derivers should at least define the emit method which is called each time an emission is needed. Not sharable accross systems.

+

Author:
Nicolas Vizerie

+Nevrax France

+
Date:
2001
+ +

+ +

+Definition at line 50 of file ps_emitter.h. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Public Types

enum  TEmissionType {
+  regular = 0, +onDeath = 1, +once = 2, +onBounce = 3, +
+  externEmit = 4, +numEmissionType +
+ }

Public Member Functions

virtual void basisChanged (TPSMatrixMode systemBasis)
bool checkLoop () const
 ==========================================================================

virtual bool completeBBox (NLMISC::CAABBox &box) const
NLMISC::CVector computeI (void) const
NLMISC::CVector computeJ (void) const
NLMISC::CVector computeK (void) const
virtual bool doesProduceBBox (void) const
void enableConsistenEmission (bool enable)
virtual void enumTexs (std::vector< NLMISC::CSmartPtr< ITexture > > &dest, IDriver &drv)
bool getBypassAutoLOD () const
virtual std::string getClassName ()=0
IDrivergetDriver () const
 shortcut to get an instance of the driver

TEmissionType getEmissionType (void) const
 Get the frequency type.

float getEmitDelay () const
 Get the delay in seconds before the first emission (regular emitter only).

const CPSLocatedgetEmittedType (void) const
 Get const ptr on emitted type.

CPSLocatedgetEmittedType (void)
 Get emitted type.

uint32 getExternID (void) const
 get the extern ID of this located bindable

const CFontGeneratorgetFontGenerator (void) const
 Shortcut to get the font generator if one was set (const version).

CFontGeneratorgetFontGenerator (void)
 Shortcut to get the font generator if one was set.

const CFontManagergetFontManager (void) const
 Shortcut to get the font manager if one was set (const version).

CFontManagergetFontManager (void)
 ***************************************************************************************

uint getGenNb (void) const
 Retrieve the GenNb for emission, valid only if a GenNb scheme is used.

const CPSAttribMaker< uint32 > * getGenNbScheme (void) const
 Retrieve the GenNb scheme, or null, if there'isnt (const version).

CPSAttribMaker< uint32 > * getGenNbScheme (void)
 Retrieve the GenNb scheme, or null, if there'isnt.

const NLMISC::CMatrixgetInvertedSysMat (void) const
 shortcut to get the inverted matrix of the system

const NLMISC::CMatrixgetInvertedViewMat (void) const
 shortcut to get the inverted view matrix

const NLMISC::CMatrixgetLocalToWorldMatrix () const
 Shortcut to get the local to world matrix.

TPSLod getLOD (void) const
 get the valid lods for that object

uint8 getMaxEmissionCount () const
 Get the max. number of particle emission (0 means no limit and is the default). Applies with regular emitter only.

std::string getName (void) const
 get the located bindable name (edition purpose)

const CPSLocatedgetOwner (void) const
 get the located that owns this bindable (const version)

CPSLocatedgetOwner (void)
 get the located that owns this bindable

float getPeriod (void) const
 Retrieve the period for emission, valid only if a period scheme is used.

const CPSAttribMaker< float > * getPeriodScheme (void) const
CPSAttribMaker< float > * getPeriodScheme (void)
virtual uint32 getPriority (void) const
 Return priority for emitters.

const NLMISC::CMatrixgetSysMat (void) const
 ***************************************************************************************

uint32 getType (void) const
 Return this bindable type.

virtual bool getUserMatrixUsageCount () const
 ==========================================================================

const NLMISC::CMatrixgetViewMat (void) const
 shortcut to get the view matrix

virtual bool hasEmitters (void) const
 tells wether there are alive emitters

virtual bool hasEmitters (void)
 Return true if this located bindable derived class holds alive emitters.

virtual bool hasParticles (void) const
 tells wether there are alive entities / particles

bool isActive () const
bool isConsistentEmissionEnabled () const
virtual void motionTypeChanged (bool parametric)
 called when a located has switch between incrmental / parametric motion. The default does nothing

virtual void notifyTargetRemoved (CPSLocated *ptr)
 ==========================================================================

virtual void releaseAllRef ()
virtual void releaseRefTo (const CParticleSystemProcess *other)
 ==========================================================================

void serial (NLMISC::IStream &f) throw (NLMISC::EStream)
 ==========================================================================

void setActive (bool active)
 Activate / Deactivate this object. When not active, the owning system won't try to call the 'step' method.

void setBypassAutoLOD (bool bypass)
bool setEmissionType (TEmissionType freqType)
 ==========================================================================

void setEmitDelay (float delay)
 ==========================================================================

bool setEmittedType (CPSLocated *et)
 ==========================================================================

void setExternID (uint32 id)
 ***************************************************************************************

void setGenNb (uint32 GenNb)
 ==========================================================================

void setGenNbScheme (CPSAttribMaker< uint32 > *scheme)
 ==========================================================================

void setLOD (TPSLod lod)
bool setMaxEmissionCount (uint8 count)
 ==========================================================================

void setName (const std::string &name)
 set the located bindable name (edition purpose)

virtual void setOwner (CPSLocated *psl)
 ==========================================================================

void setPeriod (float period)
 ==========================================================================

void setPeriodScheme (CPSAttribMaker< float > *scheme)
 ==========================================================================

void setupDriverModelMatrix (void)
 shortcut to setup the model matrix (system basis or world basis)

virtual void setZBias (float value)
virtual void showTool (void)
 ==========================================================================

void singleEmit (uint32 index, uint quantity)
 ==========================================================================

virtual void step (TPSProcessPass pass, TAnimationTime ellapsedTime, TAnimationTime realEllapsedTime)
 ==========================================================================

virtual void systemDateChanged ()
bool testEmitForever () const
 ==========================================================================

bool useGenNbScheme (void)
 Indicate whether a GenNb scheme is used or not.

bool usePeriodScheme (void)
 Indicate whether a period scheme is used or not.

Object
 CPSEmitter ()
 Constructor.

virtual ~CPSEmitter ()
 ==========================================================================


Static Public Member Functions

void setBypassEmitOnDeath (bool bypass)

Protected Member Functions

virtual void bounceOccured (uint32 index)
 ==========================================================================

virtual void deleteElement (uint32 index)
 ==========================================================================

void displayIcon2d (const NLMISC::CVector tab[], uint nbSegs, float scale)
 ***************************************************************************************

virtual void emit (const NLMISC::CVector &srcPos, uint32 index, NLMISC::CVector &pos, NLMISC::CVector &speed)=0
bool isUserMatrixUsed () const
 ==========================================================================

virtual void newElement (CPSLocated *emitterLocated, uint32 emitterIndex)
 ==========================================================================

void processEmit (uint32 index, sint nbToGenerate)
 ==========================================================================

void processEmitConsistent (const NLMISC::CVector &emitterPos, uint32 emitterIndex, sint nbToGenerate, TAnimationTime deltaT, TAnimationTime ellapsedTime, float realEllapsedTimeRatio)
 ==========================================================================

void processRegularEmission (TAnimationTime ellapsedTime, float emitLOD)
 ==========================================================================

void processRegularEmissionConsistent (TAnimationTime ellapsedTime, float realEllapsedTimeRatio, float emitLOD, float inverseEmitLOD)
 ==========================================================================

void processRegularEmissionConsistentWithNoLOD (TAnimationTime ellapsedTime, float realEllapsedTimeRatio)
 ==========================================================================

void processRegularEmissionWithNoLOD (TAnimationTime ellapsedTime)
 ==========================================================================

virtual void resize (uint32 size)
 ==========================================================================

void updateMaxCountVect ()
 ==========================================================================

void updatePSRefCountForUserMatrixUsage (bool matrixIsNeededNow, bool matrixWasNeededBefore)
 ==========================================================================


Protected Attributes

bool _Active
bool _BypassAutoLOD: 1
bool _ConsistentEmission: 1
TEmissionType _EmissionType
float _EmitDelay
CPSLocated_EmittedType
 A pointer on the type to be emitted.

uint32 _ExternID
uint32 _GenNb
CPSAttribMaker< uint32 > * _GenNbScheme
TPSLod _LOD
 tells when this object must be dealt with

uint8 _MaxEmissionCount
std::string _Name
TPSAttribUInt8 _NumEmission
CPSLocated_Owner
float _Period
CPSAttribMaker< float > * _PeriodScheme
TPSAttribFloat _Phase
bool _SpeedBasisEmission: 1
float _SpeedInheritanceFactor
TPSMatrixMode _UserDirectionMatrixMode
bool _UserMatrixModeForEmissionDirection: 1

Static Protected Attributes

bool _BypassEmitOnDeath = false

Friends

class CPSLocated
+


Member Enumeration Documentation

+

+ + + + +
+ + +
enum NL3D::CPSEmitter::TEmissionType +
+
+ + + + + +
+   + + +

+The type of emission. regular : means use Period, and generation number (the number of particle to generate when an emission occurs) onDeath : emit when the emitter is destroyed once : emit when the emitter is created onBounce : emit when the emitter bounce externEmit : emitted explicitly by the system user. A 4 letter id must be used to identify this kind of emitters the default ID is NONE

Enumeration values:
+ + + + + + + +
regular  +
onDeath  +
once  +
onBounce  +
externEmit  +
numEmissionType  +
+
+ +

+Definition at line 109 of file ps_emitter.h. +

+Referenced by getEmissionType(), and setEmissionType(). +

+

00109 { regular = 0, onDeath = 1,  once = 2, onBounce = 3, externEmit = 4, numEmissionType };
+
+


Constructor & Destructor Documentation

+

+ + + + +
+ + + + + + + + + +
NL3D::CPSEmitter::CPSEmitter  ) 
+
+ + + + + +
+   + + +

+Constructor. +

+ +

+Definition at line 65 of file ps_emitter.cpp. +

+References NL3D::PSFXWorldMatrix. +

+

00065                        : _EmittedType(NULL),
+00066                                                    _SpeedInheritanceFactor(0.f),
+00067                                                    _EmissionType(regular),
+00068                                                    _Period(0.02f),
+00069                                                    _PeriodScheme(NULL), 
+00070                                                    _GenNb(1), 
+00071                                                    _GenNbScheme(NULL), 
+00072                                                    _EmitDelay(0),
+00073                                                    _MaxEmissionCount(0),
+00074                                                    _SpeedBasisEmission(false),                                             
+00075                                                    _ConsistentEmission(true),
+00076                                                    _BypassAutoLOD(false),
+00077                                                    _UserMatrixModeForEmissionDirection(false),
+00078                                                    _UserDirectionMatrixMode(PSFXWorldMatrix)
+00079 {
+00080 }
+
+

+ + + + +
+ + + + + + + + + +
NL3D::CPSEmitter::~CPSEmitter  )  [virtual]
+
+ + + + + +
+   + + +

+========================================================================== +

+ +

+Definition at line 84 of file ps_emitter.cpp. +

+References _EmittedType, _GenNbScheme, _PeriodScheme, and NL3D::CPSLocated::unregisterDtorObserver(). +

+

00085 {
+00086         delete _PeriodScheme;
+00087         delete _GenNbScheme;
+00088         // if a located is emitted, unregister us as an observer
+00089         if (_EmittedType)
+00090         {
+00091                 _EmittedType->unregisterDtorObserver(this);
+00092         }
+00093 }
+
+


Member Function Documentation

+

+ + + + +
+ + + + + + + + + + +
virtual void NL3D::CPSLocatedBindable::basisChanged TPSMatrixMode  systemBasis  )  [inline, virtual, inherited]
+
+ + + + + +
+   + + +

+Called when the basis of the owner changed. the default behaviour does nothing

Parameters:
+ + +
newBasis : True if in the system basis, false for the world basis.
+
+ +

+Reimplemented in NL3D::CPSForce. +

+Definition at line 968 of file ps_located.h. +

+

00968 {}
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CPSEmitter::bounceOccured uint32  index  )  [protected, virtual]
+
+ + + + + +
+   + + +

+========================================================================== +

+ +

+Reimplemented from NL3D::CPSLocatedBindable. +

+Definition at line 1908 of file ps_emitter.cpp. +

+References _EmissionType, _EmittedType, _GenNb, _GenNbScheme, NL3D::CPSAttribMaker< uint32 >::get(), index, processEmit(), and uint32. +

+

01909 {
+01910         // TODO : avoid duplication with deleteElement
+01911         if (_EmittedType && _EmissionType == CPSEmitter::onBounce)
+01912         {
+01913                 const uint32 nbToGenerate = _GenNbScheme ? _GenNbScheme->get(_Owner, index) : _GenNb;           
+01914                 processEmit(index, nbToGenerate);
+01915         }               
+01916 }
+
+

+ + + + +
+ + + + + + + + + +
bool NL3D::CPSEmitter::checkLoop  )  const
+
+ + + + + +
+   + + +

+========================================================================== +

+check if there's a loop with that e=mitter eg A emit B emit A NB : the emitter should be inserted in a system, otherwise -> assert +

+Definition at line 2117 of file ps_emitter.cpp. +

+References _EmittedType, NL3D::CPSLocated::getBoundObject(), NL3D::CPSLocated::getNbBoundObjects(), NL3D::CParticleSystemProcess::getOwner(), nlassert, and uint32. +

+Referenced by NL3D::CParticleSystem::hasLoop(). +

+

02118 {
+02119         nlassert(_Owner);
+02120         nlassert(_Owner->getOwner());
+02121         if (!_EmittedType) return false;        
+02122         std::set<const CPSLocated *> seenLocated; // the located we've already seen
+02123         std::vector<const CPSLocated *> leftLoc(1);  // the located that are left to see
+02124         leftLoc[0] = _EmittedType;
+02125         do
+02126         {
+02127                 const CPSLocated *curr = leftLoc.back();
+02128                 if (curr == this->_Owner) return true;
+02129                 leftLoc.pop_back();
+02130                 seenLocated.insert(curr);
+02131                 for(uint32 k = 0; k < curr->getNbBoundObjects(); ++k)
+02132                 {
+02133                         const CPSEmitter *emitter = dynamic_cast<const CPSEmitter *>(curr->getBoundObject(k));
+02134                         if (emitter && emitter->_EmittedType)
+02135                         {
+02136                                 if (seenLocated.find(emitter->_EmittedType) == seenLocated.end()) // not already seen this one ?
+02137                                 {
+02138                                         leftLoc.push_back(emitter->_EmittedType);
+02139                                 }
+02140                         }                       
+02141                 }
+02142         }
+02143         while (!leftLoc.empty());
+02144         return false;
+02145 }
+
+

+ + + + +
+ + + + + + + + + + +
virtual bool NL3D::CPSLocatedBindable::completeBBox NLMISC::CAABBox box  )  const [inline, virtual, inherited]
+
+ + + + + +
+   + + +

+ +

+Reimplemented in NL3D::CPSFanLight, NL3D::CPSQuad, and NL3D::CPSShockWave. +

+Definition at line 884 of file ps_located.h. +

+

00884 { return false ;}
+
+

+ + + + +
+ + + + + + + + + + +
NLMISC::CVector NL3D::CPSLocatedBindable::computeI void   )  const [inline, inherited]
+
+ + + + + +
+   + + +

+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 931 of file ps_located.h. +

+References NL3D::CPSLocated::computeI(). +

+Referenced by NL3D::CPSLocatedBindable::displayIcon2d(), NL3D::CPSFanLightHelper::drawFanLight(), NL3D::CPSFaceLookAtHelper::drawLookAt(), NL3D::CPSFaceLookAtHelper::drawLookAtAlignOnMotion(), NL3D::CPSGravity::show(), and showTool(). +

+

00931 { return _Owner->computeI(); }
+
+

+ + + + +
+ + + + + + + + + + +
NLMISC::CVector NL3D::CPSLocatedBindable::computeJ void   )  const [inline, inherited]
+
+ + + + + +
+   + + +

+Compute a vector that will map to (0 1 0) after view and model transform. This allow to have object that always faces the user, whatever basis they are in +

+Definition at line 936 of file ps_located.h. +

+References NL3D::CPSLocated::computeJ(). +

+Referenced by NL3D::CPSFaceLookAtHelper::drawLookAt(). +

+

00936 { return _Owner->computeJ(); }
+
+

+ + + + +
+ + + + + + + + + + +
NLMISC::CVector NL3D::CPSLocatedBindable::computeK void   )  const [inline, inherited]
+
+ + + + + +
+   + + +

+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 940 of file ps_located.h. +

+References NL3D::CPSLocated::computeK(). +

+Referenced by NL3D::CPSLocatedBindable::displayIcon2d(), NL3D::CPSFanLightHelper::drawFanLight(), NL3D::CPSFaceLookAtHelper::drawLookAt(), NL3D::CPSFaceLookAtHelper::drawLookAtAlignOnMotion(), and showTool(). +

+

00940 { return _Owner->computeK(); }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CPSEmitter::deleteElement uint32  index  )  [protected, virtual]
+
+ + + + + +
+   + + +

+========================================================================== +

+Delete an element given its index Attributes of the located that hold this bindable are still accessible for of the index given index out of range -> nl_assert +

+Implements NL3D::CPSLocatedBindable. +

+Reimplemented in NL3D::CPSEmitterDirectionnal, NL3D::CPSEmitterOmni, NL3D::CPSEmitterRectangle, and NL3D::CPSSphericalEmitter. +

+Definition at line 1873 of file ps_emitter.cpp. +

+References _BypassEmitOnDeath, _EmissionType, _EmittedType, _GenNb, _GenNbScheme, _MaxEmissionCount, _NumEmission, _PeriodScheme, _Phase, NL3D::CPSAttribMaker< uint32 >::deleteElement(), NL3D::CPSAttribMaker< float >::deleteElement(), NL3D::CPSAttribMaker< uint32 >::get(), NL3D::CPSAttribMaker< uint32 >::hasMemory(), NL3D::CPSAttribMaker< float >::hasMemory(), index, processEmit(), NL3D::CPSAttrib< T >::remove(), NL3D::CPSAttrib< float >::remove(), and uint32. +

+

01874 {       
+01875 
+01876         if (_EmissionType == CPSEmitter::onDeath && _EmittedType)
+01877         {
+01878                 if (!_BypassEmitOnDeath)
+01879                 {               
+01880                         const uint32 nbToGenerate = _GenNbScheme ? _GenNbScheme->get(_Owner, index) : _GenNb;           
+01881                         processEmit(index, nbToGenerate);
+01882                 }
+01883         }               
+01884 
+01885         if (_PeriodScheme && _PeriodScheme->hasMemory()) _PeriodScheme->deleteElement(index);
+01886         if (_GenNbScheme && _GenNbScheme->hasMemory()) _GenNbScheme->deleteElement(index);
+01887         _Phase.remove(index);
+01888         if (_MaxEmissionCount != 0)
+01889         {
+01890                 _NumEmission.remove(index);
+01891         }
+01892 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
void NL3D::CPSLocatedBindable::displayIcon2d const NLMISC::CVector  tab[],
uint  nbSegs,
float  scale
[protected, inherited]
+
+ + + + + +
+   + + +

+*************************************************************************************** +

+show an drawing to represent the object, and in red if it is selected

Parameters:
+ + + + +
tab : a table of 2 * nbSeg vector. only the x and y coordinates are used
nbSeg : the number of segment
scale : the scale to use for drawing
+
+ +

+Definition at line 2038 of file ps_located.cpp. +

+References NL3D::CPSLocatedBindable::computeI(), NL3D::CPSLocatedBindable::computeK(), NL3D::CParticleSystem::getCurrentEditedElement(), NL3D::CPSLocatedBindable::getDriver(), NL3D::CParticleSystemProcess::getOwner(), NL3D::CPSLocated::getPos(), NL3D::CPSLocated::getSize(), index, NL3D::CMaterial::setBlend(), NL3D::CMaterial::setBlendFunc(), NL3D::CMaterial::setColor(), NL3D::CMaterial::setLighting(), NL3D::CPSLocatedBindable::setupDriverModelMatrix(), NL3D::CMaterial::setZFunc(), NL3D::CMaterial::setZWrite(), size, uint, uint32, NLMISC::CLine::V0, NLMISC::CLine::V1, NLMISC::CVector::x, and NLMISC::CVector::y. +

+Referenced by NL3D::CPSSpring::show(), NL3D::CPSCentralGravity::show(), and NL3D::CPSParticle::showTool(). +

+

02039 {
+02040         uint32 size = _Owner->getSize();
+02041         if (!size) return;              
+02042         setupDriverModelMatrix();       
+02043 
+02044         const CVector I = computeI();
+02045         const CVector K = computeK();
+02046 
+02047         static std::vector<NLMISC::CLine> lines;
+02048         
+02049         lines.clear();
+02050 
+02051         // ugly slow code, but not for runtime
+02052         for (uint  k = 0; k < size; ++k)
+02053         {
+02054                 // center of the current particle
+02055                 const CVector p = _Owner->getPos()[k];
+02056                 
+02057                 
+02058 
+02059                 for (uint l = 0; l < nbSegs; ++l)
+02060                 {
+02061                         NLMISC::CLine li;
+02062                         li.V0 = p + scale * (tab[l << 1].x * I + tab[l << 1].y * K);
+02063                         li.V1 = p + scale * (tab[(l << 1) + 1].x * I + tab[(l << 1) + 1].y * K);
+02064                         lines.push_back(li);
+02065                 }
+02066         
+02067                 CMaterial mat;
+02068 
+02069                 mat.setBlendFunc(CMaterial::one, CMaterial::one);
+02070                 mat.setZWrite(false);
+02071                 mat.setLighting(false);
+02072                 mat.setBlend(true);
+02073                 mat.setZFunc(CMaterial::less);
+02074                 
+02075         
+02076 
+02077                 CPSLocated *loc;
+02078                 uint32 index;           
+02079                 CPSLocatedBindable *lb;
+02080                 _Owner->getOwner()->getCurrentEditedElement(loc, index, lb);
+02081         
+02082                 mat.setColor((lb == NULL || this == lb) && loc == _Owner && index == k  ? CRGBA::Red : CRGBA(127, 127, 127));
+02083                 
+02084 
+02085                 CDRU::drawLinesUnlit(lines, mat, *getDriver() );
+02086         }
+02087 
+02088 }
+
+

+ + + + +
+ + + + + + + + + + +
virtual bool NL3D::CPSLocatedBindable::doesProduceBBox void   )  const [inline, virtual, inherited]
+
+ + + + + +
+   + + +

+ +

+Reimplemented in NL3D::CPSForce. +

+Definition at line 888 of file ps_located.h. +

+

00888 { return true; }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
virtual void NL3D::CPSEmitter::emit const NLMISC::CVector srcPos,
uint32  index,
NLMISC::CVector pos,
NLMISC::CVector speed
[protected, pure virtual]
+
+ + + + + +
+   + + +

+This method is called each time one (and only one) located must be emitted. DERIVERS MUST DEFINE THIS

Parameters:
+ + + + + +
srcPos the source position of the emitter (with eventually a correction)
index the index of the emitter in the tab that generated a located
pos the resulting pos of the particle, expressed in the emitter basis
speed the reulting speed of the emitter, expressed in the emitter basis
+
+ +

+Implemented in NL3D::CPSEmitterDirectionnal, NL3D::CPSRadialEmitter, NL3D::CPSEmitterOmni, NL3D::CPSEmitterRectangle, NL3D::CPSEmitterConic, and NL3D::CPSSphericalEmitter. +

+Referenced by processEmit(), and processEmitConsistent().

+

+ + + + +
+ + + + + + + + + + +
void NL3D::CPSEmitter::enableConsistenEmission bool  enable  )  [inline]
+
+ + + + + +
+   + + +

+Enable consistent emission. The default is false. This try to keep the number of emitted particle constant, by allowing more than one emission cycle per iteration. This is useful to deal with poor frmerate. This has several drawbacks though :

    +
  • collisions are not properly supported in this case (may be resolved later).
  • The motion is in straight lines.
  • It assumes that emitter has no motion (for now). In fact, this should be used when there can't be collisions with the emitted particles, and with main emitters only. NB : this has no effect if the emission period is 0 (which mean emit at each frame)
+ +

+Definition at line 236 of file ps_emitter.h. +

+References _ConsistentEmission. +

+

00236 { _ConsistentEmission = enable; }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CPSEmitter::enableSpeedBasisEmission bool  enabled = true  ) 
+
+ + + + + +
+   + + +

+=============================================================================== +

+Align the direction of emission on the emitter speed. NB This also implies that the coord. system in which the speed vector is expressed if the same than the one of the emitter so the calls to enableUserMatrixModeForEmissionDirection() & setUserMatrixModeForEmissionDirection() have no effects (but their value is retained) +

+Definition at line 2593 of file ps_emitter.cpp. +

+References _SpeedBasisEmission, isUserMatrixUsed(), and updatePSRefCountForUserMatrixUsage(). +

+

02594 {
+02595         bool wasUserMatNeeded = isUserMatrixUsed();
+02596         _SpeedBasisEmission  = enabled;
+02597         updatePSRefCountForUserMatrixUsage(isUserMatrixUsed(), wasUserMatNeeded);
+02598 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CPSEmitter::enableUserMatrixModeForEmissionDirection bool  enable = true  ) 
+
+ + + + + +
+   + + +

+=============================================================================== +

+By default, the direction of emission is supposed to be expressed in the same coordinate system than the one of the emitter. Enabling a user matrix mode for the direction of emission allows to change that behaviour. example of use : A fire p.s is linked to a torch, but the torch doesn't point to the top. So particles are emitted in the axis aligned to the torch If matrix mode for direction emission is set to PSIdentityMatrix, then the direction is interpreted to be in world, and is thus independant from the torch orientation : particles are always spawned in the +K direction.

+NB : if isSpeedBasisEmissionEnabled() == true then this flag is meaningless +

+Definition at line 2601 of file ps_emitter.cpp. +

+References _UserMatrixModeForEmissionDirection, isUserMatrixUsed(), and updatePSRefCountForUserMatrixUsage(). +

+

02602 {
+02603         bool wasUserMatNeeded = isUserMatrixUsed();
+02604         _UserMatrixModeForEmissionDirection = enable;
+02605         updatePSRefCountForUserMatrixUsage(isUserMatrixUsed(), wasUserMatNeeded);
+02606 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
virtual void NL3D::CPSLocatedBindable::enumTexs std::vector< NLMISC::CSmartPtr< ITexture > > &  dest,
IDriver drv
[inline, virtual, inherited]
+
+ + + + + +
+   + + +

+ +

+Reimplemented in NL3D::CPSFanLight, NL3D::CPSQuad, NL3D::CPSRibbon, NL3D::CPSRibbonLookAt, and NL3D::CPSShockWave. +

+Definition at line 977 of file ps_located.h. +

+

00977 {}
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CPSLocatedBindable::finalize void   )  [virtual, inherited]
+
+ + + + + +
+   + + +

+*************************************************************************************** +

+this should be called before to delete any bindable inserted in a system, but this is done by the system, so you should never need calling it. This has been introduced because calls in dtor are not polymorphic to derived class (which are already destroyed anyway), and some infos are needed in some dtor. The default behaviour does nothing +

+Reimplemented in NL3D::CPSTargetLocatedBindable. +

+Definition at line 1975 of file ps_located.cpp. +

+References NL3D::CParticleSystemProcess::getOwner(), NL3D::CPSLocatedBindable::getUserMatrixUsageCount(), and NL3D::CParticleSystem::releaseRefForUserSysCoordInfo(). +

+

01976 {
+01977         if (_Owner && _Owner->getOwner())
+01978         {
+01979                 _Owner->getOwner()->releaseRefForUserSysCoordInfo(getUserMatrixUsageCount());
+01980         }
+01981 }       
+
+

+ + + + +
+ + + + + + + + + +
bool NL3D::CPSEmitter::getBypassAutoLOD  )  const [inline]
+
+ + + + + +
+   + + +

+ +

+Definition at line 252 of file ps_emitter.h. +

+References _BypassAutoLOD. +

+

00252 {       return _BypassAutoLOD; }
+
+

+ + + + +
+ + + + + + + + + +
virtual std::string NLMISC::IClassable::getClassName  )  [pure virtual, inherited]
+
+ + + + + +
+   + + +

+ +

+Implemented in NLAIAGENT::CNumericIndex, NLAIC::IPointerGestion, NLAIC::CIdentType, and CAutomataDesc. +

+Referenced by NLMISC::CClassRegistry::checkObject(), and NL3D::GetTextureSize().

+

+ + + + +
+ + + + + + + + + + +
IDriver* NL3D::CPSLocatedBindable::getDriver void   )  const [inline, inherited]
+
+ + + + + +
+   + + +

+shortcut to get an instance of the driver +

+ +

+Definition at line 890 of file ps_located.h. +

+References NL3D::CPSLocated::getDriver(), and nlassert. +

+Referenced by NL3D::CPSLocatedBindable::displayIcon2d(), NL3D::CPSTailDot::displayRibbons(), NL3D::CPSRibbonLookAt::displayRibbons(), NL3D::CPSRibbon::displayRibbons(), NL3D::CPSDot::draw(), NL3D::CPSFaceHelper::drawFaces(), NL3D::CPSFanLightHelper::drawFanLight(), NL3D::CPSFaceLookAtHelper::drawLookAt(), NL3D::CPSFaceLookAtHelper::drawLookAtAlignOnMotion(), NL3D::CPSConstraintMeshHelper::drawMeshs(), NL3D::CPSConstraintMeshHelper::drawPrerotatedMeshs(), NL3D::CPSZoneRectangle::show(), NL3D::CPSZoneCylinder::show(), NL3D::CPSZoneDisc::show(), NL3D::CPSZoneSphere::show(), NL3D::CPSZonePlane::show(), NL3D::CPSLight::show(), NL3D::CPSCylindricVortex::show(), NL3D::CPSGravity::show(), NL3D::CPSDirectionnalForce::show(), NL3D::CPSSphericalEmitter::showTool(), NL3D::CPSEmitterRectangle::showTool(), and showTool(). +

+

00891          { 
+00892                  nlassert(_Owner);
+00893                  nlassert(_Owner->getDriver());
+00894                  return _Owner->getDriver();
+00895          }              
+
+

+ + + + +
+ + + + + + + + + + +
TEmissionType NL3D::CPSEmitter::getEmissionType void   )  const [inline]
+
+ + + + + +
+   + + +

+Get the frequency type. +

+ +

+Definition at line 118 of file ps_emitter.h. +

+References _EmissionType, and TEmissionType. +

+Referenced by NL3D::CParticleSystem::evalDuration(), and testEmitForever(). +

+

00118 { return _EmissionType; }
+
+

+ + + + +
+ + + + + + + + + +
float NL3D::CPSEmitter::getEmitDelay  )  const [inline]
+
+ + + + + +
+   + + +

+Get the delay in seconds before the first emission (regular emitter only). +

+ +

+Definition at line 144 of file ps_emitter.h. +

+References _EmitDelay. +

+Referenced by NL3D::CParticleSystem::evalDuration(). +

+

00144 { return _EmitDelay; }
+
+

+ + + + +
+ + + + + + + + + + +
const CPSLocated* NL3D::CPSEmitter::getEmittedType void   )  const [inline]
+
+ + + + + +
+   + + +

+Get const ptr on emitted type. +

+ +

+Definition at line 98 of file ps_emitter.h. +

+References _EmittedType. +

+

00098 { return _EmittedType; }
+
+

+ + + + +
+ + + + + + + + + + +
CPSLocated* NL3D::CPSEmitter::getEmittedType void   )  [inline]
+
+ + + + + +
+   + + +

+Get emitted type. +

+ +

+Definition at line 96 of file ps_emitter.h. +

+References _EmittedType. +

+Referenced by NL3D::CParticleSystem::evalDuration(). +

+

00096 { return _EmittedType; }
+
+

+ + + + +
+ + + + + + + + + + +
uint32 NL3D::CPSLocatedBindable::getExternID void   )  const [inline, inherited]
+
+ + + + + +
+   + + +

+get the extern ID of this located bindable +

+ +

+Definition at line 964 of file ps_located.h. +

+References NL3D::CPSLocatedBindable::_ExternID, and uint32. +

+Referenced by NL3D::CPSLocated::bind(), and NL3D::CParticleSystem::unregisterLocatedBindableExternID(). +

+

00964 { return _ExternID; }
+
+

+ + + + +
+ + + + + + + + + + +
const CFontGenerator* NL3D::CPSLocatedBindable::getFontGenerator void   )  const [inline, inherited]
+
+ + + + + +
+   + + +

+Shortcut to get the font generator if one was set (const version). +

+ +

+Definition at line 904 of file ps_located.h. +

+References NL3D::CParticleSystemProcess::getFontGenerator(), and nlassert. +

+

00905          {
+00906                 nlassert(_Owner);
+00907                 return _Owner->getFontGenerator();
+00908          }
+
+

+ + + + +
+ + + + + + + + + + +
CFontGenerator* NL3D::CPSLocatedBindable::getFontGenerator void   )  [inline, inherited]
+
+ + + + + +
+   + + +

+Shortcut to get the font generator if one was set. +

+ +

+Definition at line 897 of file ps_located.h. +

+References NL3D::CParticleSystemProcess::getFontGenerator(), and nlassert. +

+Referenced by NL3D::CPSZoneRectangle::show(), NL3D::CPSZoneCylinder::show(), NL3D::CPSZoneDisc::show(), NL3D::CPSZonePlane::show(), NL3D::CPSCylindricVortex::show(), NL3D::CPSGravity::show(), and NL3D::CPSEmitterRectangle::showTool(). +

+

00898          {
+00899                 nlassert(_Owner);
+00900                 return _Owner->getFontGenerator();
+00901          }
+
+

+ + + + +
+ + + + + + + + + + +
const CFontManager * NL3D::CPSLocatedBindable::getFontManager void   )  const [inherited]
+
+ + + + + +
+   + + +

+Shortcut to get the font manager if one was set (const version). +

+ +

+Definition at line 2099 of file ps_located.cpp. +

+References NL3D::CParticleSystemProcess::getFontManager(), and nlassert. +

+

02100 {
+02101         nlassert(_Owner);
+02102         return _Owner->getFontManager();
+02103 }
+
+

+ + + + +
+ + + + + + + + + + +
CFontManager * NL3D::CPSLocatedBindable::getFontManager void   )  [inherited]
+
+ + + + + +
+   + + +

+*************************************************************************************** +

+ +

+Definition at line 2091 of file ps_located.cpp. +

+References NL3D::CParticleSystemProcess::getFontManager(), and nlassert. +

+Referenced by NL3D::CPSZoneRectangle::show(), NL3D::CPSZoneCylinder::show(), NL3D::CPSZoneDisc::show(), NL3D::CPSZonePlane::show(), NL3D::CPSCylindricVortex::show(), NL3D::CPSGravity::show(), and NL3D::CPSEmitterRectangle::showTool(). +

+

02092 {
+02093         nlassert(_Owner);
+02094         return _Owner->getFontManager();
+02095 }
+
+

+ + + + +
+ + + + + + + + + + +
uint NL3D::CPSEmitter::getGenNb void   )  const [inline]
+
+ + + + + +
+   + + +

+Retrieve the GenNb for emission, valid only if a GenNb scheme is used. +

+ +

+Definition at line 162 of file ps_emitter.h. +

+References _GenNb, and uint. +

+

00162 { return _GenNb; }
+
+

+ + + + +
+ + + + + + + + + + +
const CPSAttribMaker<uint32>* NL3D::CPSEmitter::getGenNbScheme void   )  const [inline]
+
+ + + + + +
+   + + +

+Retrieve the GenNb scheme, or null, if there'isnt (const version). +

+ +

+Definition at line 174 of file ps_emitter.h. +

+References _GenNbScheme. +

+

00174 { return _GenNbScheme; }
+
+

+ + + + +
+ + + + + + + + + + +
CPSAttribMaker<uint32>* NL3D::CPSEmitter::getGenNbScheme void   )  [inline]
+
+ + + + + +
+   + + +

+Retrieve the GenNb scheme, or null, if there'isnt. +

+ +

+Definition at line 171 of file ps_emitter.h. +

+References _GenNbScheme. +

+

00171 { return _GenNbScheme; }
+
+

+ + + + +
+ + + + + + + + + + +
const NLMISC::CMatrix & NL3D::CPSLocatedBindable::getInvertedSysMat void   )  const [inherited]
+
+ + + + + +
+   + + +

+shortcut to get the inverted matrix of the system +

+ +

+Definition at line 2116 of file ps_located.cpp. +

+References NL3D::CParticleSystem::getInvertedSysMat(), NL3D::CParticleSystemProcess::getOwner(), and nlassert. +

+

02117 {
+02118         nlassert(_Owner);
+02119                 return _Owner->getOwner()->getInvertedSysMat();
+02120 
+02121 }
+
+

+ + + + +
+ + + + + + + + + + +
const NLMISC::CMatrix & NL3D::CPSLocatedBindable::getInvertedViewMat void   )  const [inherited]
+
+ + + + + +
+   + + +

+shortcut to get the inverted view matrix +

+ +

+Definition at line 2134 of file ps_located.cpp. +

+References NL3D::CParticleSystem::getInvertedViewMat(), NL3D::CParticleSystemProcess::getOwner(), and nlassert. +

+

02135 {
+02136         nlassert(_Owner);
+02137         return _Owner->getOwner()->getInvertedViewMat();        
+02138 }       
+
+

+ + + + +
+ + + + + + + + + +
const NLMISC::CMatrix & NL3D::CPSLocatedBindable::getLocalToWorldMatrix  )  const [inline, inherited]
+
+ + + + + +
+   + + +

+Shortcut to get the local to world matrix. +

+ +

+Definition at line 1144 of file ps_located.h. +

+References NL3D::CPSLocated::getLocalToWorldMatrix(), and nlassert. +

+Referenced by NL3D::CPSRibbonLookAt::displayRibbons(), NL3D::CPSSound::newElement(), NL3D::CPSZoneRectangle::show(), NL3D::CPSZoneCylinder::show(), NL3D::CPSZoneDisc::show(), NL3D::CPSZonePlane::show(), NL3D::CPSLight::show(), NL3D::CPSGravity::show(), NL3D::CPSEmitterRectangle::showTool(), NL3D::CPSLight::step(), and NL3D::CPSMesh::updatePos(). +

+

01145 {
+01146         nlassert(_Owner);
+01147         return _Owner->getLocalToWorldMatrix();
+01148 }
+
+

+ + + + +
+ + + + + + + + + + +
TPSLod NL3D::CPSLocatedBindable::getLOD void   )  const [inline, inherited]
+
+ + + + + +
+   + + +

+get the valid lods for that object +

+ +

+Definition at line 954 of file ps_located.h. +

+References NL3D::CPSLocatedBindable::_LOD, and NL3D::TPSLod. +

+

00954 { return _LOD; }
+
+

+ + + + +
+ + + + + + + + + +
uint8 NL3D::CPSEmitter::getMaxEmissionCount  )  const [inline]
+
+ + + + + +
+   + + +

+Get the max. number of particle emission (0 means no limit and is the default). Applies with regular emitter only. +

+ +

+Definition at line 154 of file ps_emitter.h. +

+References _MaxEmissionCount, and uint8. +

+Referenced by NL3D::CParticleSystem::evalDuration(), and testEmitForever(). +

+

00154 { return _MaxEmissionCount; }
+
+

+ + + + +
+ + + + + + + + + + +
std::string NL3D::CPSLocatedBindable::getName void   )  const [inline, inherited]
+
+ + + + + +
+   + + +

+get the located bindable name (edition purpose) +

+ +

+Definition at line 948 of file ps_located.h. +

+

00948 { return _Name; }       
+
+

+ + + + +
+ + + + + + + + + + +
const CPSLocated* NL3D::CPSLocatedBindable::getOwner void   )  const [inline, inherited]
+
+ + + + + +
+   + + +

+get the located that owns this bindable (const version) +

+ +

+Definition at line 944 of file ps_located.h. +

+

00944 { return _Owner; }              
+
+

+ + + + +
+ + + + + + + + + + +
CPSLocated* NL3D::CPSLocatedBindable::getOwner void   )  [inline, inherited]
+
+ + + + + +
+   + + +

+get the located that owns this bindable +

+ +

+Definition at line 942 of file ps_located.h. +

+Referenced by NL3D::CPSLocated::deleteElement(), NL3D::CParticleSystemInstanceUser::emit(), NL3D::CPSFaceLookAt::CSecondSize::getSizeOwner(), NL3D::CPSSound::newElement(), NL3D::CPSLocated::registerIntegrableForce(), NL3D::CParticleSystem::registerLocatedBindableExternID(), NL3D::CParticleSystemInstanceUser::removeByID(), NL3D::CPSSound::resize(), NL3D::CPSLight::resize(), NL3D::CPSSound::step(), NL3D::CPSLocated::unregisterIntegrableForce(), and NL3D::CParticleSystem::unregisterLocatedBindableExternID(). +

+

00942 { return _Owner; }
+
+

+ + + + +
+ + + + + + + + + + +
float NL3D::CPSEmitter::getPeriod void   )  const [inline]
+
+ + + + + +
+   + + +

+Retrieve the period for emission, valid only if a period scheme is used. +

+ +

+Definition at line 126 of file ps_emitter.h. +

+References _Period. +

+Referenced by NL3D::CParticleSystem::evalDuration(). +

+

00126 { return _Period; }
+
+

+ + + + +
+ + + + + + + + + + +
const CPSAttribMaker<float>* NL3D::CPSEmitter::getPeriodScheme void   )  const [inline]
+
+ + + + + +
+   + + +

+ +

+Definition at line 138 of file ps_emitter.h. +

+References _PeriodScheme. +

+

00138 { return _PeriodScheme; }
+
+

+ + + + +
+ + + + + + + + + + +
CPSAttribMaker<float>* NL3D::CPSEmitter::getPeriodScheme void   )  [inline]
+
+ + + + + +
+   + + +

+ +

+Definition at line 135 of file ps_emitter.h. +

+References _PeriodScheme. +

+Referenced by NL3D::CParticleSystem::evalDuration(). +

+

00135 { return _PeriodScheme; }
+
+

+ + + + +
+ + + + + + + + + + +
virtual uint32 NL3D::CPSEmitter::getPriority void   )  const [inline, virtual]
+
+ + + + + +
+   + + +

+Return priority for emitters. +

+ +

+Implements NL3D::CPSLocatedBindable. +

+Definition at line 67 of file ps_emitter.h. +

+References uint32. +

+

00067 { return 500; }
+
+

+ + + + +
+ + + + + + + + + + +
float NL3D::CPSEmitter::getSpeedInheritanceFactor void   )  const [inline]
+
+ + + + + +
+   + + +

+Get the speed Inheritance factor. +

+ +

+Definition at line 190 of file ps_emitter.h. +

+References _SpeedInheritanceFactor. +

+

00191                 {
+00192                         return _SpeedInheritanceFactor;
+00193                 }
+
+

+ + + + +
+ + + + + + + + + + +
const NLMISC::CMatrix & NL3D::CPSLocatedBindable::getSysMat void   )  const [inherited]
+
+ + + + + +
+   + + +

+*************************************************************************************** +

+ +

+Definition at line 2108 of file ps_located.cpp. +

+References NL3D::CParticleSystemProcess::getOwner(), NL3D::CParticleSystem::getSysMat(), and nlassert. +

+

02109 {
+02110         nlassert(_Owner);               
+02111         return _Owner->getOwner()->getSysMat();
+02112 }
+
+

+ + + + +
+ + + + + + + + + + +
uint32 NL3D::CPSEmitter::getType void   )  const [inline, virtual]
+
+ + + + + +
+   + + +

+Return this bindable type. +

+ +

+Implements NL3D::CPSLocatedBindable. +

+Definition at line 63 of file ps_emitter.h. +

+References NL3D::PSEmitter, and uint32. +

+

00063 { return PSEmitter; }
+
+

+ + + + +
+ + + + + + + + + +
TPSMatrixMode NL3D::CPSEmitter::getUserMatrixModeForEmissionDirection  )  const [inline]
+
+ + + + + +
+   + + +

+=============================================================================== +

+Align the direction of emission on the emitter speed. NB This also implies that the coord. system in which the speed vector is expressed if the same than the one of the emitter so the calls to enableUserMatrixModeForEmissionDirection() & setUserMatrixModeForEmissionDirection() have no effects (but their value is retained) +

+Definition at line 222 of file ps_emitter.h. +

+References _UserDirectionMatrixMode, and NL3D::TPSMatrixMode. +

+

00222 {       return _UserDirectionMatrixMode; }              
+
+

+ + + + +
+ + + + + + + + + +
bool NL3D::CPSEmitter::getUserMatrixUsageCount  )  const [virtual]
+
+ + + + + +
+   + + +

+========================================================================== +

+ +

+Reimplemented from NL3D::CPSLocatedBindable. +

+Definition at line 2640 of file ps_emitter.cpp. +

+References isUserMatrixUsed(). +

+

02641 {
+02642         return isUserMatrixUsed() ? 1 : 0;
+02643 }
+
+

+ + + + +
+ + + + + + + + + + +
const NLMISC::CMatrix & NL3D::CPSLocatedBindable::getViewMat void   )  const [inherited]
+
+ + + + + +
+   + + +

+shortcut to get the view matrix +

+ +

+Definition at line 2125 of file ps_located.cpp. +

+References NL3D::CParticleSystemProcess::getOwner(), NL3D::CParticleSystem::getViewMat(), and nlassert. +

+Referenced by NL3D::CPSRibbonLookAt::displayRibbons(), and NL3D::CPSFaceLookAtHelper::drawLookAt(). +

+

02126 {
+02127         nlassert(_Owner);
+02128         return _Owner->getOwner()->getViewMat();        
+02129 }       
+
+

+ + + + +
+ + + + + + + + + + +
virtual bool NL3D::CPSLocatedBindable::hasEmitters void   )  const [inline, virtual, inherited]
+
+ + + + + +
+   + + +

+tells wether there are alive emitters +

+ +

+Definition at line 958 of file ps_located.h. +

+

00958 { return false; }
+
+

+ + + + +
+ + + + + + + + + + +
virtual bool NL3D::CPSEmitter::hasEmitters void   )  [inline, virtual]
+
+ + + + + +
+   + + +

+Return true if this located bindable derived class holds alive emitters. +

+ +

+Definition at line 70 of file ps_emitter.h. +

+References NL3D::CPSLocated::getSize(), and nlassert. +

+

00070 { nlassert(_Owner); return _Owner->getSize() != 0; }
+
+

+ + + + +
+ + + + + + + + + + +
virtual bool NL3D::CPSLocatedBindable::hasParticles void   )  const [inline, virtual, inherited]
+
+ + + + + +
+   + + +

+tells wether there are alive entities / particles +

+ +

+Reimplemented in NL3D::CPSParticle. +

+Definition at line 956 of file ps_located.h. +

+

00956 { return false; }
+
+

+ + + + +
+ + + + + + + + + +
bool NL3D::CPSLocatedBindable::isActive  )  const [inline, inherited]
+
+ + + + + +
+   + + +

+ +

+Definition at line 844 of file ps_located.h. +

+References NL3D::CPSLocatedBindable::_Active. +

+Referenced by NL3D::CParticleSystem::hasActiveEmitters(). +

+

00844 { return _Active; }                             
+
+

+ + + + +
+ + + + + + + + + +
bool NL3D::CPSEmitter::isConsistentEmissionEnabled  )  const [inline]
+
+ + + + + +
+   + + +

+ +

+Definition at line 238 of file ps_emitter.h. +

+References _ConsistentEmission. +

+

00238 { return _ConsistentEmission; }
+
+

+ + + + +
+ + + + + + + + + + +
bool NL3D::CPSEmitter::isSpeedBasisEmissionEnabled void   )  const [inline]
+
+ + + + + +
+   + + +

+Check if the direction of emission is aligned on the emitter speed.

See also:
enableSpeedBasisEmission()
+ +

+Definition at line 204 of file ps_emitter.h. +

+References _SpeedBasisEmission. +

+

00204 { return _SpeedBasisEmission; }
+
+

+ + + + +
+ + + + + + + + + +
bool NL3D::CPSEmitter::isUserMatrixModeForEmissionDirectionEnabled  )  const [inline]
+
+ + + + + +
+   + + +

+=============================================================================== +

+Align the direction of emission on the emitter speed. NB This also implies that the coord. system in which the speed vector is expressed if the same than the one of the emitter so the calls to enableUserMatrixModeForEmissionDirection() & setUserMatrixModeForEmissionDirection() have no effects (but their value is retained) +

+Definition at line 216 of file ps_emitter.h. +

+References _UserMatrixModeForEmissionDirection. +

+

+

+ + + + +
+ + + + + + + + + +
bool NL3D::CPSEmitter::isUserMatrixUsed  )  const [protected]
+
+ + + + + +
+   + + +

+========================================================================== +

+ +

+Definition at line 2634 of file ps_emitter.cpp. +

+References _SpeedBasisEmission, _UserDirectionMatrixMode, _UserMatrixModeForEmissionDirection, and NL3D::PSUserMatrix. +

+Referenced by enableSpeedBasisEmission(), enableUserMatrixModeForEmissionDirection(), getUserMatrixUsageCount(), and setUserMatrixModeForEmissionDirection(). +

+

+

+ + + + +
+ + + + + + + + + + +
virtual void NL3D::CPSLocatedBindable::motionTypeChanged bool  parametric  )  [inline, virtual, inherited]
+
+ + + + + +
+   + + +

+called when a located has switch between incrmental / parametric motion. The default does nothing +

+ +

+Reimplemented in NL3D::CPSRibbonBase. +

+Definition at line 971 of file ps_located.h. +

+Referenced by NL3D::CPSLocated::bind(). +

+

00971 {}
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NL3D::CPSEmitter::newElement CPSLocated emitterLocated,
uint32  emitterIndex
[protected, virtual]
+
+ + + + + +
+   + + +

+========================================================================== +

+Generate a new element for this bindable. They are generated according to the propertie of the class +

+Implements NL3D::CPSLocatedBindable. +

+Reimplemented in NL3D::CPSEmitterDirectionnal, NL3D::CPSEmitterOmni, NL3D::CPSEmitterRectangle, and NL3D::CPSSphericalEmitter. +

+Definition at line 1858 of file ps_emitter.cpp. +

+References _GenNbScheme, _MaxEmissionCount, _NumEmission, _PeriodScheme, _Phase, NL3D::CPSAttrib< float >::getMaxSize(), NL3D::CPSAttrib< float >::getSize(), NL3D::CPSAttribMaker< uint32 >::hasMemory(), NL3D::CPSAttribMaker< float >::hasMemory(), NL3D::CPSAttrib< T >::insert(), NL3D::CPSAttrib< float >::insert(), NL3D::CPSAttribMaker< uint32 >::newElement(), NL3D::CPSAttribMaker< float >::newElement(), nlassert, and uint32. +

+

01859 {       
+01860         nlassert(_Phase.getSize() != _Phase.getMaxSize());      
+01861 
+01862         _Phase.insert(0.f);
+01863         if (_MaxEmissionCount != 0)
+01864         {
+01865                 _NumEmission.insert(0); 
+01866         }
+01867         if (_PeriodScheme && _PeriodScheme->hasMemory()) _PeriodScheme->newElement(emitterLocated, emitterIndex);
+01868         if (_GenNbScheme && _GenNbScheme->hasMemory()) _GenNbScheme->newElement(emitterLocated, emitterIndex);
+01869 
+01870 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CPSEmitter::notifyTargetRemoved CPSLocated ptr  )  [virtual]
+
+ + + + + +
+   + + +

+========================================================================== +

+Inherited from CPSLocatedBindable We register to the emitted type, so, this, this will be called when it is destroyed +

+Reimplemented from NL3D::CPSLocatedBindable. +

+Definition at line 394 of file ps_emitter.cpp. +

+References _EmittedType, nlassert, and setEmittedType(). +

+

00395 {
+00396         nlassert(ptr == _EmittedType && _EmittedType);
+00397         setEmittedType(NULL);   
+00398 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NL3D::CPSEmitter::processEmit uint32  index,
sint  nbToGenerate
[inline, protected]
+
+ + + + + +
+   + + +

+========================================================================== +

+ +

+Definition at line 119 of file ps_emitter.cpp. +

+References _EmittedType, _SpeedBasisEmission, _SpeedInheritanceFactor, _UserDirectionMatrixMode, _UserMatrixModeForEmissionDirection, emit(), NL3D::CParticleSystemProcess::getMatrixMode(), NL3D::CPSLocated::getPos(), NL3D::CPSLocated::getSpeed(), index, NL3D::CPSLocated::newElement(), nlassert, sint, and uint32. +

+Referenced by bounceOccured(), deleteElement(), processRegularEmission(), processRegularEmissionConsistent(), processRegularEmissionConsistentWithNoLOD(), processRegularEmissionWithNoLOD(), singleEmit(), and step(). +

+

00120 {       
+00121         static NLMISC::CVector speed, pos;
+00122         nlassert(_Owner);
+00123         if (!_SpeedBasisEmission)
+00124         {
+00125                 if (_SpeedInheritanceFactor == 0.f)
+00126                 {               
+00127                         if (!_UserMatrixModeForEmissionDirection)
+00128                         {
+00129                                 while (nbToGenerate > 0)
+00130                                 {
+00131                                         nbToGenerate --;
+00132                                         emit(_Owner->getPos()[index], index, pos, speed);
+00133                                         _EmittedType->newElement(pos, speed, this->_Owner, index, _Owner->getMatrixMode(), 0.f);
+00134                                 }
+00135                         }
+00136                         else
+00137                         {
+00138                                 while (nbToGenerate > 0)
+00139                                 {
+00140                                         nbToGenerate --;
+00141                                         emit(_Owner->getPos()[index], index, pos, speed);
+00142                                         _EmittedType->newElement(pos, speed, this->_Owner, index, _UserDirectionMatrixMode, 0.f);
+00143                                 }
+00144                         }
+00145                 }
+00146                 else
+00147                 {
+00148                         while (nbToGenerate --)
+00149                         {
+00150                                 emit(_Owner->getPos()[index], index, pos, speed);
+00151                                 _EmittedType->newElement(pos, speed + _SpeedInheritanceFactor * _Owner->getSpeed()[index], this->_Owner, 0, _Owner->getMatrixMode(), 0.f);
+00152                         }
+00153                 }
+00154         }
+00155         else
+00156         {
+00157                 NLMISC::CMatrix m;
+00158                 CPSUtil::buildSchmidtBasis(_Owner->getSpeed()[index], m);
+00159                 if (_SpeedInheritanceFactor == 0.f)
+00160                 {               
+00161                         while (nbToGenerate > 0)
+00162                         {
+00163                                 nbToGenerate --;
+00164                                 emit(_Owner->getPos()[index], index, pos, speed);
+00165                                 _EmittedType->newElement(pos, m * speed, this->_Owner, index, _Owner->getMatrixMode(), 0.f);
+00166                         }
+00167                 }
+00168                 else
+00169                 {
+00170                         while (nbToGenerate --)
+00171                         {
+00172                                 emit(_Owner->getPos()[index], index, pos, speed);
+00173                                 _EmittedType->newElement(pos, m * speed + _SpeedInheritanceFactor * _Owner->getSpeed()[index], this->_Owner, index, _Owner->getMatrixMode(), 0.f);
+00174                         }
+00175                 }
+00176         }
+00177 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void NL3D::CPSEmitter::processEmitConsistent const NLMISC::CVector emitterPos,
uint32  index,
sint  nbToGenerate,
TAnimationTime  deltaT,
TAnimationTime  ellapsedTime,
float  realEllapsedTimeRatio
[inline, protected]
+
+ + + + + +
+   + + +

+========================================================================== +

+speed and pos of emittee +

+Definition at line 247 of file ps_emitter.cpp. +

+References _EmittedType, _SpeedBasisEmission, _SpeedInheritanceFactor, _UserDirectionMatrixMode, _UserMatrixModeForEmissionDirection, NL3D::CompensateEmission(), emit(), NL3D::CParticleSystemProcess::getMatrixMode(), NL3D::CPSLocated::getSpeed(), index, NL3D::CPSLocated::newElement(), nlassert, sint, NL3D::TAnimationTime, and uint32. +

+Referenced by processRegularEmissionConsistent(), and processRegularEmissionConsistentWithNoLOD(). +

+

00254 {               
+00255         static NLMISC::CVector speed, pos; 
+00256         nlassert(_Owner);
+00257         sint emittedIndex;
+00258         if (!_SpeedBasisEmission)
+00259         {
+00260                 if (_SpeedInheritanceFactor == 0.f)
+00261                 {               
+00262                         if (!_UserMatrixModeForEmissionDirection)
+00263                         {
+00264                                 while (nbToGenerate > 0)
+00265                                 {
+00266                                         nbToGenerate --;
+00267                                         emit(emitterPos, index, pos, speed);
+00268                                         emittedIndex = _EmittedType->newElement(pos, speed, this->_Owner, index, _Owner->getMatrixMode(), deltaT);
+00269                                         if (emittedIndex != - 1) CompensateEmission(_EmittedType, emittedIndex, deltaT, ellapsedTime, realEllapsedTimeRatio);
+00270                                         else break;
+00271                                 }
+00272                         }
+00273                         else
+00274                         {
+00275                                 while (nbToGenerate > 0)
+00276                                 {
+00277                                         nbToGenerate --;
+00278                                         emit(emitterPos, index, pos, speed);
+00279                                         emittedIndex = _EmittedType->newElement(pos, speed, this->_Owner, index, _UserDirectionMatrixMode, deltaT);
+00280                                         if (emittedIndex != - 1) CompensateEmission(_EmittedType, emittedIndex, deltaT, ellapsedTime, realEllapsedTimeRatio);
+00281                                         else break;
+00282                                 }
+00283                         }
+00284                 }
+00285                 else
+00286                 {
+00287                         while (nbToGenerate --)
+00288                         {
+00289                                 emit(emitterPos, index, pos, speed);
+00290                                 emittedIndex = _EmittedType->newElement(pos, speed + _SpeedInheritanceFactor * _Owner->getSpeed()[index], this->_Owner, index, _Owner->getMatrixMode(), deltaT);
+00291                                 if (emittedIndex != - 1) CompensateEmission(_EmittedType, emittedIndex, deltaT, ellapsedTime, realEllapsedTimeRatio);
+00292                                         else break;
+00293                         }
+00294                 }
+00295         }
+00296         else
+00297         {
+00298                 NLMISC::CMatrix m;
+00299                 CPSUtil::buildSchmidtBasis(_Owner->getSpeed()[index], m);
+00300                 if (_SpeedInheritanceFactor == 0.f)
+00301                 {               
+00302                         while (nbToGenerate > 0)
+00303                         {
+00304                                 nbToGenerate --;
+00305                                 emit(emitterPos, index, pos, speed);
+00306                                 emittedIndex = _EmittedType->newElement(pos, m * speed, this->_Owner, index, _Owner->getMatrixMode(), deltaT);
+00307                                 if (emittedIndex != - 1) CompensateEmission(_EmittedType, emittedIndex, deltaT, ellapsedTime, realEllapsedTimeRatio);
+00308                                         else break;
+00309                         }
+00310                 }
+00311                 else
+00312                 {
+00313                         while (nbToGenerate --)
+00314                         {
+00315                                 emit(emitterPos, index, pos, speed);
+00316                                 emittedIndex = _EmittedType->newElement(pos, m * speed + _SpeedInheritanceFactor * _Owner->getSpeed()[index], this->_Owner, index, _Owner->getMatrixMode(), deltaT);
+00317                                 if (emittedIndex != - 1) CompensateEmission(_EmittedType, emittedIndex, deltaT, ellapsedTime, realEllapsedTimeRatio);
+00318                                         else break;
+00319                         }
+00320                 }
+00321         }
+00322 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NL3D::CPSEmitter::processRegularEmission TAnimationTime  ellapsedTime,
float  emitLOD
[protected]
+
+ + + + + +
+   + + +

+========================================================================== +

+is there an emission delay ?

+is there an emission delay ? +

+Test if 'make' filled our buffer. If this is not the case, we assume that values where precomputed, and that all null period have already been replaced by the threshold +

+Definition at line 665 of file ps_emitter.cpp. +

+References _EmitDelay, _GenNb, _GenNbScheme, _MaxEmissionCount, _NumEmission, _Period, _PeriodScheme, _Phase, NL3D::CPSAttrib< T >::begin(), NL3D::CPSAttrib< float >::begin(), NL3D::EMIT_PERIOD_THRESHOLD, NL3D::EMITTER_BUFF_SIZE, NL3D::CPSAttribMaker< uint32 >::get(), NL3D::CPSAttribMaker< float >::getMaxValue(), NL3D::CPSAttribMaker< float >::getMinValue(), NL3D::CParticleSystemProcess::getOwner(), NL3D::CPSLocated::getSize(), NL3D::CParticleSystem::isEmitThresholdEnabled(), NL3D::CPSAttribMaker< float >::make(), nlassert, processEmit(), NL3D::replaceNullPeriodsByThreshold(), sint32, size, NL3D::TAnimationTime, uint, uint32, and uint8. +

+Referenced by step(). +

+

00666 {
+00667         nlassert(_Owner);
+00668         nlassert(_Owner->getOwner());
+00669         //
+00670         const bool emitThreshold = _Owner->getOwner()->isEmitThresholdEnabled();
+00671         //
+00672         const uint size = _Owner->getSize();
+00673         uint leftToDo = size, toProcess;
+00674         float emitPeriod[EMITTER_BUFF_SIZE]; 
+00675         const float *currEmitPeriod;
+00676         uint currEmitPeriodPtrInc = _PeriodScheme ? 1 : 0;                      
+00677         sint32 nbToGenerate;
+00678 
+00679         TPSAttribTime::iterator phaseIt = _Phase.begin(), endPhaseIt; 
+00680         TPSAttribUInt8::iterator numEmitIt = _NumEmission.begin();      
+00681 
+00682         float ellapsedTimeLOD = emitLOD * ellapsedTime;
+00683         uint maxEmissionCountLOD = (uint8) (_MaxEmissionCount * emitLOD);
+00684         maxEmissionCountLOD = std::max(1u, maxEmissionCountLOD);
+00685 
+00686         // we don't use an iterator here
+00687         // because it could be invalidated if size change (a located could generate itself)     
+00688         do
+00689         {
+00690                 toProcess = leftToDo < EMITTER_BUFF_SIZE ? leftToDo : EMITTER_BUFF_SIZE;
+00691 
+00692 
+00693                 if (_PeriodScheme)
+00694                 {
+00695                         currEmitPeriod = (float *) (_PeriodScheme->make(_Owner, size - leftToDo, emitPeriod, sizeof(float), toProcess, true));                          
+00696                         if (emitThreshold)
+00697                         {
+00698                                 
+00702                                 if (currEmitPeriod == emitPeriod) 
+00703                                 {
+00704                                         // if there possibility to have 0 in the scheme ?
+00705                                         if (_PeriodScheme->getMinValue() <= 0.f && _PeriodScheme->getMaxValue() >= 0.f)
+00706                                         {                                                                                       
+00707                                                 replaceNullPeriodsByThreshold(emitPeriod, toProcess);
+00708                                         }
+00709                                 }                               
+00710                         }
+00711                 }
+00712                 else
+00713                 {
+00714                         if (_Period != 0.f || !emitThreshold)
+00715                         {                       
+00716                                 currEmitPeriod = &_Period;
+00717                         }
+00718                         else
+00719                         {
+00720                                 currEmitPeriod = &EMIT_PERIOD_THRESHOLD;
+00721                         }
+00722                 }
+00723 
+00724                 endPhaseIt = phaseIt + toProcess;
+00725 
+00726                 if (_MaxEmissionCount == 0) // no emission count limit
+00727                 {
+00729                         if (_EmitDelay == 0.f) // no emission delay
+00730                         {
+00731                                 do                      
+00732                                 {
+00733                                         *phaseIt += ellapsedTimeLOD;
+00734                                         if ( *phaseIt >= *currEmitPeriod) // phase is greater than period -> must emit
+00735                                         {                                       
+00736                                                 if (*currEmitPeriod != 0)
+00737                                                 {
+00738                                                         *phaseIt -= ::floorf(*phaseIt / *currEmitPeriod) * *currEmitPeriod;
+00739                                                 }
+00740                                                 const uint32 k = phaseIt - (_Phase.begin());
+00741                                                 nbToGenerate = _GenNbScheme ? _GenNbScheme->get(_Owner, k) : _GenNb;
+00742                                                 if (nbToGenerate)
+00743                                                 {                                               
+00744                                                         nbToGenerate = (sint32) (emitLOD * nbToGenerate);
+00745                                                         if (!nbToGenerate) nbToGenerate = 1;
+00746                                                         processEmit(k, nbToGenerate);
+00747                                                 }
+00748                                         }       
+00749                                         
+00750                                         ++phaseIt;
+00751                                         currEmitPeriod += currEmitPeriodPtrInc;
+00752                                 }
+00753                                 while (phaseIt != endPhaseIt);
+00754                         }
+00755                         else // there's an emission delay
+00756                         {
+00757                                 do                      
+00758                                 {
+00759                                         if (*phaseIt < _EmitDelay)
+00760                                         {                                       
+00761                                                 *phaseIt += ellapsedTime;
+00762                                                 if (*phaseIt < _EmitDelay)
+00763                                                 {
+00764                                                         ++phaseIt;
+00765                                                         currEmitPeriod += currEmitPeriodPtrInc;
+00766                                                         continue;
+00767                                                 }
+00768                                                 else
+00769                                                 {
+00770                                                         *phaseIt =      (*phaseIt - _EmitDelay) * emitLOD + _EmitDelay;
+00771                                                 }
+00772                                         }
+00773                                         else
+00774                                         {
+00775                                                 *phaseIt += ellapsedTimeLOD;
+00776                                         }
+00777 
+00778                                         if ( *phaseIt >= *currEmitPeriod + _EmitDelay) // phase is greater than period -> must emit
+00779                                         {
+00780                                                 if (*currEmitPeriod != 0)
+00781                                                 {
+00782                                                         *phaseIt -= ::floorf((*phaseIt - _EmitDelay)  / *currEmitPeriod) * *currEmitPeriod;
+00783                                                 }
+00784                                                 const uint32 k = phaseIt - (_Phase.begin());
+00785                                                 nbToGenerate = _GenNbScheme ? _GenNbScheme->get(_Owner, k) : _GenNb;
+00786                                                 if (nbToGenerate)
+00787                                                 {                                               
+00788                                                         nbToGenerate = (sint32) (emitLOD * nbToGenerate);
+00789                                                         if (!nbToGenerate) nbToGenerate = 1;
+00790                                                         processEmit(k, nbToGenerate);
+00791                                                 }                                               
+00792                                         }       
+00793                                         
+00794                                         ++phaseIt;
+00795                                         currEmitPeriod += currEmitPeriodPtrInc;
+00796                                 }
+00797                                 while (phaseIt != endPhaseIt);
+00798                         }
+00799                 }
+00800                 else // there's an emission count limit
+00801                 {
+00803                         if (_EmitDelay == 0.f) // no emission delay
+00804                         {
+00805                                 do                      
+00806                                 {
+00807                                         if (*numEmitIt < maxEmissionCountLOD)
+00808                                         {
+00809                                                 *phaseIt += ellapsedTimeLOD;
+00810                                                 if ( *phaseIt >= *currEmitPeriod) // phase is greater than period -> must emit
+00811                                                 {
+00812                                                         if (*currEmitPeriod != 0)
+00813                                                         {
+00814                                                                 *phaseIt -= ::floorf(*phaseIt / *currEmitPeriod) * *currEmitPeriod;
+00815                                                         }
+00816                                                         const uint32 k = phaseIt - (_Phase.begin());
+00817                                                         nbToGenerate = _GenNbScheme ? _GenNbScheme->get(_Owner, k) : _GenNb;                                    
+00818                                                         if (nbToGenerate)
+00819                                                         {                                               
+00820                                                                 nbToGenerate = (sint32) (emitLOD * nbToGenerate);
+00821                                                                 if (!nbToGenerate) nbToGenerate = 1;
+00822                                                                 processEmit(k, nbToGenerate);
+00823                                                         }
+00824                                                         ++*numEmitIt;
+00825                                                 }       
+00826                                         }
+00827                                         else
+00828                                         {
+00829                                                 *numEmitIt = _MaxEmissionCount;
+00830                                         }
+00831                                         ++phaseIt;
+00832                                         currEmitPeriod += currEmitPeriodPtrInc;                                                 
+00833                                         ++ numEmitIt;
+00834                                 }
+00835                                 while (phaseIt != endPhaseIt);
+00836                         }
+00837                         else // there's an emission delay
+00838                         {
+00839                                 do                      
+00840                                 {
+00841                                         if (*numEmitIt < maxEmissionCountLOD)
+00842                                         {
+00843                                                 if (*phaseIt < _EmitDelay)
+00844                                                 {                                       
+00845                                                         *phaseIt += ellapsedTime;
+00846                                                         if (*phaseIt < _EmitDelay)
+00847                                                         {
+00848                                                                 ++phaseIt;
+00849                                                                 currEmitPeriod += currEmitPeriodPtrInc;
+00850                                                                 ++numEmitIt;
+00851                                                                 currEmitPeriod += currEmitPeriodPtrInc;
+00852                                                                 continue;
+00853                                                         }
+00854                                                         else
+00855                                                         {
+00856                                                                 *phaseIt =      (*phaseIt - _EmitDelay) * emitLOD + _EmitDelay;
+00857                                                         }
+00858                                                 }
+00859                                                 else
+00860                                                 {
+00861                                                         *phaseIt += ellapsedTimeLOD;
+00862                                                 }
+00863 
+00864                                                 if ( *phaseIt >= *currEmitPeriod + _EmitDelay) // phase is greater than period -> must emit
+00865                                                 {
+00866                                                         if (*currEmitPeriod != 0)
+00867                                                         {
+00868                                                                 *phaseIt -= ::floorf((*phaseIt - _EmitDelay) / *currEmitPeriod) * *currEmitPeriod;
+00869                                                         }
+00870                                                         const uint32 k = phaseIt - (_Phase.begin());
+00871                                                         nbToGenerate = _GenNbScheme ? _GenNbScheme->get(_Owner, k) : _GenNb;                                    
+00872                                                         if (nbToGenerate)
+00873                                                         {                                               
+00874                                                                 nbToGenerate = (sint32) (nbToGenerate * emitLOD);
+00875                                                                 if (!nbToGenerate) nbToGenerate = 1;
+00876                                                                 processEmit(k, nbToGenerate);
+00877                                                         }
+00878                                                         ++*numEmitIt;
+00879                                                 }
+00880                                         }
+00881                                         else
+00882                                         {
+00883                                                 *numEmitIt = _MaxEmissionCount;
+00884                                         }
+00885                                         ++phaseIt;
+00886                                         currEmitPeriod += currEmitPeriodPtrInc;
+00887                                         ++numEmitIt;
+00888                                 }
+00889                                 while (phaseIt != endPhaseIt);
+00890                         }
+00891                 }
+00892 
+00893                 leftToDo -= toProcess;
+00894         }
+00895         while (leftToDo);
+00896 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void NL3D::CPSEmitter::processRegularEmissionConsistent TAnimationTime  ellapsedTime,
float  realEllapsedTimeRatio,
float  emitLOD,
float  inverseEmitLOD
[protected]
+
+ + + + + +
+   + + +

+========================================================================== +

+Regular emission processing, with low-framrate compensation +

+Test if 'make' filled our buffer. If this is not the case, we assume that values where precomputed, and that all null period have already been replaced by the threshold

+Must ensure phase is valid if period decrease over time

+Must ensure phase is valid if period decrease over time

+Must ensure phase is valid if period decrease over time

+Must ensure phase is valid if period decrease over time +

+Definition at line 1000 of file ps_emitter.cpp. +

+References _EmitDelay, _EmittedType, _GenNb, _GenNbScheme, _MaxEmissionCount, _NumEmission, _Period, _PeriodScheme, _Phase, NL3D::CPSAttrib< T >::begin(), NL3D::CPSAttrib< float >::begin(), NL3D::EMIT_PERIOD_THRESHOLD, NL3D::EMITTER_BUFF_SIZE, NL3D::GenEmitterPositionsWithLOD(), NL3D::CPSAttribMaker< uint32 >::get(), NL3D::CPSAttribMaker< float >::getMaxValue(), NL3D::CPSAttribMaker< float >::getMinValue(), NL3D::CParticleSystemProcess::getOwner(), NL3D::CPSLocated::getSize(), NL3D::CParticleSystem::isEmitThresholdEnabled(), NL3D::CPSAttribMaker< float >::make(), min, nlassert, processEmit(), processEmitConsistent(), NL3D::replaceNullPeriodsByThreshold(), sint32, size, NL3D::TAnimationTime, uint, uint32, and uint8. +

+Referenced by step(). +

+

01001 {
+01003 
+01004         nlassert(_Owner);
+01005         nlassert(_Owner->getOwner());
+01006         //
+01007         const bool emitThreshold = _Owner->getOwner()->isEmitThresholdEnabled();
+01008         //
+01009 
+01010 
+01011         static std::vector<NLMISC::CVector> emitterPositions; 
+01012         // Positions for the emitter. They are computed by using a parametric trajectory or by using integration
+01013 
+01014         const uint size = _Owner->getSize();
+01015         uint leftToDo = size, toProcess;
+01016         float emitPeriod[EMITTER_BUFF_SIZE]; 
+01017         const float *currEmitPeriod;
+01018         uint currEmitPeriodPtrInc = _PeriodScheme ? 1 : 0;                      
+01019         sint32 nbToGenerate;
+01020 
+01021 
+01022         TPSAttribTime::iterator phaseIt = _Phase.begin(), endPhaseIt; 
+01023         TPSAttribUInt8::iterator numEmitIt = _NumEmission.begin(); 
+01024 
+01025         float ellapsedTimeLOD = ellapsedTime * emitLOD;
+01026         uint maxEmissionCountLOD = (uint8) (_MaxEmissionCount * emitLOD);
+01027         maxEmissionCountLOD = std::max(1u, maxEmissionCountLOD);
+01028 
+01029         // we don't use an iterator here
+01030         // because it could be invalidated if size change (a located could generate itself)     
+01031         do
+01032         {
+01033                 toProcess = leftToDo < EMITTER_BUFF_SIZE ? leftToDo : EMITTER_BUFF_SIZE;
+01034 
+01035 
+01036                 if (_PeriodScheme)
+01037                 {
+01038                         currEmitPeriod = (float *) (_PeriodScheme->make(_Owner, size - leftToDo, emitPeriod, sizeof(float), toProcess, true));                          
+01039                         if (emitThreshold)
+01040                         {
+01041                                 
+01045                                 if (currEmitPeriod == emitPeriod) 
+01046                                 {
+01047                                         // if there possibility to have 0 in the scheme ?
+01048                                         if (_PeriodScheme->getMinValue() <= 0.f && _PeriodScheme->getMaxValue() >= 0.f)
+01049                                         {                                                                                       
+01050                                                 replaceNullPeriodsByThreshold(emitPeriod, toProcess);
+01051                                         }
+01052                                 }                               
+01053                         }
+01054                 }
+01055                 else
+01056                 {
+01057                         if (_Period != 0.f || !emitThreshold)
+01058                         {                       
+01059                                 currEmitPeriod = &_Period;
+01060                         }
+01061                         else
+01062                         {
+01063                                 currEmitPeriod = &EMIT_PERIOD_THRESHOLD;
+01064                         }
+01065                 }
+01066 
+01067                 endPhaseIt = phaseIt + toProcess;
+01068 
+01069                 if (_MaxEmissionCount == 0) // no emission count limit
+01070                 {
+01072                         if (_EmitDelay == 0.f) // no emission delay
+01073                         {
+01074                                 do                      
+01075                                 {
+01076                                         *phaseIt += ellapsedTimeLOD;
+01077                                         if ( *phaseIt >= *currEmitPeriod) // phase is greater than period -> must emit
+01078                                         {                                                                       
+01079                                                 if (*currEmitPeriod != 0)
+01080                                                 {               
+01083                                                         *phaseIt = std::min(*phaseIt, *currEmitPeriod + ellapsedTimeLOD);
+01084                                                         //
+01086                                                         uint numEmissions = (uint) ::floorf(*phaseIt / *currEmitPeriod);
+01087                                                         *phaseIt -= *currEmitPeriod * numEmissions;
+01088                                                                                                                 
+01089                                                         uint emitterIndex = phaseIt - _Phase.begin();
+01090                                                         nbToGenerate = _GenNbScheme ? _GenNbScheme->get(_Owner, emitterIndex) : _GenNb;
+01091                                                         if (nbToGenerate)
+01092                                                         {
+01093                                                                 float deltaT = std::max(0.f, *phaseIt);                                                         
+01094 
+01096                                                                 numEmissions = GenEmitterPositionsWithLOD(_Owner,
+01097                                                                                                                                                   _EmittedType,
+01098                                                                                                                                                   emitterIndex,
+01099                                                                                                                                                   numEmissions,
+01100                                                                                                                                                   deltaT,
+01101                                                                                                                                                   *currEmitPeriod,
+01102                                                                                                                                                   inverseEmitLOD,
+01103                                                                                                                                                   emitterPositions
+01104                                                                                                                                                  );
+01105 
+01107                                                                 nbToGenerate = (sint32) (emitLOD * nbToGenerate);
+01108                                                                 if (!nbToGenerate) nbToGenerate = 1;
+01109                                                                 uint k = numEmissions;                                                  
+01110                                                                 float deltaTInc = *currEmitPeriod * inverseEmitLOD;
+01111                                                                 do
+01112                                                                 {       
+01113                                                                         --k;
+01114                                                                         processEmitConsistent(emitterPositions[k],
+01115                                                                                                                   emitterIndex,
+01116                                                                                                                   nbToGenerate,
+01117                                                                                                                   deltaT,
+01118                                                                                                                   ellapsedTime,
+01119                                                                                                                   realEllapsedTimeRatio);
+01120                                                                         deltaT += deltaTInc;                                                            
+01121                                                                 }
+01122                                                                 while (k);
+01123                                                         }
+01124                                                 }
+01125                                                 else
+01126                                                 {
+01127                                                         const uint32 emitterIndex = phaseIt - (_Phase.begin());
+01128                                                         nbToGenerate = _GenNbScheme ? _GenNbScheme->get(_Owner, emitterIndex) : _GenNb;
+01129                                                         if (nbToGenerate)
+01130                                                         {
+01131                                                                 nbToGenerate = (sint32) (emitLOD * nbToGenerate);
+01132                                                                 if (!nbToGenerate) nbToGenerate = 1;
+01133                                                                 processEmit(emitterIndex, nbToGenerate);
+01134                                                         }
+01135                                                 }
+01136                                         }       
+01137                                         
+01138                                         ++phaseIt;                                      
+01139                                         currEmitPeriod += currEmitPeriodPtrInc;
+01140                                 }
+01141                                 while (phaseIt != endPhaseIt);
+01142                         }
+01143                         else // thhere's an emission delay
+01144                         {
+01145                                 do                      
+01146                                 {
+01147                                         if (*phaseIt < _EmitDelay)
+01148                                         {                                       
+01149                                                 *phaseIt += ellapsedTime;
+01150                                                 if (*phaseIt < _EmitDelay)
+01151                                                 {
+01152                                                         ++phaseIt;
+01153                                                         currEmitPeriod += currEmitPeriodPtrInc;
+01154                                                         continue;
+01155                                                 }
+01156                                                 else
+01157                                                 {
+01158                                                         *phaseIt =      (*phaseIt - _EmitDelay) * emitLOD + _EmitDelay;
+01159                                                 }
+01160                                         }
+01161                                         else
+01162                                         {
+01163                                                 *phaseIt += ellapsedTimeLOD;
+01164                                         }
+01165                                                                                 
+01166                                         if ( *phaseIt >= *currEmitPeriod + _EmitDelay) // phase is greater than period -> must emit
+01167                                         {                                               
+01168                                                 if (*currEmitPeriod != 0)
+01169                                                 {               
+01172                                                         *phaseIt = std::min(*phaseIt, *currEmitPeriod + ellapsedTimeLOD + _EmitDelay);
+01173                                                         //
+01174                                                         uint numEmissions = (uint) ::floorf((*phaseIt - _EmitDelay) / *currEmitPeriod);
+01175                                                         *phaseIt -= *currEmitPeriod * numEmissions;
+01176                                                         float deltaT = std::max(*phaseIt - _EmitDelay, 0.f);
+01177                                                         //nlassert(deltaT >= 0.f);
+01179                                                         uint emitterIndex = phaseIt - _Phase.begin();
+01180                                                         nbToGenerate = _GenNbScheme ? _GenNbScheme->get(_Owner, emitterIndex) : _GenNb;                                                                                                                                                         
+01181                                                         if (nbToGenerate)
+01182                                                         {
+01183                                                                 
+01185                                                                 numEmissions = GenEmitterPositionsWithLOD(  _Owner,
+01186                                                                                                                                                         _EmittedType,
+01187                                                                                                                                                         emitterIndex,
+01188                                                                                                                                                         numEmissions,
+01189                                                                                                                                                         deltaT,
+01190                                                                                                                                                         *currEmitPeriod,
+01191                                                                                                                                                         inverseEmitLOD,
+01192                                                                                                                                                         emitterPositions
+01193                                                                                                                                                    );
+01194                                                                                         
+01195                                                                 nbToGenerate = (sint32) (emitLOD * nbToGenerate);
+01196                                                                 if (!nbToGenerate) nbToGenerate = 1;
+01197                                                                 uint k = numEmissions;                                                  
+01198                                                                 float deltaTInc = *currEmitPeriod * inverseEmitLOD;
+01199                                                                 do
+01200                                                                 {       
+01201                                                                         --k;
+01202                                                                         processEmitConsistent(emitterPositions[k],
+01203                                                                                                                   emitterIndex,
+01204                                                                                                                   nbToGenerate,
+01205                                                                                                                   deltaT,
+01206                                                                                                                   ellapsedTime,
+01207                                                                                                                   realEllapsedTimeRatio);
+01208                                                                         deltaT += deltaTInc;                                                            
+01209                                                                 }
+01210                                                                 while (k);
+01211                                                         }
+01212                                                 }
+01213                                                 else
+01214                                                 {               
+01215                                                         const uint32 emitterIndex = phaseIt - (_Phase.begin());
+01216                                                         nbToGenerate = _GenNbScheme ? _GenNbScheme->get(_Owner, emitterIndex) : _GenNb;
+01217                                                         if (nbToGenerate)
+01218                                                         {
+01219                                                                 nbToGenerate = (sint32) (emitLOD * nbToGenerate);
+01220                                                                 if (!nbToGenerate) nbToGenerate = 1;
+01221                                                                 processEmit(emitterIndex, nbToGenerate);
+01222                                                         }
+01223                                                 }                                                                       
+01224                                         }       
+01225                                         
+01226                                         ++phaseIt;                                      
+01227                                         currEmitPeriod += currEmitPeriodPtrInc;
+01228                                 }
+01229                                 while (phaseIt != endPhaseIt);
+01230                         }
+01231                 }
+01232                 else // there's an emission count limit
+01233                 {
+01235                         if (_EmitDelay == 0.f) // no emission delay
+01236                         {
+01237                                 do                      
+01238                                 {
+01239                                         if (*numEmitIt < maxEmissionCountLOD)
+01240                                         {
+01241                                                 *phaseIt += ellapsedTimeLOD;
+01242                                                 if ( *phaseIt >= *currEmitPeriod) // phase is greater than period -> must emit
+01243                                                 {
+01244                                                         if (*currEmitPeriod != 0)
+01245                                                         {
+01248                                                                 *phaseIt = std::min(*phaseIt, *currEmitPeriod + ellapsedTimeLOD);
+01249                                                                 //
+01250                                                                 uint numEmissions = (uint) ::floorf(*phaseIt / *currEmitPeriod);
+01251                                                                 *numEmitIt +=  numEmissions;                                                            
+01252                                                                 *phaseIt -= *currEmitPeriod * numEmissions;
+01253                                                                 float deltaT = std::max(*phaseIt, 0.f);
+01254                                                                 //nlassert(deltaT >= 0.f);
+01255                                                                 uint emitterIndex = phaseIt - _Phase.begin();
+01256                                                                 if (*numEmitIt > _MaxEmissionCount) // make sure we don't go over the emission limit
+01257                                                                 {
+01258                                                                         numEmissions -= *numEmitIt - _MaxEmissionCount;
+01259                                                                         *numEmitIt = _MaxEmissionCount;
+01260                                                                 }
+01261                                                                 nbToGenerate = _GenNbScheme ? _GenNbScheme->get(_Owner, emitterIndex) : _GenNb;                                                         
+01262                                                                 if (nbToGenerate)
+01263                                                                 {
+01265                                                                         numEmissions = GenEmitterPositionsWithLOD(_Owner,
+01266                                                                                                                                                                 _EmittedType,
+01267                                                                                                                                                                 emitterIndex,
+01268                                                                                                                                                                 numEmissions,
+01269                                                                                                                                                                 deltaT,
+01270                                                                                                                                                                 *currEmitPeriod,
+01271                                                                                                                                                                 inverseEmitLOD,
+01272                                                                                                                                                                 emitterPositions
+01273                                                                                                                                                          );
+01274                                                                         uint k = numEmissions;                                                          
+01276                                                                         nbToGenerate = (sint32) (emitLOD * nbToGenerate);
+01277                                                                         if (!nbToGenerate) nbToGenerate = 1;
+01278                                                                         float deltaTInc = *currEmitPeriod * inverseEmitLOD;
+01279                                                                         do
+01280                                                                         {
+01281                                                                                 --k;
+01282                                                                                 processEmitConsistent(emitterPositions[k],
+01283                                                                                                                           emitterIndex,
+01284                                                                                                                           nbToGenerate,
+01285                                                                                                                           deltaT,
+01286                                                                                                                           ellapsedTime,
+01287                                                                                                                           realEllapsedTimeRatio);
+01288                                                                                 deltaT += deltaTInc;                                                                    
+01289                                                                         }
+01290                                                                         while (k);
+01291                                                                 }
+01292                                                         }
+01293                                                         else
+01294                                                         {
+01295                                                                 const uint32 emitterIndex = phaseIt - _Phase.begin();
+01296                                                                 nbToGenerate = _GenNbScheme ? _GenNbScheme->get(_Owner, emitterIndex) : _GenNb;                                                         
+01297                                                                 if (nbToGenerate)
+01298                                                                 {
+01299                                                                         nbToGenerate = (sint32) (emitLOD * nbToGenerate);
+01300                                                                         if (!nbToGenerate) nbToGenerate = 1;
+01301                                                                         processEmit(emitterIndex, nbToGenerate);                                                                
+01302                                                                         ++*numEmitIt;
+01303                                                                 }
+01304                                                         }
+01305                                                 }       
+01306                                         }
+01307                                         else
+01308                                         {
+01309                                                 *numEmitIt = _MaxEmissionCount; // if the lod change, must ensure that the 
+01310                                         }
+01311                                         ++phaseIt;                                      
+01312                                         currEmitPeriod += currEmitPeriodPtrInc;                                                 
+01313                                         ++ numEmitIt;
+01314                                 }
+01315                                 while (phaseIt != endPhaseIt);
+01316                         }
+01317                         else // there's an emission delay
+01318                         {
+01319                                 do                      
+01320                                 {
+01321                                         if (*numEmitIt < maxEmissionCountLOD)
+01322                                         {
+01323                                                 if (*phaseIt < _EmitDelay)
+01324                                                 {                                       
+01325                                                         *phaseIt += ellapsedTime;
+01326                                                         if (*phaseIt < _EmitDelay)
+01327                                                         {
+01328                                                                 ++phaseIt;                                      
+01329                                                                 currEmitPeriod += currEmitPeriodPtrInc;
+01330                                                                 ++numEmitIt;
+01331                                                                 continue;
+01332                                                         }
+01333                                                         else
+01334                                                         {
+01335                                                                 *phaseIt =      (*phaseIt - _EmitDelay) * emitLOD + _EmitDelay;
+01336                                                         }
+01337                                                 }
+01338                                                 else
+01339                                                 {
+01340                                                         *phaseIt += ellapsedTimeLOD;
+01341                                                 }
+01342                                                 //
+01343                                                 if ( *phaseIt >= *currEmitPeriod + _EmitDelay) // phase is greater than period -> must emit
+01344                                                 {                                                       
+01345                                                         if (*currEmitPeriod != 0)
+01346                                                         {               
+01349                                                                 *phaseIt = std::min(*phaseIt, *currEmitPeriod + ellapsedTimeLOD + _EmitDelay);
+01350                                                                 //
+01351                                                                 uint numEmissions = (uint) ::floorf((*phaseIt - _EmitDelay) / *currEmitPeriod);
+01352                                                                 *numEmitIt +=  numEmissions;                                                            
+01353                                                                 *phaseIt -= *currEmitPeriod * numEmissions;
+01354                                                                 float deltaT = std::max(*phaseIt - _EmitDelay, 0.f);
+01355                                                                 //nlassert(deltaT >= 0.f);
+01356                                                                 uint emitterIndex = phaseIt - _Phase.begin();
+01357                                                                 if (*numEmitIt > _MaxEmissionCount) // make sure we don't go over the emission limit
+01358                                                                 {
+01359                                                                         numEmissions -= *numEmitIt - _MaxEmissionCount;
+01360                                                                         *numEmitIt = _MaxEmissionCount;
+01361                                                                 }
+01362                                                                 nbToGenerate = _GenNbScheme ? _GenNbScheme->get(_Owner, emitterIndex) : _GenNb;                                                         
+01363                                                                 if (nbToGenerate)
+01364                                                                 {
+01366                                                                         numEmissions = GenEmitterPositionsWithLOD(      _Owner,
+01367                                                                                                                                                                 _EmittedType,
+01368                                                                                                                                                                 emitterIndex,
+01369                                                                                                                                                                 numEmissions,
+01370                                                                                                                                                                 deltaT,
+01371                                                                                                                                                                 *currEmitPeriod,
+01372                                                                                                                                                                 inverseEmitLOD,
+01373                                                                                                                                                                 emitterPositions
+01374                                                                                                                                                          );
+01375                                                                         uint k = numEmissions;                                                  
+01377                                                                         nbToGenerate = (sint32) (emitLOD * nbToGenerate);
+01378                                                                         if (!nbToGenerate) nbToGenerate = 1;
+01379                                                                         float deltaTInc = *currEmitPeriod * inverseEmitLOD;
+01380                                                                         do
+01381                                                                         {       
+01382                                                                                 --k;
+01383                                                                                 processEmitConsistent(emitterPositions[k],
+01384                                                                                                                           emitterIndex,
+01385                                                                                                                           nbToGenerate,
+01386                                                                                                                           deltaT,
+01387                                                                                                                           ellapsedTime,
+01388                                                                                                                           realEllapsedTimeRatio);
+01389                                                                                 deltaT += deltaTInc;                                                                    
+01390                                                                         }
+01391                                                                         while (k);
+01392                                                                 }
+01393                                                         }
+01394                                                         else
+01395                                                         {
+01396                                                                 const uint32 emitterIndex = phaseIt - (_Phase.begin());
+01397                                                                 nbToGenerate = _GenNbScheme ? _GenNbScheme->get(_Owner, emitterIndex) : _GenNb;
+01398                                                                 if (nbToGenerate)
+01399                                                                 {
+01400                                                                         nbToGenerate = (sint32) (emitLOD * nbToGenerate);
+01401                                                                         if (!nbToGenerate) nbToGenerate = 1;
+01402                                                                         processEmit(emitterIndex, nbToGenerate);                                                                
+01403                                                                         ++*numEmitIt;
+01404                                                                 }
+01405                                                         }
+01406                                                 }
+01407                                         }                                                       
+01408                                         else
+01409                                         {
+01410                                                 *numEmitIt = _MaxEmissionCount; // if the lod change, must ensure that the 
+01411                                         }
+01412                                         ++phaseIt;                                      
+01413                                         currEmitPeriod += currEmitPeriodPtrInc;
+01414                                         ++numEmitIt;
+01415                                 }
+01416                                 while (phaseIt != endPhaseIt);
+01417                         }
+01418                 }
+01419 
+01420                 leftToDo -= toProcess;
+01421         }
+01422         while (leftToDo);
+01423 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NL3D::CPSEmitter::processRegularEmissionConsistentWithNoLOD TAnimationTime  ellapsedTime,
float  realEllapsedTimeRatio
[protected]
+
+ + + + + +
+   + + +

+========================================================================== +

+hmm some code factorisation would do no harm, but we want to keep tests outside the loops as much as possible...

+is there an emission delay ?

+compute the number of emissions

+compute the position of the emitter for the needed dates

+process each emission at the right pos at the right date

+compute the position of the emitter for the needed date

+process each emission at the right pos at the right date

+is there an emission delay ?

+compute the position of the emitter for the needed date

+process each emission at the right pos at the right date

+compute the position of the emitter for the needed date

+process each emission at the right pos at the right date +

+Test if 'make' filled our buffer. If this is not the case, we assume that values where precomputed, and that all null period have already been replaced by the threshold

+Must ensure phase is valid if period decrease over time

+Must ensure phase is valid if period decrease over time

+Must ensure phase is valid if period decrease over time

+Must ensure phase is valid if period decrease over time +

+Definition at line 1426 of file ps_emitter.cpp. +

+References _EmitDelay, _EmittedType, _GenNb, _GenNbScheme, _MaxEmissionCount, _NumEmission, _Period, _PeriodScheme, _Phase, NL3D::CPSAttrib< T >::begin(), NL3D::CPSAttrib< float >::begin(), NL3D::EMIT_PERIOD_THRESHOLD, NL3D::EMITTER_BUFF_SIZE, NL3D::GenEmitterPositions(), NL3D::CPSAttribMaker< uint32 >::get(), NL3D::CPSAttribMaker< float >::getMaxValue(), NL3D::CPSAttribMaker< float >::getMinValue(), NL3D::CParticleSystemProcess::getOwner(), NL3D::CPSLocated::getSize(), NL3D::CParticleSystem::isEmitThresholdEnabled(), NL3D::CPSAttribMaker< float >::make(), min, nlassert, processEmit(), processEmitConsistent(), NL3D::replaceNullPeriodsByThreshold(), sint32, size, NL3D::TAnimationTime, uint, and uint32. +

+Referenced by step(). +

+

01427 {
+01429 
+01430         nlassert(_Owner);
+01431         nlassert(_Owner->getOwner());
+01432         //
+01433         const bool emitThreshold = _Owner->getOwner()->isEmitThresholdEnabled();
+01434         //
+01435 
+01436 
+01437         static std::vector<NLMISC::CVector> emitterPositions; 
+01438         // Positions for the emitter. They are computed by using a parametric trajectory or by using integration
+01439 
+01440         const uint size = _Owner->getSize();
+01441         uint leftToDo = size, toProcess;
+01442         float emitPeriod[EMITTER_BUFF_SIZE]; 
+01443         const float *currEmitPeriod;
+01444         uint currEmitPeriodPtrInc = _PeriodScheme ? 1 : 0;                      
+01445         sint32 nbToGenerate;
+01446 
+01447 
+01448         TPSAttribTime::iterator phaseIt = _Phase.begin(), endPhaseIt; 
+01449         TPSAttribUInt8::iterator numEmitIt = _NumEmission.begin(); 
+01450 
+01451         // we don't use an iterator here
+01452         // because it could be invalidated if size change (a located could generate itself)     
+01453         do
+01454         {
+01455                 toProcess = leftToDo < EMITTER_BUFF_SIZE ? leftToDo : EMITTER_BUFF_SIZE;
+01456 
+01457 
+01458                 if (_PeriodScheme)
+01459                 {
+01460                         currEmitPeriod = (float *) (_PeriodScheme->make(_Owner, size - leftToDo, emitPeriod, sizeof(float), toProcess, true));                          
+01461                         if (emitThreshold)
+01462                         {
+01463                                 
+01467                                 if (currEmitPeriod == emitPeriod) 
+01468                                 {
+01469                                         // if there possibility to have 0 in the scheme ?
+01470                                         if (_PeriodScheme->getMinValue() <= 0.f && _PeriodScheme->getMaxValue() >= 0.f)
+01471                                         {                                                                                       
+01472                                                 replaceNullPeriodsByThreshold(emitPeriod, toProcess);
+01473                                         }
+01474                                 }                               
+01475                         }
+01476                 }
+01477                 else
+01478                 {
+01479                         if (_Period != 0.f || !emitThreshold)
+01480                         {                       
+01481                                 currEmitPeriod = &_Period;
+01482                         }
+01483                         else
+01484                         {
+01485                                 currEmitPeriod = &EMIT_PERIOD_THRESHOLD;
+01486                         }
+01487                 }               
+01488 
+01489                 endPhaseIt = phaseIt + toProcess;
+01490 
+01491                 if (_MaxEmissionCount == 0) // no emission count limit
+01492                 {
+01494                         if (_EmitDelay == 0.f) // no emission delay
+01495                         {
+01496                                 do                      
+01497                                 {
+01498                                         *phaseIt += ellapsedTime;
+01499                                         if ( *phaseIt >= *currEmitPeriod) // phase is greater than period -> must emit
+01500                                         {                                                                       
+01501                                                 if (*currEmitPeriod != 0)
+01502                                                 {               
+01505                                                         *phaseIt = std::min(*phaseIt, *currEmitPeriod + ellapsedTime);
+01506                                                         //
+01508                                                         uint numEmissions = (uint) ::floorf(*phaseIt / *currEmitPeriod);
+01509                                                         *phaseIt -= *currEmitPeriod * numEmissions;
+01510                                                         float deltaT = std::max(0.f, *phaseIt);
+01511                                                         //nlassert(deltaT >= 0.f);
+01512                                                         uint emitterIndex = phaseIt - _Phase.begin();
+01513 
+01515                                                         numEmissions = GenEmitterPositions(_Owner,
+01516                                                                                                                                 _EmittedType,
+01517                                                                                                                                 emitterIndex,
+01518                                                                                                                                 numEmissions,
+01519                                                                                                                                 deltaT,
+01520                                                                                                                                 *currEmitPeriod,
+01521                                                                                                                                 emitterPositions
+01522                                                                                                                            );
+01523 
+01525                                                         nbToGenerate = _GenNbScheme ? _GenNbScheme->get(_Owner, emitterIndex) : _GenNb;
+01526                                                         uint k = numEmissions;                                                  
+01527                                                         do
+01528                                                         {       
+01529                                                                 --k;
+01530                                                                 processEmitConsistent(emitterPositions[k],
+01531                                                                                                           emitterIndex,
+01532                                                                                                           nbToGenerate,
+01533                                                                                                           deltaT,
+01534                                                                                                           ellapsedTime,
+01535                                                                                                           realEllapsedTimeRatio);
+01536                                                                 deltaT += *currEmitPeriod;                                                              
+01537                                                         }
+01538                                                         while (k);                                                                                                                                      
+01539                                                 }
+01540                                                 else
+01541                                                 {
+01542                                                         const uint32 emitterIndex = phaseIt - (_Phase.begin());
+01543                                                         nbToGenerate = _GenNbScheme ? _GenNbScheme->get(_Owner, emitterIndex) : _GenNb;
+01544                                                         processEmit(emitterIndex, nbToGenerate);
+01545                                                 }
+01546                                         }       
+01547                                         
+01548                                         ++phaseIt;                                      
+01549                                         currEmitPeriod += currEmitPeriodPtrInc;
+01550                                 }
+01551                                 while (phaseIt != endPhaseIt);
+01552                         }
+01553                         else // thhere's an emission delay
+01554                         {
+01555                                 do                      
+01556                                 {
+01557                                         *phaseIt += ellapsedTime;
+01558                                         if ( *phaseIt >= *currEmitPeriod + _EmitDelay) // phase is greater than period -> must emit
+01559                                         {                                               
+01560                                                 if (*currEmitPeriod != 0)
+01561                                                 {               
+01564                                                         *phaseIt = std::min(*phaseIt, *currEmitPeriod + ellapsedTime + _EmitDelay);
+01565                                                         //
+01566                                                         uint numEmissions = (uint) ::floorf((*phaseIt - _EmitDelay) / *currEmitPeriod);
+01567                                                         *phaseIt -= *currEmitPeriod * numEmissions;
+01568                                                         float deltaT = std::max(*phaseIt - _EmitDelay, 0.f);
+01569                                                         //nlassert(deltaT >= 0.f);
+01570 
+01571                                                         uint emitterIndex = phaseIt - _Phase.begin();
+01573                                                         numEmissions = GenEmitterPositions(_Owner,
+01574                                                                                         _EmittedType,
+01575                                                                                                 emitterIndex,
+01576                                                                                 numEmissions,
+01577                                                                                                 deltaT,
+01578                                                                                             *currEmitPeriod,
+01579                                                                                             emitterPositions
+01580                                                                                            );
+01582                                                         nbToGenerate = _GenNbScheme ? _GenNbScheme->get(_Owner, emitterIndex) : _GenNb;                                                 
+01583                                                         uint k = numEmissions;                                                  
+01584                                                         do
+01585                                                         {       
+01586                                                                 --k;
+01587                                                                 processEmitConsistent(emitterPositions[k],
+01588                                                                                                           emitterIndex,
+01589                                                                                                           nbToGenerate,
+01590                                                                                                           deltaT,
+01591                                                                                                           ellapsedTime,
+01592                                                                                                           realEllapsedTimeRatio);
+01593                                                                 deltaT += *currEmitPeriod;                                                              
+01594                                                         }
+01595                                                         while (k);                                                                                                      
+01596                                                 }
+01597                                                 else
+01598                                                 {               
+01599                                                         const uint32 emitterIndex = phaseIt - (_Phase.begin());
+01600                                                         nbToGenerate = _GenNbScheme ? _GenNbScheme->get(_Owner, emitterIndex) : _GenNb;
+01601                                                         processEmit(emitterIndex, nbToGenerate);                                                        
+01602                                                 }                                                                       
+01603                                         }       
+01604                                         
+01605                                         ++phaseIt;                                      
+01606                                         currEmitPeriod += currEmitPeriodPtrInc;
+01607                                 }
+01608                                 while (phaseIt != endPhaseIt);
+01609                         }
+01610                 }
+01611                 else // there's an emission count limit
+01612                 {
+01614                         if (_EmitDelay == 0.f) // no emission delay
+01615                         {
+01616                                 do                      
+01617                                 {
+01618                                         if (*numEmitIt < _MaxEmissionCount)
+01619                                         {
+01620                                                 *phaseIt += ellapsedTime;
+01621                                                 if ( *phaseIt >= *currEmitPeriod) // phase is greater than period -> must emit
+01622                                                 {
+01623                                                         if (*currEmitPeriod != 0)
+01624                                                         {
+01627                                                                 *phaseIt = std::min(*phaseIt, *currEmitPeriod + ellapsedTime);
+01628                                                                 //
+01629                                                                 uint numEmissions = (uint) ::floorf(*phaseIt / *currEmitPeriod);
+01630                                                                 *numEmitIt +=  numEmissions;                                                            
+01631                                                                 *phaseIt -= *currEmitPeriod * numEmissions;
+01632                                                                 float deltaT = std::max(*phaseIt, 0.f);
+01633                                                                 //nlassert(deltaT >= 0.f);
+01634                                                                 uint emitterIndex = phaseIt - _Phase.begin();
+01635                                                                 if (*numEmitIt > _MaxEmissionCount) // make sure we don't go over the emission limit
+01636                                                                 {
+01637                                                                         numEmissions -= *numEmitIt - _MaxEmissionCount;
+01638                                                                         *numEmitIt = _MaxEmissionCount;
+01639                                                                 }
+01641                                                                 numEmissions = GenEmitterPositions(_Owner,
+01642                                                                                                         _EmittedType,
+01643                                                                                                         emitterIndex,
+01644                                                                                                         numEmissions,
+01645                                                                                                         deltaT,
+01646                                                                                                         *currEmitPeriod,
+01647                                                                                                         emitterPositions
+01648                                                                                                    );
+01649                                                                 uint k = numEmissions;                                                          
+01651                                                                 nbToGenerate = _GenNbScheme ? _GenNbScheme->get(_Owner, emitterIndex) : _GenNb;                                                         
+01652                                                                 do
+01653                                                                 {
+01654                                                                         --k;
+01655                                                                         processEmitConsistent(emitterPositions[k],
+01656                                                                                                                   emitterIndex,
+01657                                                                                                                   nbToGenerate,
+01658                                                                                                                   deltaT,
+01659                                                                                                                   ellapsedTime,
+01660                                                                                                                   realEllapsedTimeRatio);
+01661                                                                         deltaT += *currEmitPeriod;                                                                      
+01662                                                                 }
+01663                                                                 while (k);                                                                                                              
+01664                                                         }
+01665                                                         else
+01666                                                         {
+01667                                                                 const uint32 emitterIndex = phaseIt - _Phase.begin();
+01668                                                                 nbToGenerate = _GenNbScheme ? _GenNbScheme->get(_Owner, emitterIndex) : _GenNb;
+01669                                                                 processEmit(emitterIndex, nbToGenerate);                                                                
+01670                                                                 ++*numEmitIt;
+01671                                                         }
+01672                                                 }       
+01673                                         }       
+01674                                         ++phaseIt;                                      
+01675                                         currEmitPeriod += currEmitPeriodPtrInc;                                                 
+01676                                         ++ numEmitIt;
+01677                                 }
+01678                                 while (phaseIt != endPhaseIt);
+01679                         }
+01680                         else // there's an emission delay
+01681                         {
+01682                                 do                      
+01683                                 {
+01684                                         if (*numEmitIt < _MaxEmissionCount)
+01685                                         {
+01686                                                 *phaseIt += ellapsedTime;
+01687                                                 if ( *phaseIt >= *currEmitPeriod + _EmitDelay) // phase is greater than period -> must emit
+01688                                                 {                                                       
+01689                                                         if (*currEmitPeriod != 0)
+01690                                                         {               
+01693                                                                 *phaseIt = std::min(*phaseIt, *currEmitPeriod + ellapsedTime + _EmitDelay);
+01694                                                                 //
+01695                                                                 uint numEmissions = (uint) ::floorf((*phaseIt - _EmitDelay) / *currEmitPeriod);
+01696                                                                 *numEmitIt +=  numEmissions;                                                            
+01697                                                                 *phaseIt -= *currEmitPeriod * numEmissions;
+01698                                                                 float deltaT = std::max(*phaseIt - _EmitDelay, 0.f);
+01699                                                                 //nlassert(deltaT >= 0.f);
+01700                                                                 uint emitterIndex = phaseIt - _Phase.begin();
+01701                                                                 if (*numEmitIt > _MaxEmissionCount) // make sure we don't go over the emission limit
+01702                                                                 {
+01703                                                                         numEmissions -= *numEmitIt - _MaxEmissionCount;
+01704                                                                         *numEmitIt = _MaxEmissionCount;
+01705                                                                 }
+01707                                                                 numEmissions = GenEmitterPositions(_Owner,
+01708                                                                                                                                         _EmittedType,
+01709                                                                                                                                         emitterIndex,
+01710                                                                                                                                         numEmissions,
+01711                                                                                                                                         deltaT,
+01712                                                                                                                                         *currEmitPeriod,
+01713                                                                                                                                         emitterPositions
+01714                                                                                                                                    );
+01715                                                                 uint k = numEmissions;                                                          
+01717                                                                 nbToGenerate = _GenNbScheme ? _GenNbScheme->get(_Owner, emitterIndex) : _GenNb;                                                         
+01718                                                                 do
+01719                                                                 {       
+01720                                                                         --k;
+01721                                                                         processEmitConsistent(emitterPositions[k],
+01722                                                                                                                   emitterIndex,
+01723                                                                                                                   nbToGenerate,
+01724                                                                                                                   deltaT,
+01725                                                                                                                   ellapsedTime,
+01726                                                                                                                   realEllapsedTimeRatio);
+01727                                                                         deltaT += *currEmitPeriod;                                                                      
+01728                                                                 }
+01729                                                                 while (k);                                                              
+01730                                                         }
+01731                                                         else
+01732                                                         {
+01733                                                                 const uint32 emitterIndex = phaseIt - (_Phase.begin());
+01734                                                                 nbToGenerate = _GenNbScheme ? _GenNbScheme->get(_Owner, emitterIndex) : _GenNb;
+01735                                                                 processEmit(emitterIndex, nbToGenerate);                                                                
+01736                                                                 ++*numEmitIt;
+01737                                                         }
+01738                                                 }
+01739                                         }                                                       
+01740                                         ++phaseIt;                                      
+01741                                         currEmitPeriod += currEmitPeriodPtrInc;
+01742                                         ++numEmitIt;
+01743                                 }
+01744                                 while (phaseIt != endPhaseIt);
+01745                         }
+01746                 }
+01747 
+01748                 leftToDo -= toProcess;
+01749         }
+01750         while (leftToDo);
+01751 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CPSEmitter::processRegularEmissionWithNoLOD TAnimationTime  ellapsedTime  )  [protected]
+
+ + + + + +
+   + + +

+========================================================================== +

+is there an emission delay ?

+is there an emission delay ? +

+Test if 'make' filled our buffer. If this is not the case, we assume that values where precomputed, and that all null period have already been replaced by the threshold +

+Definition at line 500 of file ps_emitter.cpp. +

+References _EmitDelay, _GenNb, _GenNbScheme, _MaxEmissionCount, _NumEmission, _Period, _PeriodScheme, _Phase, NL3D::CPSAttrib< T >::begin(), NL3D::CPSAttrib< float >::begin(), NL3D::EMIT_PERIOD_THRESHOLD, NL3D::EMITTER_BUFF_SIZE, NL3D::CPSAttribMaker< uint32 >::get(), NL3D::CPSAttribMaker< float >::getMaxValue(), NL3D::CPSAttribMaker< float >::getMinValue(), NL3D::CParticleSystemProcess::getOwner(), NL3D::CPSLocated::getSize(), NL3D::CParticleSystem::isEmitThresholdEnabled(), NL3D::CPSAttribMaker< float >::make(), nlassert, processEmit(), NL3D::replaceNullPeriodsByThreshold(), sint32, size, NL3D::TAnimationTime, uint, and uint32. +

+Referenced by step(). +

+

00501 {
+00502         nlassert(_Owner);
+00503         nlassert(_Owner->getOwner());
+00504         //
+00505         const bool emitThreshold = _Owner->getOwner()->isEmitThresholdEnabled();
+00506         //
+00507         const uint size = _Owner->getSize();
+00508         uint leftToDo = size, toProcess;
+00509         float emitPeriod[EMITTER_BUFF_SIZE]; 
+00510         const float *currEmitPeriod;
+00511         uint currEmitPeriodPtrInc = _PeriodScheme ? 1 : 0;                      
+00512         sint32 nbToGenerate;
+00513 
+00514         TPSAttribTime::iterator phaseIt = _Phase.begin(), endPhaseIt; 
+00515         TPSAttribUInt8::iterator numEmitIt = _NumEmission.begin(); 
+00516 
+00517         // we don't use an iterator here
+00518         // because it could be invalidated if size change (a located could generate itself)     
+00519         do
+00520         {
+00521                 toProcess = leftToDo < EMITTER_BUFF_SIZE ? leftToDo : EMITTER_BUFF_SIZE;
+00522 
+00523 
+00524                 if (_PeriodScheme)
+00525                 {
+00526                         currEmitPeriod = (float *) (_PeriodScheme->make(_Owner, size - leftToDo, emitPeriod, sizeof(float), toProcess, true));                          
+00527                         if (emitThreshold)
+00528                         {
+00529                                 
+00533                                 if (currEmitPeriod == emitPeriod) 
+00534                                 {
+00535                                         // if there possibility to have 0 in the scheme ?
+00536                                         if (_PeriodScheme->getMinValue() <= 0.f && _PeriodScheme->getMaxValue() >= 0.f)
+00537                                         {                                                                                       
+00538                                                 replaceNullPeriodsByThreshold(emitPeriod, toProcess);
+00539                                         }
+00540                                 }                               
+00541                         }
+00542                 }
+00543                 else
+00544                 {
+00545                         if (_Period != 0.f || !emitThreshold)
+00546                         {                       
+00547                                 currEmitPeriod = &_Period;
+00548                         }
+00549                         else
+00550                         {
+00551                                 currEmitPeriod = &EMIT_PERIOD_THRESHOLD;
+00552                         }
+00553                 }
+00554 
+00555                 endPhaseIt = phaseIt + toProcess;
+00556 
+00557                 if (_MaxEmissionCount == 0) // no emission count limit
+00558                 {
+00560                         if (_EmitDelay == 0.f) // no emission delay
+00561                         {
+00562                                 do                      
+00563                                 {
+00564                                         *phaseIt += ellapsedTime;
+00565                                         if ( *phaseIt >= *currEmitPeriod) // phase is greater than period -> must emit
+00566                                         {                                       
+00567                                                 if (*currEmitPeriod != 0)
+00568                                                 {
+00569                                                         *phaseIt -= ::floorf(*phaseIt / *currEmitPeriod) * *currEmitPeriod;
+00570                                                 }
+00571                                                 const uint32 k = phaseIt - (_Phase.begin());
+00572                                                 nbToGenerate = _GenNbScheme ? _GenNbScheme->get(_Owner, k) : _GenNb;                                    
+00573                                                 processEmit(k, nbToGenerate);                                                                           
+00574                                         }       
+00575                                         
+00576                                         ++phaseIt;
+00577                                         currEmitPeriod += currEmitPeriodPtrInc;
+00578                                 }
+00579                                 while (phaseIt != endPhaseIt);
+00580                         }
+00581                         else // there's an emission delay
+00582                         {
+00583                                 do                      
+00584                                 {
+00585                                         *phaseIt += ellapsedTime;
+00586                                         if ( *phaseIt >= *currEmitPeriod + _EmitDelay) // phase is greater than period -> must emit
+00587                                         {
+00588                                                 if (*currEmitPeriod != 0)
+00589                                                 {
+00590                                                         *phaseIt -= ::floorf((*phaseIt - _EmitDelay)  / *currEmitPeriod) * *currEmitPeriod;
+00591                                                 }
+00592                                                 const uint32 k = phaseIt - (_Phase.begin());
+00593                                                 nbToGenerate = _GenNbScheme ? _GenNbScheme->get(_Owner, k) : _GenNb;                                    
+00594                                                 processEmit(k, nbToGenerate);                                                                           
+00595                                         }       
+00596                                         
+00597                                         ++phaseIt;
+00598                                         currEmitPeriod += currEmitPeriodPtrInc;
+00599                                 }
+00600                                 while (phaseIt != endPhaseIt);
+00601                         }
+00602                 }
+00603                 else // there's an emission count limit
+00604                 {
+00606                         if (_EmitDelay == 0.f) // no emission delay
+00607                         {
+00608                                 do                      
+00609                                 {
+00610                                         if (*numEmitIt < _MaxEmissionCount)
+00611                                         {
+00612                                                 *phaseIt += ellapsedTime;
+00613                                                 if ( *phaseIt >= *currEmitPeriod) // phase is greater than period -> must emit
+00614                                                 {
+00615                                                         if (*currEmitPeriod != 0)
+00616                                                         {
+00617                                                                 *phaseIt -= ::floorf(*phaseIt / *currEmitPeriod) * *currEmitPeriod;
+00618                                                         }
+00619                                                         const uint32 k = phaseIt - (_Phase.begin());
+00620                                                         nbToGenerate = _GenNbScheme ? _GenNbScheme->get(_Owner, k) : _GenNb;                                    
+00621                                                         processEmit(k, nbToGenerate);
+00622                                                         ++*numEmitIt;
+00623                                                 }       
+00624                                         }       
+00625                                         ++phaseIt;
+00626                                         currEmitPeriod += currEmitPeriodPtrInc;                                                 
+00627                                         ++ numEmitIt;
+00628                                 }
+00629                                 while (phaseIt != endPhaseIt);
+00630                         }
+00631                         else // there's an emission delay
+00632                         {
+00633                                 do                      
+00634                                 {
+00635                                         if (*numEmitIt < _MaxEmissionCount)
+00636                                         {
+00637                                                 *phaseIt += ellapsedTime;
+00638                                                 if ( *phaseIt >= *currEmitPeriod + _EmitDelay) // phase is greater than period -> must emit
+00639                                                 {
+00640                                                         if (*currEmitPeriod != 0)
+00641                                                         {
+00642                                                                 *phaseIt -= ::floorf((*phaseIt - _EmitDelay) / *currEmitPeriod) * *currEmitPeriod;
+00643                                                         }
+00644                                                         const uint32 k = phaseIt - (_Phase.begin());
+00645                                                         nbToGenerate = _GenNbScheme ? _GenNbScheme->get(_Owner, k) : _GenNb;                                    
+00646                                                         processEmit(k, nbToGenerate);
+00647                                                         ++*numEmitIt;
+00648                                                 }
+00649                                         }                                                       
+00650                                         ++phaseIt;
+00651                                         currEmitPeriod += currEmitPeriodPtrInc;
+00652                                         ++numEmitIt;
+00653                                 }
+00654                                 while (phaseIt != endPhaseIt);
+00655                         }
+00656                 }
+00657 
+00658                 leftToDo -= toProcess;
+00659         }
+00660         while (leftToDo);
+00661 }
+
+

+ + + + +
+ + + + + + + + + +
void NL3D::CPSEmitter::releaseAllRef  )  [virtual]
+
+ + + + + +
+   + + +

+Release any reference this obj may have to other process of the system For example, this is used when detaching a located bindable from a system. +

+Reimplemented from NL3D::CPSLocatedBindable. +

+Definition at line 104 of file ps_emitter.cpp. +

+References setEmittedType(). +

+

00105 {
+00106         setEmittedType(NULL);
+00107 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CPSEmitter::releaseRefTo const CParticleSystemProcess other  )  [virtual]
+
+ + + + + +
+   + + +

+========================================================================== +

+Release any reference this obj may have on the given process. For example, this is used when detaching a located bindable from a system. +

+Reimplemented from NL3D::CPSLocatedBindable. +

+Definition at line 96 of file ps_emitter.cpp. +

+References _EmittedType, and setEmittedType(). +

+

00097 {
+00098         if (_EmittedType == other)
+00099         {
+00100                 setEmittedType(NULL);
+00101         }
+00102 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CPSEmitter::resize uint32  size  )  [protected, virtual]
+
+ + + + + +
+   + + +

+========================================================================== +

+Resize the bindable attributes containers. DERIVERS SHOULD CALL THEIR PARENT VERSION should not be called directly. Call CPSLocated::resize instead +

+Implements NL3D::CPSLocatedBindable. +

+Reimplemented in NL3D::CPSEmitterDirectionnal, NL3D::CPSEmitterOmni, NL3D::CPSEmitterRectangle, and NL3D::CPSSphericalEmitter. +

+Definition at line 1895 of file ps_emitter.cpp. +

+References _GenNbScheme, _MaxEmissionCount, _NumEmission, _PeriodScheme, _Phase, NL3D::CPSLocated::getSize(), NL3D::CPSAttribMaker< uint32 >::hasMemory(), NL3D::CPSAttribMaker< float >::hasMemory(), nlassert, NL3D::CPSAttrib< T >::resize(), NL3D::CPSAttrib< float >::resize(), NL3D::CPSAttribMaker< uint32 >::resize(), NL3D::CPSAttribMaker< float >::resize(), size, and uint32. +

+

01896 {
+01897         nlassert(size < (1 << 16));
+01898         if (_PeriodScheme && _PeriodScheme->hasMemory()) _PeriodScheme->resize(size, _Owner->getSize());
+01899         if (_GenNbScheme && _GenNbScheme->hasMemory()) _GenNbScheme->resize(size, _Owner->getSize());
+01900         _Phase.resize(size);
+01901         if (_MaxEmissionCount != 0)
+01902         {
+01903                 _NumEmission.resize(size);
+01904         }
+01905 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CPSEmitter::serial NLMISC::IStream f  )  throw (NLMISC::EStream) [virtual]
+
+ + + + + +
+   + + +

+========================================================================== +

+version 6 : the flag _EmitDirBasis no longer exist, it has been replaced by _UserMatrixModeForEmissionDirection +

+version 5 : added _BypassAutoLOD version 4 : added consistent emissions +

+Reimplemented from NL3D::CPSLocatedBindable. +

+Reimplemented in NL3D::CPSEmitterDirectionnal, NL3D::CPSRadialEmitter, NL3D::CPSEmitterOmni, NL3D::CPSEmitterRectangle, NL3D::CPSEmitterConic, and NL3D::CPSSphericalEmitter. +

+Definition at line 1919 of file ps_emitter.cpp. +

+References nlassert, NL3D::PSFXWorldMatrix, NL3D::PSIdentityMatrix, and sint. +

+

01920 {
+01922         //               
+01925         sint ver = f.serialVersion(6);  
+01926         CPSLocatedBindable::serial(f);
+01927         
+01928         f.serialPolyPtr(_EmittedType);
+01929         f.serial(_Phase);
+01930         f.serial(_SpeedInheritanceFactor);
+01931 
+01932         bool speedBasisEmission = _SpeedBasisEmission; // tmp copy because of bitfield serialization scheme
+01933         f.serial(speedBasisEmission);
+01934         _SpeedBasisEmission = speedBasisEmission;
+01935         
+01936         f.serialEnum(_EmissionType);
+01937 
+01938         // this is for use with serial
+01939         bool trueB = true, falseB = false;
+01940 
+01941         if (!f.isReading())
+01942         {
+01943                 switch (_EmissionType)
+01944                 {
+01945                         case CPSEmitter::regular:                       
+01946                                 if (_PeriodScheme)
+01947                                 {
+01948                                         f.serial(trueB);
+01949                                         f.serialPolyPtr(_PeriodScheme);
+01950                                 }
+01951                                 else
+01952                                 {
+01953                                          f.serial(falseB);
+01954                                          f.serial(_Period);
+01955                                 }
+01956                                 if (ver >= 3)
+01957                                 {
+01958                                         f.serial(_EmitDelay, _MaxEmissionCount);                                                                                                        
+01959                                 }
+01960                         break;
+01961                         default:
+01962                         break;
+01963                 }
+01964                 if (_GenNbScheme)
+01965                 {
+01966                         f.serial(trueB);
+01967                         f.serialPolyPtr(_GenNbScheme);
+01968                 }
+01969                 else
+01970                 {
+01971                          f.serial(falseB);
+01972                          f.serial(_GenNb);
+01973                 }
+01974         }
+01975         else
+01976         {
+01977                 bool useScheme;
+01978                 switch (_EmissionType)
+01979                 {
+01980                         case CPSEmitter::regular:
+01981                         {                               
+01982                                 f.serial(useScheme);
+01983                                 if (useScheme)
+01984                                 {
+01985                                         delete _PeriodScheme;                                   
+01986                                         f.serialPolyPtr(_PeriodScheme);
+01987                                 }
+01988                                 else
+01989                                 {                                        
+01990                                          f.serial(_Period);
+01991                                 }
+01992                                 if (ver >= 3)
+01993                                 {
+01994                                         f.serial(_EmitDelay, _MaxEmissionCount);
+01995                                         updateMaxCountVect();
+01996                                 }                               
+01997                         }
+01998                         break;
+01999                         default:
+02000                         break;
+02001                 }
+02002 
+02003                 f.serial(useScheme); 
+02004                 if (useScheme)
+02005                 {
+02006                         delete _GenNbScheme;
+02007                         f.serialPolyPtr(_GenNbScheme);
+02008                 }
+02009                 else
+02010                 {                               
+02011                          f.serial(_GenNb);
+02012                 }
+02013         }
+02014         if (ver > 1 && ver < 6)
+02015         {
+02016                 nlassert(f.isReading());
+02017                 bool emitDirBasis;
+02018                 f.serial(emitDirBasis);
+02019                 if (emitDirBasis)
+02020                 {
+02021                         _UserMatrixModeForEmissionDirection = false;
+02022                         _UserDirectionMatrixMode = PSFXWorldMatrix;
+02023                 }
+02024                 else
+02025                 {
+02026                         _UserMatrixModeForEmissionDirection = true;
+02027                         if (_Owner)
+02028                         {
+02029                                 _UserDirectionMatrixMode = _Owner->getMatrixMode() == PSFXWorldMatrix ? PSIdentityMatrix : PSFXWorldMatrix;
+02030                         }
+02031                         else
+02032                         {
+02033                                 _UserDirectionMatrixMode = PSFXWorldMatrix;
+02034                         }
+02035                 }
+02036         }
+02037         if (ver >= 4)
+02038         {
+02039                 bool consistentEmission = _ConsistentEmission; // tmp copy because of bitfield serialization scheme
+02040                 f.serial(consistentEmission);
+02041                 _ConsistentEmission = consistentEmission;
+02042         }
+02043         if (ver >= 5)
+02044         {
+02045                 bool byassAutoLOD = _BypassAutoLOD; // tmp copy because of bitfield serialization scheme
+02046                 f.serial(byassAutoLOD);
+02047                 _BypassAutoLOD = byassAutoLOD;
+02048         }
+02049         if (ver >= 6)
+02050         {
+02051                 bool userMatrixModeForEmissionDirection = _UserMatrixModeForEmissionDirection; // tmp copy because of bitfield serialization scheme
+02052                 f.serial(userMatrixModeForEmissionDirection);
+02053                 _UserMatrixModeForEmissionDirection = userMatrixModeForEmissionDirection;
+02054                 f.serialEnum(_UserDirectionMatrixMode);
+02055         }
+02056 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CPSLocatedBindable::setActive bool  active  )  [inline, inherited]
+
+ + + + + +
+   + + +

+Activate / Deactivate this object. When not active, the owning system won't try to call the 'step' method. +

+ +

+Definition at line 843 of file ps_located.h. +

+References NL3D::CPSLocatedBindable::_Active. +

+Referenced by NL3D::CParticleSystem::activateEmitters(), and NL3D::CParticleSystemInstanceUser::setActive(). +

+

00843 { _Active = active; }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CPSEmitter::setBypassAutoLOD bool  bypass  )  [inline]
+
+ + + + + +
+   + + +

+ +

+Definition at line 251 of file ps_emitter.h. +

+References _BypassAutoLOD. +

+

00251 { _BypassAutoLOD = bypass; }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CPSEmitter::setBypassEmitOnDeath bool  bypass  )  [inline, static]
+
+ + + + + +
+   + + +

+For edition only : avoid that a call to CPSLocated::deleteElement() causes emitters flagged with 'emitOnDeath' to emit +

+Definition at line 256 of file ps_emitter.h. +

+References _BypassEmitOnDeath. +

+

00256 { _BypassEmitOnDeath = bypass; }        
+
+

+ + + + +
+ + + + + + + + + + +
bool NL3D::CPSEmitter::setEmissionType TEmissionType  freqType  ) 
+
+ + + + + +
+   + + +

+========================================================================== +

+Set the frequency type. Please note that if the type is externEmit, this located need to have been attached to the system (the system is holding the ID-Located map)

Returns:
true if the operation could be performed. It can fail when this cause the system the system to last forever, which is incompatible with the 'BypassMaxNumIntegrationSteps' in CParticleSystem
+ +

+Definition at line 326 of file ps_emitter.cpp. +

+References _EmissionType, NL3D::CParticleSystem::getBypassMaxNumIntegrationSteps(), NL3D::CParticleSystemProcess::getOwner(), nlassert, nlwarning, NL3D::CParticleSystem::systemDurationChanged(), TEmissionType, testEmitForever(), and NLMISC::toString(). +

+

00327 { 
+00328         if (_Owner && _Owner->getOwner())
+00329         {
+00330                 CParticleSystem *ps = _Owner->getOwner();
+00331                 if (ps->getBypassMaxNumIntegrationSteps())
+00332                 {
+00333                         if (!_Owner)
+00334                         {
+00335                                 nlwarning("<CPSEmitter::setEmissionType> The emitter should be inserted in a CPSLocated instance");
+00336                                 nlassert(0);
+00337                         }
+00338                         // check if the new value is valid
+00339                         TEmissionType oldType = _EmissionType;
+00340                         _EmissionType = freqType;
+00341                         if (testEmitForever() == true)
+00342                         {
+00343                                 _EmissionType = oldType;
+00344                                 std::string mess = "<CPSEmitter::setEmissionType> can't set emission type to '" + 
+00345                                                        NLMISC::toString(freqType) +
+00346                                                                   "' with the current configuration : the system has been flagged with \
+00347                                                                    'BypassMaxNumIntegrationSteps', and should have a finite duration.  \
+00348                                                                    The flag is not set";
+00349                                 nlwarning(mess.c_str());
+00350                                 return false;
+00351 
+00352                         }                       
+00353                 }
+00354                 ps->systemDurationChanged();
+00355         }
+00356         _EmissionType = freqType; 
+00357         return true;
+00358 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CPSEmitter::setEmitDelay float  delay  ) 
+
+ + + + + +
+   + + +

+========================================================================== +

+ +

+Definition at line 2080 of file ps_emitter.cpp. +

+References _EmitDelay, NL3D::CParticleSystemProcess::getOwner(), and NL3D::CParticleSystem::systemDurationChanged(). +

+

02081 {
+02082         _EmitDelay = delay;
+02083         if (_Owner && _Owner->getOwner())
+02084         {
+02085                 _Owner->getOwner()->systemDurationChanged();
+02086         }
+02087 }
+
+

+ + + + +
+ + + + + + + + + + +
bool NL3D::CPSEmitter::setEmittedType CPSLocated et  ) 
+
+ + + + + +
+   + + +

+========================================================================== +

+Set the type of located to be emitted. The default is NULL which mean that no emission will occur

Returns:
true if the operation could be performed. It can fail when this cause the system the system to last forever, which is incompatible with the 'BypassMaxNumIntegrationSteps' in CParticleSystem
+ +

+Definition at line 361 of file ps_emitter.cpp. +

+References _EmittedType, NL3D::CParticleSystem::canFinish(), NL3D::CParticleSystem::getBypassMaxNumIntegrationSteps(), NL3D::CParticleSystemProcess::getOwner(), nlwarning, NL3D::CPSLocated::registerDtorObserver(), NL3D::CParticleSystem::systemDurationChanged(), and NL3D::CPSLocated::unregisterDtorObserver(). +

+Referenced by notifyTargetRemoved(), releaseAllRef(), and releaseRefTo(). +

+

00362 {       
+00363         if (_EmittedType)
+00364         {
+00365                 _EmittedType->unregisterDtorObserver(this);             
+00366         }
+00367         if (et)
+00368         {
+00369                 et->registerDtorObserver(this);
+00370         }       
+00371         CPSLocated *oldType = _EmittedType;
+00372         _EmittedType = et;
+00373         if (_Owner && _Owner->getOwner())
+00374         {
+00375                 CParticleSystem *ps = _Owner->getOwner();
+00376                 if (_EmittedType)
+00377                 {               
+00378                         if (ps->getBypassMaxNumIntegrationSteps())
+00379                         {
+00380                                 if (!ps->canFinish())
+00381                                 {
+00382                                         setEmittedType(oldType);
+00383                                         nlwarning("<CPSLocated::setEmittedType> Can't set new emitted type : this causes the system to last forever, and it has been flagged with 'BypassMaxNumIntegrationSteps'. New emitted type is not set");
+00384                                         return false;
+00385                                 }
+00386                         }
+00387                 }
+00388                 ps->systemDurationChanged();
+00389         }
+00390         return true;
+00391 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CPSLocatedBindable::setExternID uint32  id  )  [inherited]
+
+ + + + + +
+   + + +

+*************************************************************************************** +

+set the extern ID of this located bindable. 0 means no extern access. The map of ID-locatedBindable. Is in th particle system, so this located bindable must have been attached to a particle system, otherwise an assertion is raised +

+Definition at line 2149 of file ps_located.cpp. +

+References NL3D::CPSLocatedBindable::_ExternID, NL3D::CParticleSystemProcess::getOwner(), NL3D::CParticleSystem::registerLocatedBindableExternID(), uint32, and NL3D::CParticleSystem::unregisterLocatedBindableExternID(). +

+

02150 {
+02151         if (id == _ExternID) return;
+02152         CParticleSystem *ps = NULL;
+02153         if (_Owner && _Owner->getOwner())
+02154         {
+02155                 ps = _Owner->getOwner();
+02156         }       
+02157         if (ps) 
+02158         {
+02159                 ps->unregisterLocatedBindableExternID(this);
+02160                 _ExternID = 0;          
+02161         }
+02162         if (id != 0)
+02163         {       
+02164                 if (ps) ps->registerLocatedBindableExternID(id, this);
+02165                 _ExternID = id;
+02166         }       
+02167 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CPSEmitter::setGenNb uint32  GenNb  ) 
+
+ + + + + +
+   + + +

+========================================================================== +

+Set a constant number of particle to be generated at once any previous scheme is discarded +

+Definition at line 428 of file ps_emitter.cpp. +

+References _GenNb, _GenNbScheme, and uint32. +

+

00429 {
+00430         if (_GenNbScheme)
+00431         {
+00432                 delete _GenNbScheme;
+00433                 _GenNbScheme = NULL;
+00434         }
+00435         _GenNb = genNb; 
+00436 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CPSEmitter::setGenNbScheme CPSAttribMaker< uint32 > *  scheme  ) 
+
+ + + + + +
+   + + +

+========================================================================== +

+ +

+Definition at line 439 of file ps_emitter.cpp. +

+References _GenNbScheme, NL3D::CPSLocated::getMaxSize(), NL3D::CPSLocated::getSize(), and NL3D::CPSAttribMaker< T >::resize(). +

+

00440 {
+00441         delete _GenNbScheme;    
+00442         _GenNbScheme = scheme;
+00443         if (_Owner && scheme->hasMemory()) scheme->resize(_Owner->getMaxSize(), _Owner->getSize());
+00444 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CPSLocatedBindable::setLOD TPSLod  lod  )  [inline, inherited]
+
+ + + + + +
+   + + +

+set the LODs that apply to that object (warning : it is based on the position of the system, and don't act on a per instance basis ...) To have per instance precision, you must use an attribute maker that has LOD as its input +

+Definition at line 952 of file ps_located.h. +

+References NL3D::CPSLocatedBindable::_LOD. +

+

00952 { _LOD = lod; }
+
+

+ + + + +
+ + + + + + + + + + +
bool NL3D::CPSEmitter::setMaxEmissionCount uint8  count  ) 
+
+ + + + + +
+   + + +

+========================================================================== +

+Set a max. number of particle emission (0 means no limit and is the default). Applies with regular emitter only. NB : the emitter should be inserted in a system for this call to work

Returns:
true if the operation could be performed. It can fail when this cause the system the system to last forever, which is incompatible with the 'BypassMaxNumIntegrationSteps' in CParticleSystem
+ +

+Definition at line 2090 of file ps_emitter.cpp. +

+References _MaxEmissionCount, count, NL3D::CParticleSystem::getBypassMaxNumIntegrationSteps(), NL3D::CParticleSystemProcess::getOwner(), nlassert, nlwarning, NL3D::CParticleSystem::systemDurationChanged(), testEmitForever(), uint8, and updateMaxCountVect(). +

+

02091 {
+02092         if (count == _MaxEmissionCount) return true;    
+02093         nlassert(_Owner && _Owner->getOwner());
+02094         CParticleSystem *ps = _Owner->getOwner();
+02095         if (ps->getBypassMaxNumIntegrationSteps())
+02096         {
+02097                 uint8 oldEmissiontCount = _MaxEmissionCount;
+02098                 // should check that the new value is valid
+02099                 _MaxEmissionCount = count;
+02100                 if (testEmitForever())
+02101                 {
+02102                         _MaxEmissionCount = oldEmissiontCount;
+02103                         nlwarning("<CPSEmitter::setMaxEmissionCount> can't set max emission count to %d  \
+02104                                            with the current configuration : the system has been flagged with     \
+02105                                            'BypassMaxNumIntegrationSteps', and should have a finite duration.    \
+02106                                            The new value is not set", (int) count);             
+02107                         return false;
+02108                 }
+02109         }
+02110         ps->systemDurationChanged();
+02111         _MaxEmissionCount = count;
+02112         updateMaxCountVect();
+02113         return true;
+02114 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CPSLocatedBindable::setName const std::string &  name  )  [inline, inherited]
+
+ + + + + +
+   + + +

+set the located bindable name (edition purpose) +

+ +

+Definition at line 946 of file ps_located.h. +

+

00946 { _Name = name; }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CPSEmitter::setOwner CPSLocated psl  )  [virtual]
+
+ + + + + +
+   + + +

+========================================================================== +

+ +

+Reimplemented from NL3D::CPSLocatedBindable. +

+Definition at line 111 of file ps_emitter.cpp. +

+References updateMaxCountVect(). +

+

00112 {
+00113         CPSLocatedBindable::setOwner(psl);
+00114         updateMaxCountVect();
+00115 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CPSEmitter::setPeriod float  period  ) 
+
+ + + + + +
+   + + +

+========================================================================== +

+Set a constant period for emission (expressed in second) any previous period scheme is discarded +

+Definition at line 401 of file ps_emitter.cpp. +

+References _Period, _PeriodScheme, NL3D::CParticleSystemProcess::getOwner(), and NL3D::CParticleSystem::systemDurationChanged(). +

+

00402 {
+00403         if (_PeriodScheme)
+00404         {
+00405                 delete _PeriodScheme;
+00406                 _PeriodScheme = NULL;
+00407         }
+00408         _Period = period;
+00409         if (_Owner && _Owner->getOwner())
+00410         {
+00411                 _Owner->getOwner()->systemDurationChanged();
+00412         }
+00413 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CPSEmitter::setPeriodScheme CPSAttribMaker< float > *  scheme  ) 
+
+ + + + + +
+   + + +

+========================================================================== +

+ +

+Definition at line 416 of file ps_emitter.cpp. +

+References _PeriodScheme, NL3D::CPSLocated::getMaxSize(), NL3D::CParticleSystemProcess::getOwner(), NL3D::CPSLocated::getSize(), NL3D::CPSAttribMaker< T >::resize(), and NL3D::CParticleSystem::systemDurationChanged(). +

+

00417 {       
+00418         delete _PeriodScheme;   
+00419         _PeriodScheme = scheme;
+00420         if (_Owner && scheme->hasMemory()) scheme->resize(_Owner->getMaxSize(), _Owner->getSize());
+00421         if (_Owner && _Owner->getOwner())
+00422         {
+00423                 _Owner->getOwner()->systemDurationChanged();
+00424         }
+00425 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CPSEmitter::setSpeedInheritanceFactor float  fact  )  [inline]
+
+ + + + + +
+   + + +

+Set a factor, to add the emitter speed to the emittee creation speed. this can be < 0 The default is 0 +

+Definition at line 184 of file ps_emitter.h. +

+References _SpeedInheritanceFactor. +

+

00185                 {
+00186                         _SpeedInheritanceFactor = fact;
+00187                 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CPSLocatedBindable::setupDriverModelMatrix void   )  [inherited]
+
+ + + + + +
+   + + +

+shortcut to setup the model matrix (system basis or world basis) +

+ +

+Definition at line 2142 of file ps_located.cpp. +

+References nlassert, and NL3D::CPSLocated::setupDriverModelMatrix(). +

+Referenced by NL3D::CPSLocatedBindable::displayIcon2d(), NL3D::CPSTailDot::displayRibbons(), NL3D::CPSRibbonLookAt::displayRibbons(), NL3D::CPSRibbon::displayRibbons(), NL3D::CPSDot::draw(), NL3D::CPSFaceHelper::drawFaces(), NL3D::CPSFanLightHelper::drawFanLight(), NL3D::CPSFaceLookAtHelper::drawLookAt(), NL3D::CPSFaceLookAtHelper::drawLookAtAlignOnMotion(), NL3D::CPSConstraintMeshHelper::drawMeshs(), NL3D::CPSConstraintMeshHelper::drawPrerotatedMeshs(), NL3D::CPSZoneRectangle::show(), NL3D::CPSZoneCylinder::show(), NL3D::CPSZoneDisc::show(), NL3D::CPSZoneSphere::show(), NL3D::CPSZonePlane::show(), NL3D::CPSCylindricVortex::show(), NL3D::CPSDirectionnalForce::show(), NL3D::CPSSphericalEmitter::showTool(), NL3D::CPSEmitterRectangle::showTool(), and showTool(). +

+

02143 {
+02144         nlassert(_Owner);
+02145         _Owner->setupDriverModelMatrix();
+02146 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CPSEmitter::setUserMatrixModeForEmissionDirection TPSMatrixMode  matrixMode  ) 
+
+ + + + + +
+   + + +

+=============================================================================== +

+Set the coord. system in with the direction is expressed. This value is taken in account only if enableUserMatrixModeForEmissionDirection(true) has been called. NB : if isSpeedBasisEmissionEnabled() == true then this value is meaningless +

+Definition at line 2609 of file ps_emitter.cpp. +

+References _UserDirectionMatrixMode, isUserMatrixUsed(), and updatePSRefCountForUserMatrixUsage(). +

+

02610 {
+02611         bool wasUserMatNeeded = isUserMatrixUsed();
+02612         _UserDirectionMatrixMode = matrixMode;
+02613         updatePSRefCountForUserMatrixUsage(isUserMatrixUsed(), wasUserMatNeeded);
+02614 }
+
+

+ + + + +
+ + + + + + + + + + +
virtual void NL3D::CPSLocatedBindable::setZBias float  value  )  [inline, virtual, inherited]
+
+ + + + + +
+   + + +

+ +

+Reimplemented in NL3D::CPSDot, NL3D::CPSFanLight, NL3D::CPSMesh, NL3D::CPSConstraintMesh, NL3D::CPSParticle, NL3D::CPSQuad, NL3D::CPSRibbon, NL3D::CPSRibbonLookAt, NL3D::CPSShockWave, and NL3D::CPSTailDot. +

+Definition at line 980 of file ps_located.h. +

+References value. +

+

00980 {}
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CPSEmitter::showTool void   )  [virtual]
+
+ + + + + +
+   + + +

+========================================================================== +

+ +

+Reimplemented in NL3D::CPSEmitterRectangle, and NL3D::CPSSphericalEmitter. +

+Definition at line 447 of file ps_emitter.cpp. +

+References NL3D::CPSLocatedBindable::computeI(), NL3D::CPSLocatedBindable::computeK(), NL3D::CParticleSystem::getCurrentEditedElement(), NL3D::CPSLocatedBindable::getDriver(), NL3D::CParticleSystemProcess::getOwner(), NL3D::CPSLocated::getPos(), NL3D::CPSLocated::getSize(), index, NL3D::CMaterial::setBlend(), NL3D::CMaterial::setBlendFunc(), NL3D::CMaterial::setColor(), NL3D::CMaterial::setLighting(), NL3D::CPSLocatedBindable::setupDriverModelMatrix(), NL3D::CMaterial::setZFunc(), NL3D::CMaterial::setZWrite(), size, uint, and uint32. +

+Referenced by step(). +

+

00448 {
+00449         uint32 size = _Owner->getSize();
+00450         if (!size) return;              
+00451         setupDriverModelMatrix();       
+00452 
+00453         const CVector I = computeI();
+00454         const CVector K = computeK();
+00455 
+00456         // ugly slow code, but not for runtime
+00457         for (uint  k = 0; k < size; ++k)
+00458         {
+00459                 // center of the current particle
+00460                 const CVector p = _Owner->getPos()[k];
+00461                 const float sSize =0.1f;        
+00462                 std::vector<NLMISC::CLine> lines;
+00463                 NLMISC::CLine l;
+00464                 l.V0 = p - sSize * I; l.V1 =  p + sSize * I; lines.push_back(l);
+00465                 l.V0 = p - sSize * K; l.V1 =  p + sSize * K; lines.push_back(l);
+00466                 l.V0 = p - sSize * (I + K); l.V1 = p + sSize * (I + K); lines.push_back(l);
+00467                 l.V0 = p - sSize * (I - K); l.V1 = p + sSize * (I - K); lines.push_back(l);
+00468                                                                                                                                                 
+00469                 CMaterial mat;
+00470                 mat.setBlendFunc(CMaterial::one, CMaterial::one);
+00471                 mat.setZWrite(false);
+00472                 mat.setLighting(false);
+00473                 mat.setBlend(true);
+00474                 mat.setZFunc(CMaterial::less);
+00475                 
+00476         
+00477                 CPSLocated *loc;                
+00478                 uint32 index;
+00479                 CPSLocatedBindable *lb;
+00480                 _Owner->getOwner()->getCurrentEditedElement(loc, index, lb);
+00481 
+00482                 mat.setColor((lb == NULL || this == lb) && loc == _Owner && index == k  ? CRGBA::Red : CRGBA(127, 127, 127));
+00483                 
+00484 
+00485                 CDRU::drawLinesUnlit(lines, mat, *getDriver() );
+00486         }
+00487 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NL3D::CPSEmitter::singleEmit uint32  index,
uint  quantity
+
+ + + + + +
+   + + +

+========================================================================== +

+ +

+Definition at line 490 of file ps_emitter.cpp. +

+References _GenNb, _GenNbScheme, NL3D::CPSAttribMaker< uint32 >::get(), index, nlassert, processEmit(), uint, and uint32. +

+Referenced by NL3D::CPSLocated::deleteElement(), and NL3D::CParticleSystemInstanceUser::emit(). +

+

00491 {
+00492         nlassert(_Owner);
+00493         const uint32 nbToGenerate = _GenNbScheme ? _GenNbScheme->get(_Owner,0) : _GenNb;                
+00494         processEmit(index, quantity * nbToGenerate);
+00495 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
void NL3D::CPSEmitter::step TPSProcessPass  pass,
TAnimationTime  ellapsedTime,
TAnimationTime  realEllapsedTime
[virtual]
+
+ + + + + +
+   + + +

+========================================================================== +

+Process the emissions. The standard behaviuour will call "emit" each time is needed. So you don't need to redefine this most of the time +

+Implements NL3D::CPSLocatedBindable. +

+Definition at line 1755 of file ps_emitter.cpp. +

+References _BypassAutoLOD, _ConsistentEmission, _EmissionType, _EmittedType, _GenNb, _GenNbScheme, _Phase, NL3D::CPSAttrib< float >::begin(), NL3D::CPSAttrib< float >::end(), NL3D::CPSAttribMaker< uint32 >::get(), NL3D::CParticleSystem::getAutoLODEmitRatio(), NL3D::CParticleSystemProcess::getOwner(), NL3D::CPSLocated::getSize(), NL3D::CParticleSystem::isAutoLODEnabled(), NL3D::CParticleSystem::isSharingEnabled(), nlassert, processEmit(), processRegularEmission(), processRegularEmissionConsistent(), processRegularEmissionConsistentWithNoLOD(), processRegularEmissionWithNoLOD(), NL3D::PSEmit, NL3D::PSToolRender, showTool(), sint32, size, NL3D::TAnimationTime, and uint32. +

+

01756 {       
+01757         if (pass == PSToolRender)
+01758         {
+01759                 showTool();
+01760                 return;
+01761         }
+01762         if (pass != PSEmit || !_EmittedType) return;
+01763         const uint32 size = _Owner->getSize();
+01764         if (!size) return;
+01765 
+01766         if (ellapsedTime == 0.f) return; // do nothing when paused
+01767 
+01768         CParticleSystem *ps = _Owner->getOwner();       
+01769         nlassert(ps);
+01770         float emitLOD;
+01771         if (ps->isAutoLODEnabled() && !ps->isSharingEnabled() && !_BypassAutoLOD)
+01772         {
+01773                 // temp test for auto lod
+01774                 emitLOD = ps->getAutoLODEmitRatio();
+01775         }
+01776         else
+01777         {
+01778                 emitLOD = 1.f; 
+01779         }
+01780         
+01781 
+01782         // our behaviour depend of the frequency
+01783         switch (_EmissionType)
+01784         {
+01785                 case CPSEmitter::once :
+01786                 {
+01787                         if (!_GenNbScheme && _GenNb == 0) return;
+01788                         TPSAttribTime::iterator timeIt = _Phase.begin(), timeEndIt = _Phase.end();
+01789 
+01790                         if (emitLOD == 1.f)
+01791                         {                       
+01792                                 while (timeIt != timeEndIt)
+01793                                 {
+01794                                         if (*timeIt == 0.f)
+01795                                         {
+01796                                                 const uint32 nbToGenerate = _GenNbScheme ? _GenNbScheme->get(_Owner, timeIt - _Phase.begin()) : _GenNb;         
+01797                                                 processEmit(timeIt - _Phase.begin(), nbToGenerate);             
+01798                                                 *timeIt = 1.f;
+01799                                         }
+01800                                         ++timeIt;
+01801                                 }
+01802                         }
+01803                         else
+01804                         {
+01805                                 while (timeIt != timeEndIt)
+01806                                 {
+01807                                         if (*timeIt == 0.f)
+01808                                         {
+01809                                                 uint32 nbToGenerate = _GenNbScheme ? _GenNbScheme->get(_Owner, timeIt - _Phase.begin()) : _GenNb;
+01810                                                 if (nbToGenerate > 0)
+01811                                                 {                               
+01812                                                         nbToGenerate = (sint32) (emitLOD * nbToGenerate);
+01813                                                         if (!nbToGenerate) nbToGenerate = 1;
+01814                                                         processEmit(timeIt - _Phase.begin(), nbToGenerate);
+01815                                                 }
+01816                                                 *timeIt = 1.f;
+01817                                         }
+01818                                         ++timeIt;
+01819                                 }
+01820 
+01821                         }
+01822                 }
+01823                 break;
+01824                 case (CPSEmitter::regular):
+01825                 {
+01826                         if (!_ConsistentEmission)
+01827                         {
+01828                                 if (emitLOD != 1.f)
+01829                                 {
+01830                                         processRegularEmission(ellapsedTime, emitLOD);
+01831                                 }
+01832                                 else
+01833                                 {
+01834                                         processRegularEmissionWithNoLOD(ellapsedTime);
+01835                                 }
+01836                         }
+01837                         else
+01838                         {
+01839                                 if (emitLOD != 1.f)
+01840                                 {
+01841                                         if (emitLOD != 0.f)
+01842                                         {                                       
+01843                                                 processRegularEmissionConsistent(ellapsedTime, realEllapsedTime / ellapsedTime, emitLOD, 1.f / emitLOD);
+01844                                         }
+01845                                 }
+01846                                 else
+01847                                 {
+01848                                         processRegularEmissionConsistentWithNoLOD(ellapsedTime, realEllapsedTime / ellapsedTime);
+01849                                 }
+01850                         }
+01851                 }
+01852                 break;  
+01853                 default: break;
+01854         }
+01855 }
+
+

+ + + + +
+ + + + + + + + + +
virtual void NL3D::CPSLocatedBindable::systemDateChanged  )  [inline, virtual, inherited]
+
+ + + + + +
+   + + +

+PRIVATE USE : called by the system when its date has been manually changed. This his usually for object that expect time to be always increasing, so that they can reset their datas +

+Reimplemented in NL3D::CPSRibbonBase. +

+Definition at line 1038 of file ps_located.h. +

+

01038 {}
+
+

+ + + + +
+ + + + + + + + + +
bool NL3D::CPSEmitter::testEmitForever  )  const
+
+ + + + + +
+   + + +

+========================================================================== +

+Test is the emitter will emit an infinite amount of particles (e.g it doesn't stop after a while) NB : If the emitter isn't inserted in a CPSLocated instance, an assertion will be reaised +

+Definition at line 2148 of file ps_emitter.cpp. +

+References getEmissionType(), NL3D::CPSLocated::getLastForever(), getMaxEmissionCount(), nlassert, and nlwarning. +

+Referenced by NL3D::CParticleSystem::canFinish(), setEmissionType(), and setMaxEmissionCount(). +

+

02149 {                               
+02150         if (!_Owner)
+02151         {
+02152                 nlwarning("<CPSEmitter::testEmitForever> The emitter should be inserted in a CPSLocated instance for this call to work.");
+02153                 nlassert(0);
+02154                 return true;
+02155         }       
+02156         if (!_Owner->getLastForever()) return false;
+02157         switch(getEmissionType())
+02158         {
+02159                 case CPSEmitter::onBounce:
+02160                 case CPSEmitter::externEmit:
+02161                 case CPSEmitter::regular:
+02162                         // it is ok only if a limited number of located is emitted
+02163                         if (getMaxEmissionCount() == 0) return true;
+02164                 break;
+02165                 case CPSEmitter::onDeath: return true; // the emitter never dies, so ..
+02166                 case CPSEmitter::once: return false;
+02167                 break;
+02168                 default:
+02169                         nlassert(0); // not a known type
+02170                 break;
+02171         }
+02172         return false;
+02173 }
+
+

+ + + + +
+ + + + + + + + + +
void NL3D::CPSEmitter::updateMaxCountVect  )  [protected]
+
+ + + + + +
+   + + +

+========================================================================== +

+ +

+Definition at line 2059 of file ps_emitter.cpp. +

+References _MaxEmissionCount, _NumEmission, NL3D::CPSLocated::getMaxSize(), NL3D::CPSLocated::getSize(), NL3D::CPSAttrib< T >::getSize(), NL3D::CPSAttrib< T >::insert(), NL3D::CPSAttrib< T >::remove(), and NL3D::CPSAttrib< T >::resize(). +

+Referenced by setMaxEmissionCount(), and setOwner(). +

+

02060 {
+02061         if (!_MaxEmissionCount || !_Owner)
+02062         {
+02063                 _NumEmission.resize(0);
+02064         }
+02065         else
+02066         {               
+02067                 _NumEmission.resize(_Owner->getMaxSize());
+02068                 while (_NumEmission.getSize() != 0) 
+02069                 {               
+02070                         _NumEmission.remove(0);
+02071                 }
+02072                 while (_NumEmission.getSize() != _Owner->getSize())
+02073                 {
+02074                         _NumEmission.insert(0);
+02075                 }               
+02076         }
+02077 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NL3D::CPSEmitter::updatePSRefCountForUserMatrixUsage bool  matrixIsNeededNow,
bool  matrixWasNeededBefore
[protected]
+
+ + + + + +
+   + + +

+========================================================================== +

+The particle system maintains a ref counter to see how many object requires the user matrix for their computation (if it isn't required, a significant amount of memory used for maintenance can be saved) This tool function helps increasing / decreasing that count by seeing if the matrix is still required or not +

+Definition at line 2618 of file ps_emitter.cpp. +

+References NL3D::CParticleSystem::addRefForUserSysCoordInfo(), NL3D::CParticleSystemProcess::getOwner(), and NL3D::CParticleSystem::releaseRefForUserSysCoordInfo(). +

+Referenced by enableSpeedBasisEmission(), enableUserMatrixModeForEmissionDirection(), and setUserMatrixModeForEmissionDirection(). +

+

02619 {
+02620         if (_Owner && _Owner->getOwner())
+02621         {
+02622                 if (matrixIsNeededNow && !matrixWasNeededBefore)
+02623                 {
+02624                         _Owner->getOwner()->addRefForUserSysCoordInfo();
+02625                 }
+02626                 else if (!matrixIsNeededNow && matrixWasNeededBefore)
+02627                 {
+02628                         _Owner->getOwner()->releaseRefForUserSysCoordInfo();
+02629                 }
+02630         }
+02631 }
+
+

+ + + + +
+ + + + + + + + + + +
bool NL3D::CPSEmitter::useGenNbScheme void   )  [inline]
+
+ + + + + +
+   + + +

+Indicate whether a GenNb scheme is used or not. +

+ +

+Definition at line 165 of file ps_emitter.h. +

+References _GenNbScheme. +

+

00165 { return _GenNbScheme != NULL; }
+
+

+ + + + +
+ + + + + + + + + + +
bool NL3D::CPSEmitter::usePeriodScheme void   )  [inline]
+
+ + + + + +
+   + + +

+Indicate whether a period scheme is used or not. +

+ +

+Definition at line 129 of file ps_emitter.h. +

+References _PeriodScheme. +

+

00129 { return _PeriodScheme != NULL; }
+
+


Friends And Related Function Documentation

+

+ + + + +
+ + +
friend class CPSLocated [friend, inherited] +
+
+ + + + + +
+   + + +

+ +

+Reimplemented in NL3D::CPSForce. +

+Definition at line 986 of file ps_located.h.

+


Field Documentation

+

+ + + + +
+ + +
bool NL3D::CPSLocatedBindable::_Active [protected, inherited] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 1033 of file ps_located.h. +

+Referenced by NL3D::CPSLocatedBindable::isActive(), and NL3D::CPSLocatedBindable::setActive().

+

+ + + + +
+ + +
bool NL3D::CPSEmitter::_BypassAutoLOD [protected] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 356 of file ps_emitter.h. +

+Referenced by getBypassAutoLOD(), setBypassAutoLOD(), and step().

+

+ + + + +
+ + +
bool NL3D::CPSEmitter::_BypassEmitOnDeath = false [static, protected] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 42 of file ps_emitter.cpp. +

+Referenced by deleteElement(), and setBypassEmitOnDeath().

+

+ + + + +
+ + +
bool NL3D::CPSEmitter::_ConsistentEmission [protected] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 355 of file ps_emitter.h. +

+Referenced by enableConsistenEmission(), isConsistentEmissionEnabled(), and step().

+

+ + + + +
+ + +
TEmissionType NL3D::CPSEmitter::_EmissionType [protected] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 347 of file ps_emitter.h. +

+Referenced by bounceOccured(), deleteElement(), getEmissionType(), setEmissionType(), and step().

+

+ + + + +
+ + +
float NL3D::CPSEmitter::_EmitDelay [protected] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 352 of file ps_emitter.h. +

+Referenced by getEmitDelay(), processRegularEmission(), processRegularEmissionConsistent(), processRegularEmissionConsistentWithNoLOD(), processRegularEmissionWithNoLOD(), and setEmitDelay().

+

+ + + + +
+ + +
CPSLocated* NL3D::CPSEmitter::_EmittedType [protected] +
+
+ + + + + +
+   + + +

+A pointer on the type to be emitted. +

+ +

+Definition at line 339 of file ps_emitter.h. +

+Referenced by bounceOccured(), checkLoop(), deleteElement(), getEmittedType(), notifyTargetRemoved(), processEmit(), processEmitConsistent(), processRegularEmissionConsistent(), processRegularEmissionConsistentWithNoLOD(), releaseRefTo(), setEmittedType(), step(), and ~CPSEmitter().

+

+ + + + +
+ + +
uint32 NL3D::CPSLocatedBindable::_ExternID [protected, inherited] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 1027 of file ps_located.h. +

+Referenced by NL3D::CPSLocatedBindable::getExternID(), NL3D::CPSLocatedBindable::setExternID(), and NL3D::CPSLocatedBindable::~CPSLocatedBindable().

+

+ + + + +
+ + +
uint32 NL3D::CPSEmitter::_GenNb [protected] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 350 of file ps_emitter.h. +

+Referenced by bounceOccured(), deleteElement(), getGenNb(), processRegularEmission(), processRegularEmissionConsistent(), processRegularEmissionConsistentWithNoLOD(), processRegularEmissionWithNoLOD(), setGenNb(), singleEmit(), and step().

+

+ + + + +
+ + +
CPSAttribMaker<uint32>* NL3D::CPSEmitter::_GenNbScheme [protected] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 351 of file ps_emitter.h. +

+Referenced by bounceOccured(), deleteElement(), getGenNbScheme(), newElement(), processRegularEmission(), processRegularEmissionConsistent(), processRegularEmissionConsistentWithNoLOD(), processRegularEmissionWithNoLOD(), resize(), setGenNb(), setGenNbScheme(), singleEmit(), step(), useGenNbScheme(), and ~CPSEmitter().

+

+ + + + +
+ + +
TPSLod NL3D::CPSLocatedBindable::_LOD [protected, inherited] +
+
+ + + + + +
+   + + +

+tells when this object must be dealt with +

+ +

+Definition at line 1029 of file ps_located.h. +

+Referenced by NL3D::CPSLocatedBindable::getLOD(), and NL3D::CPSLocatedBindable::setLOD().

+

+ + + + +
+ + +
uint8 NL3D::CPSEmitter::_MaxEmissionCount [protected] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 353 of file ps_emitter.h. +

+Referenced by deleteElement(), getMaxEmissionCount(), newElement(), processRegularEmission(), processRegularEmissionConsistent(), processRegularEmissionConsistentWithNoLOD(), processRegularEmissionWithNoLOD(), resize(), setMaxEmissionCount(), and updateMaxCountVect().

+

+ + + + +
+ + +
std::string NL3D::CPSLocatedBindable::_Name [protected, inherited] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 1031 of file ps_located.h.

+

+ + + + +
+ + +
TPSAttribUInt8 NL3D::CPSEmitter::_NumEmission [protected] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 344 of file ps_emitter.h. +

+Referenced by deleteElement(), newElement(), processRegularEmission(), processRegularEmissionConsistent(), processRegularEmissionConsistentWithNoLOD(), processRegularEmissionWithNoLOD(), resize(), and updateMaxCountVect().

+

+ + + + +
+ + +
CPSLocated* NL3D::CPSLocatedBindable::_Owner [protected, inherited] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 1026 of file ps_located.h. +

+Referenced by NL3D::CPSFaceHelper::drawFaces(), NL3D::CPSFanLightHelper::drawFanLight(), NL3D::CPSFaceLookAtHelper::drawLookAt(), NL3D::CPSFaceLookAtHelper::drawLookAtAlignOnMotion(), NL3D::CPSConstraintMeshHelper::drawMeshs(), and NL3D::CPSConstraintMeshHelper::drawPrerotatedMeshs().

+

+ + + + +
+ + +
float NL3D::CPSEmitter::_Period [protected] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 348 of file ps_emitter.h. +

+Referenced by getPeriod(), processRegularEmission(), processRegularEmissionConsistent(), processRegularEmissionConsistentWithNoLOD(), processRegularEmissionWithNoLOD(), and setPeriod().

+

+ + + + +
+ + +
CPSAttribMaker<float>* NL3D::CPSEmitter::_PeriodScheme [protected] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 349 of file ps_emitter.h. +

+Referenced by deleteElement(), getPeriodScheme(), newElement(), processRegularEmission(), processRegularEmissionConsistent(), processRegularEmissionConsistentWithNoLOD(), processRegularEmissionWithNoLOD(), resize(), setPeriod(), setPeriodScheme(), usePeriodScheme(), and ~CPSEmitter().

+

+ + + + +
+ + +
TPSAttribFloat NL3D::CPSEmitter::_Phase [protected] +
+
+ + + + + +
+   + + +

+The phase ( 0 < phase < period of emission). This is the time ellapsed since the last emission +

+Definition at line 343 of file ps_emitter.h. +

+Referenced by deleteElement(), newElement(), processRegularEmission(), processRegularEmissionConsistent(), processRegularEmissionConsistentWithNoLOD(), processRegularEmissionWithNoLOD(), resize(), and step().

+

+ + + + +
+ + +
bool NL3D::CPSEmitter::_SpeedBasisEmission [protected] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 354 of file ps_emitter.h. +

+Referenced by enableSpeedBasisEmission(), isSpeedBasisEmissionEnabled(), isUserMatrixUsed(), processEmit(), and processEmitConsistent().

+

+ + + + +
+ + +
float NL3D::CPSEmitter::_SpeedInheritanceFactor [protected] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 346 of file ps_emitter.h. +

+Referenced by getSpeedInheritanceFactor(), processEmit(), processEmitConsistent(), and setSpeedInheritanceFactor().

+

+ + + + +
+ + +
TPSMatrixMode NL3D::CPSEmitter::_UserDirectionMatrixMode [protected] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 358 of file ps_emitter.h. +

+Referenced by getUserMatrixModeForEmissionDirection(), isUserMatrixUsed(), processEmit(), processEmitConsistent(), and setUserMatrixModeForEmissionDirection().

+

+ + + + +
+ + +
bool NL3D::CPSEmitter::_UserMatrixModeForEmissionDirection [protected] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 357 of file ps_emitter.h. +

+Referenced by enableUserMatrixModeForEmissionDirection(), isUserMatrixModeForEmissionDirectionEnabled(), isUserMatrixUsed(), processEmit(), and processEmitConsistent().

+


The documentation for this class was generated from the following files: +
Generated on Tue Mar 16 07:08:05 2004 for NeL by + +doxygen +1.3.6
+ + -- cgit v1.2.1