#include <ps_emitter.h>
Inheritance diagram for NL3D::CPSEmitterOmni:
Definition at line 507 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 |
CPSEmitterOmni () | |
virtual bool | doesProduceBBox (void) const |
virtual void | emit (const NLMISC::CVector &srcPos, uint32 index, NLMISC::CVector &pos, NLMISC::CVector &speed) |
========================================================================== | |
void | enableConsistenEmission (bool enable) |
virtual void | enumTexs (std::vector< NLMISC::CSmartPtr< ITexture > > &dest, IDriver &drv) |
bool | getBypassAutoLOD () const |
virtual std::string | getClassName ()=0 |
IDriver * | getDriver () 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 CPSLocated * | getEmittedType (void) const |
Get const ptr on emitted type. | |
CPSLocated * | getEmittedType (void) |
Get emitted type. | |
float | getEmitteeSpeed (void) const |
get the modulation speed (valid only if no scheme is used) | |
const CPSAttribMaker< float > * | getEmitteeSpeedScheme (void) const |
get the speed modulation shceme, or NULL if no one is set (const version) | |
CPSAttribMaker< float > * | getEmitteeSpeedScheme (void) |
get the speed modulation shceme, or NULL if no one is set | |
uint32 | getExternID (void) const |
get the extern ID of this located bindable | |
const CFontGenerator * | getFontGenerator (void) const |
Shortcut to get the font generator if one was set (const version). | |
CFontGenerator * | getFontGenerator (void) |
Shortcut to get the font generator if one was set. | |
const CFontManager * | getFontManager (void) const |
Shortcut to get the font manager if one was set (const version). | |
CFontManager * | getFontManager (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::CMatrix & | getInvertedSysMat (void) const |
shortcut to get the inverted matrix of the system | |
const NLMISC::CMatrix & | getInvertedViewMat (void) const |
shortcut to get the inverted view matrix | |
const NLMISC::CMatrix & | getLocalToWorldMatrix () 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 CPSLocated * | getOwner (void) const |
get the located that owns this bindable (const version) | |
CPSLocated * | getOwner (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::CMatrix & | getSysMat (void) const |
*************************************************************************************** | |
uint32 | getType (void) const |
Return this bindable type. | |
virtual bool | getUserMatrixUsageCount () const |
========================================================================== | |
const NLMISC::CMatrix & | getViewMat (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 | |
NLMISC_DECLARE_CLASS (CPSEmitterOmni) | |
virtual void | notifyTargetRemoved (CPSLocated *ptr) |
========================================================================== | |
virtual void | releaseAllRef () |
virtual void | releaseRefTo (const CParticleSystemProcess *other) |
========================================================================== | |
virtual void | serial (NLMISC::IStream &f) throw (NLMISC::EStream) |
========================================================================== | |
void | serialEmitteeSpeedScheme (NLMISC::IStream &f) throw (NLMISC::EStream) |
serialization | |
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 | setEmitteeSpeed (float speed) |
set a constant speed modulation for emittee | |
void | setEmitteeSpeedScheme (CPSAttribMaker< float > *scheme) |
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 | useEmitteeSpeedScheme (void) const |
check wether a speed modulation scheme is being used | |
bool | useGenNbScheme (void) |
Indicate whether a GenNb scheme is used or not. | |
bool | usePeriodScheme (void) |
Indicate whether a period scheme is used or not. | |
Static Public Member Functions | |
void | setBypassEmitOnDeath (bool bypass) |
Protected Member Functions | |
virtual void | bounceOccured (uint32 index) |
========================================================================== | |
virtual void | deleteElement (uint32 index) |
========================================================================== | |
void | deleteEmitteeSpeedElement (uint32 index) |
void | displayIcon2d (const NLMISC::CVector tab[], uint nbSegs, float scale) |
*************************************************************************************** | |
virtual CPSLocated * | getModulatedEmitterOwner (void) |
bool | isUserMatrixUsed () const |
========================================================================== | |
virtual void | newElement (CPSLocated *emitter, uint32 emitterIndex) |
========================================================================== | |
void | newEmitteeSpeedElement (CPSLocated *emitter, 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 capacity) |
========================================================================== | |
void | resizeEmitteeSpeed (uint32 capacity) |
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. | |
float | _EmitteeSpeed |
CPSAttribMaker< float > * | _EmitteeSpeedScheme |
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 |
|
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 Definition at line 109 of file ps_emitter.h. Referenced by NL3D::CPSEmitter::getEmissionType(), and NL3D::CPSEmitter::setEmissionType().
00109 { regular = 0, onDeath = 1, once = 2, onBounce = 3, externEmit = 4, numEmissionType }; |
|
Definition at line 512 of file ps_emitter.h.
00513 { 00514 if (CParticleSystem::getSerializeIdentifierFlag()) _Name = std::string("EmitterOmni"); 00515 } |
|
Called when the basis of the owner changed. the default behaviour does nothing
Reimplemented in NL3D::CPSForce. Definition at line 968 of file ps_located.h.
00968 {} |
|
==========================================================================
Reimplemented from NL3D::CPSLocatedBindable. Definition at line 1908 of file ps_emitter.cpp. References NL3D::CPSEmitter::_EmissionType, NL3D::CPSEmitter::_EmittedType, NL3D::CPSEmitter::_GenNb, NL3D::CPSEmitter::_GenNbScheme, NL3D::CPSAttribMaker< uint32 >::get(), index, NL3D::CPSEmitter::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 } |
|
========================================================================== 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 NL3D::CPSEmitter::_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 } |
|
Reimplemented in NL3D::CPSFanLight, NL3D::CPSQuad, and NL3D::CPSShockWave. Definition at line 884 of file ps_located.h.
00884 { return false ;} |
|
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 NL3D::CPSEmitter::showTool().
00931 { return _Owner->computeI(); } |
|
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(); } |
|
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 NL3D::CPSEmitter::showTool().
00940 { return _Owner->computeK(); } |
|
==========================================================================
Reimplemented from NL3D::CPSEmitter. Definition at line 2237 of file ps_emitter.cpp. References NL3D::CPSModulatedEmitter::deleteEmitteeSpeedElement(), index, and uint32.
02238 { 02239 CPSEmitter::deleteElement(index); 02240 deleteEmitteeSpeedElement(index); 02241 } |
|
Definition at line 429 of file ps_emitter.h. References NL3D::CPSModulatedEmitter::_EmitteeSpeedScheme, NL3D::CPSAttribMaker< float >::deleteElement(), NL3D::CPSAttribMaker< float >::hasMemory(), index, and uint32. Referenced by NL3D::CPSSphericalEmitter::deleteElement(), NL3D::CPSEmitterRectangle::deleteElement(), NL3D::CPSEmitterDirectionnal::deleteElement(), and deleteElement().
00430 { 00431 if (_EmitteeSpeedScheme && _EmitteeSpeedScheme->hasMemory()) _EmitteeSpeedScheme->deleteElement(index); 00432 } |
|
*************************************************************************************** show an drawing to represent the object, and in red if it is selected
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 } |
|
Reimplemented in NL3D::CPSForce. Definition at line 888 of file ps_located.h.
00888 { return true; } |
|
==========================================================================
Implements NL3D::CPSEmitter. Definition at line 2205 of file ps_emitter.cpp. References NL3D::CPSAttribMaker< float >::get(), index, nlassert, uint32, and v.
02206 { 02207 // TODO : verifier que ca marche si une particule s'emet elle-mem 02208 nlassert(_EmittedType); 02209 02210 CVector v( ((rand() % 1000) - 500) / 500.0f 02211 , ((rand() % 1000) - 500) / 500.0f 02212 , ((rand() % 1000) - 500) / 500.0f); 02213 v.normalize(); 02214 v *= _EmitteeSpeedScheme ? _EmitteeSpeedScheme->get(_Owner, index) : _EmitteeSpeed; 02215 02216 pos = srcPos; 02217 speed = v; 02218 02219 } |
|
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 :
Definition at line 236 of file ps_emitter.h. References NL3D::CPSEmitter::_ConsistentEmission.
00236 { _ConsistentEmission = enable; } |
|
=============================================================================== 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 NL3D::CPSEmitter::_SpeedBasisEmission, NL3D::CPSEmitter::isUserMatrixUsed(), and NL3D::CPSEmitter::updatePSRefCountForUserMatrixUsage().
02594 { 02595 bool wasUserMatNeeded = isUserMatrixUsed(); 02596 _SpeedBasisEmission = enabled; 02597 updatePSRefCountForUserMatrixUsage(isUserMatrixUsed(), wasUserMatNeeded); 02598 } |
|
=============================================================================== 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 NL3D::CPSEmitter::_UserMatrixModeForEmissionDirection, NL3D::CPSEmitter::isUserMatrixUsed(), and NL3D::CPSEmitter::updatePSRefCountForUserMatrixUsage().
02602 { 02603 bool wasUserMatNeeded = isUserMatrixUsed(); 02604 _UserMatrixModeForEmissionDirection = enable; 02605 updatePSRefCountForUserMatrixUsage(isUserMatrixUsed(), wasUserMatNeeded); 02606 } |
|
Reimplemented in NL3D::CPSFanLight, NL3D::CPSQuad, NL3D::CPSRibbon, NL3D::CPSRibbonLookAt, and NL3D::CPSShockWave. Definition at line 977 of file ps_located.h.
00977 {} |
|
*************************************************************************************** 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 } |
|
Definition at line 252 of file ps_emitter.h. References NL3D::CPSEmitter::_BypassAutoLOD.
00252 { return _BypassAutoLOD; } |
|
Implemented in NLAIAGENT::CNumericIndex, NLAIC::IPointerGestion, NLAIC::CIdentType, and CAutomataDesc. Referenced by NLMISC::CClassRegistry::checkObject(), and NL3D::GetTextureSize(). |
|
|
Get the frequency type.
Definition at line 118 of file ps_emitter.h. References NL3D::CPSEmitter::_EmissionType, and NL3D::CPSEmitter::TEmissionType. Referenced by NL3D::CParticleSystem::evalDuration(), and NL3D::CPSEmitter::testEmitForever().
00118 { return _EmissionType; } |
|
Get the delay in seconds before the first emission (regular emitter only).
Definition at line 144 of file ps_emitter.h. References NL3D::CPSEmitter::_EmitDelay. Referenced by NL3D::CParticleSystem::evalDuration().
00144 { return _EmitDelay; } |
|
Get const ptr on emitted type.
Definition at line 98 of file ps_emitter.h. References NL3D::CPSEmitter::_EmittedType.
00098 { return _EmittedType; } |
|
Get emitted type.
Definition at line 96 of file ps_emitter.h. References NL3D::CPSEmitter::_EmittedType. Referenced by NL3D::CParticleSystem::evalDuration().
00096 { return _EmittedType; } |
|
get the modulation speed (valid only if no scheme is used)
Definition at line 405 of file ps_emitter.h. References NL3D::CPSModulatedEmitter::_EmitteeSpeed.
00405 { return _EmitteeSpeed; } |
|
get the speed modulation shceme, or NULL if no one is set (const version)
Definition at line 411 of file ps_emitter.h. References NL3D::CPSModulatedEmitter::_EmitteeSpeedScheme.
00411 { return _EmitteeSpeedScheme; } |
|
get the speed modulation shceme, or NULL if no one is set
Definition at line 408 of file ps_emitter.h. References NL3D::CPSModulatedEmitter::_EmitteeSpeedScheme.
00408 { return _EmitteeSpeedScheme; } |
|
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; } |
|
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.
|
|
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().
|
|
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.
|
|
***************************************************************************************
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().
|
|
Retrieve the GenNb for emission, valid only if a GenNb scheme is used.
Definition at line 162 of file ps_emitter.h. References NL3D::CPSEmitter::_GenNb, and uint.
00162 { return _GenNb; } |
|
Retrieve the GenNb scheme, or null, if there'isnt (const version).
Definition at line 174 of file ps_emitter.h. References NL3D::CPSEmitter::_GenNbScheme.
00174 { return _GenNbScheme; } |
|
Retrieve the GenNb scheme, or null, if there'isnt.
Definition at line 171 of file ps_emitter.h. References NL3D::CPSEmitter::_GenNbScheme.
00171 { return _GenNbScheme; } |
|
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.
|
|
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.
|
|
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().
|
|
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; } |
|
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 NL3D::CPSEmitter::_MaxEmissionCount, and uint8. Referenced by NL3D::CParticleSystem::evalDuration(), and NL3D::CPSEmitter::testEmitForever().
00154 { return _MaxEmissionCount; } |
|
Implements NL3D::CPSModulatedEmitter. Definition at line 526 of file ps_emitter.h.
00526 { return _Owner; } |
|
get the located bindable name (edition purpose)
Definition at line 948 of file ps_located.h.
00948 { return _Name; } |
|
get the located that owns this bindable (const version)
Definition at line 944 of file ps_located.h.
00944 { return _Owner; } |
|
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; } |
|
Retrieve the period for emission, valid only if a period scheme is used.
Definition at line 126 of file ps_emitter.h. References NL3D::CPSEmitter::_Period. Referenced by NL3D::CParticleSystem::evalDuration().
00126 { return _Period; } |
|
Definition at line 138 of file ps_emitter.h. References NL3D::CPSEmitter::_PeriodScheme.
00138 { return _PeriodScheme; } |
|
Definition at line 135 of file ps_emitter.h. References NL3D::CPSEmitter::_PeriodScheme. Referenced by NL3D::CParticleSystem::evalDuration().
00135 { return _PeriodScheme; } |
|
Return priority for emitters.
Implements NL3D::CPSLocatedBindable. Definition at line 67 of file ps_emitter.h. References uint32.
00067 { return 500; }
|
|
Get the speed Inheritance factor.
Definition at line 190 of file ps_emitter.h. References NL3D::CPSEmitter::_SpeedInheritanceFactor.
00191 { 00192 return _SpeedInheritanceFactor; 00193 } |
|
***************************************************************************************
Definition at line 2108 of file ps_located.cpp. References NL3D::CParticleSystemProcess::getOwner(), NL3D::CParticleSystem::getSysMat(), and nlassert.
|
|
Return this bindable type.
Implements NL3D::CPSLocatedBindable. Definition at line 63 of file ps_emitter.h. References NL3D::PSEmitter, and uint32.
00063 { return PSEmitter; } |
|
=============================================================================== 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 NL3D::CPSEmitter::_UserDirectionMatrixMode, and NL3D::TPSMatrixMode.
00222 { return _UserDirectionMatrixMode; } |
|
==========================================================================
Reimplemented from NL3D::CPSLocatedBindable. Definition at line 2640 of file ps_emitter.cpp. References NL3D::CPSEmitter::isUserMatrixUsed().
02641 { 02642 return isUserMatrixUsed() ? 1 : 0; 02643 } |
|
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().
|
|
tells wether there are alive emitters
Definition at line 958 of file ps_located.h.
00958 { return false; } |
|
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.
|
|
tells wether there are alive entities / particles
Reimplemented in NL3D::CPSParticle. Definition at line 956 of file ps_located.h.
00956 { return false; } |
|
Definition at line 844 of file ps_located.h. References NL3D::CPSLocatedBindable::_Active. Referenced by NL3D::CParticleSystem::hasActiveEmitters().
00844 { return _Active; } |
|
Definition at line 238 of file ps_emitter.h. References NL3D::CPSEmitter::_ConsistentEmission.
00238 { return _ConsistentEmission; } |
|
Check if the direction of emission is aligned on the emitter speed.
Definition at line 204 of file ps_emitter.h. References NL3D::CPSEmitter::_SpeedBasisEmission.
00204 { return _SpeedBasisEmission; } |
|
=============================================================================== 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 NL3D::CPSEmitter::_UserMatrixModeForEmissionDirection.
00216 { return _UserMatrixModeForEmissionDirection; } |
|
==========================================================================
Definition at line 2634 of file ps_emitter.cpp. References NL3D::CPSEmitter::_SpeedBasisEmission, NL3D::CPSEmitter::_UserDirectionMatrixMode, NL3D::CPSEmitter::_UserMatrixModeForEmissionDirection, and NL3D::PSUserMatrix. Referenced by NL3D::CPSEmitter::enableSpeedBasisEmission(), NL3D::CPSEmitter::enableUserMatrixModeForEmissionDirection(), NL3D::CPSEmitter::getUserMatrixUsageCount(), and NL3D::CPSEmitter::setUserMatrixModeForEmissionDirection().
02635 { 02636 return !_SpeedBasisEmission && _UserMatrixModeForEmissionDirection && _UserDirectionMatrixMode == PSUserMatrix; 02637 } |
|
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 {} |
|
==========================================================================
Reimplemented from NL3D::CPSEmitter. Definition at line 2230 of file ps_emitter.cpp. References NL3D::CPSModulatedEmitter::newEmitteeSpeedElement(), and uint32.
02231 { 02232 CPSEmitter::newElement(emitter, emitterIndex); 02233 newEmitteeSpeedElement(emitter, emitterIndex); 02234 } |
|
Definition at line 424 of file ps_emitter.h. References NL3D::CPSModulatedEmitter::_EmitteeSpeedScheme, NL3D::CPSAttribMaker< float >::hasMemory(), NL3D::CPSAttribMaker< float >::newElement(), and uint32. Referenced by NL3D::CPSSphericalEmitter::newElement(), NL3D::CPSEmitterRectangle::newElement(), NL3D::CPSEmitterDirectionnal::newElement(), and newElement().
00425 { 00426 if (_EmitteeSpeedScheme && _EmitteeSpeedScheme->hasMemory()) _EmitteeSpeedScheme->newElement(emitter, emitterIndex); 00427 } |
|
|
|
========================================================================== 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 NL3D::CPSEmitter::_EmittedType, nlassert, and NL3D::CPSEmitter::setEmittedType().
00395 { 00396 nlassert(ptr == _EmittedType && _EmittedType); 00397 setEmittedType(NULL); 00398 } |
|
==========================================================================
Definition at line 119 of file ps_emitter.cpp. References NL3D::CPSEmitter::_EmittedType, NL3D::CPSEmitter::_SpeedBasisEmission, NL3D::CPSEmitter::_SpeedInheritanceFactor, NL3D::CPSEmitter::_UserDirectionMatrixMode, NL3D::CPSEmitter::_UserMatrixModeForEmissionDirection, NL3D::CPSEmitter::emit(), NL3D::CParticleSystemProcess::getMatrixMode(), NL3D::CPSLocated::getPos(), NL3D::CPSLocated::getSpeed(), index, NL3D::CPSLocated::newElement(), nlassert, sint, and uint32. Referenced by NL3D::CPSEmitter::bounceOccured(), NL3D::CPSEmitter::deleteElement(), NL3D::CPSEmitter::processRegularEmission(), NL3D::CPSEmitter::processRegularEmissionConsistent(), NL3D::CPSEmitter::processRegularEmissionConsistentWithNoLOD(), NL3D::CPSEmitter::processRegularEmissionWithNoLOD(), NL3D::CPSEmitter::singleEmit(), and NL3D::CPSEmitter::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 } |
|
========================================================================== speed and pos of emittee Definition at line 247 of file ps_emitter.cpp. References NL3D::CPSEmitter::_EmittedType, NL3D::CPSEmitter::_SpeedBasisEmission, NL3D::CPSEmitter::_SpeedInheritanceFactor, NL3D::CPSEmitter::_UserDirectionMatrixMode, NL3D::CPSEmitter::_UserMatrixModeForEmissionDirection, NL3D::CompensateEmission(), NL3D::CPSEmitter::emit(), NL3D::CParticleSystemProcess::getMatrixMode(), NL3D::CPSLocated::getSpeed(), index, NL3D::CPSLocated::newElement(), nlassert, sint, NL3D::TAnimationTime, and uint32. Referenced by NL3D::CPSEmitter::processRegularEmissionConsistent(), and NL3D::CPSEmitter::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 } |
|
========================================================================== 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 NL3D::CPSEmitter::_EmitDelay, NL3D::CPSEmitter::_GenNb, NL3D::CPSEmitter::_GenNbScheme, NL3D::CPSEmitter::_MaxEmissionCount, NL3D::CPSEmitter::_NumEmission, NL3D::CPSEmitter::_Period, NL3D::CPSEmitter::_PeriodScheme, NL3D::CPSEmitter::_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, NL3D::CPSEmitter::processEmit(), NL3D::replaceNullPeriodsByThreshold(), sint32, size, NL3D::TAnimationTime, uint, uint32, and uint8. Referenced by NL3D::CPSEmitter::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 } |
|
========================================================================== 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 NL3D::CPSEmitter::_EmitDelay, NL3D::CPSEmitter::_EmittedType, NL3D::CPSEmitter::_GenNb, NL3D::CPSEmitter::_GenNbScheme, NL3D::CPSEmitter::_MaxEmissionCount, NL3D::CPSEmitter::_NumEmission, NL3D::CPSEmitter::_Period, NL3D::CPSEmitter::_PeriodScheme, NL3D::CPSEmitter::_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, NL3D::CPSEmitter::processEmit(), NL3D::CPSEmitter::processEmitConsistent(), NL3D::replaceNullPeriodsByThreshold(), sint32, size, NL3D::TAnimationTime, uint, uint32, and uint8. Referenced by NL3D::CPSEmitter::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 } |
|
========================================================================== 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 NL3D::CPSEmitter::_EmitDelay, NL3D::CPSEmitter::_EmittedType, NL3D::CPSEmitter::_GenNb, NL3D::CPSEmitter::_GenNbScheme, NL3D::CPSEmitter::_MaxEmissionCount, NL3D::CPSEmitter::_NumEmission, NL3D::CPSEmitter::_Period, NL3D::CPSEmitter::_PeriodScheme, NL3D::CPSEmitter::_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, NL3D::CPSEmitter::processEmit(), NL3D::CPSEmitter::processEmitConsistent(), NL3D::replaceNullPeriodsByThreshold(), sint32, size, NL3D::TAnimationTime, uint, and uint32. Referenced by NL3D::CPSEmitter::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 } |
|
========================================================================== 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 NL3D::CPSEmitter::_EmitDelay, NL3D::CPSEmitter::_GenNb, NL3D::CPSEmitter::_GenNbScheme, NL3D::CPSEmitter::_MaxEmissionCount, NL3D::CPSEmitter::_NumEmission, NL3D::CPSEmitter::_Period, NL3D::CPSEmitter::_PeriodScheme, NL3D::CPSEmitter::_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, NL3D::CPSEmitter::processEmit(), NL3D::replaceNullPeriodsByThreshold(), sint32, size, NL3D::TAnimationTime, uint, and uint32. Referenced by NL3D::CPSEmitter::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 } |
|
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 NL3D::CPSEmitter::setEmittedType().
00105 { 00106 setEmittedType(NULL); 00107 } |
|
========================================================================== 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 NL3D::CPSEmitter::_EmittedType, and NL3D::CPSEmitter::setEmittedType().
00097 { 00098 if (_EmittedType == other) 00099 { 00100 setEmittedType(NULL); 00101 } 00102 } |
|
==========================================================================
Reimplemented from NL3D::CPSEmitter. Definition at line 2244 of file ps_emitter.cpp. References nlassert, NL3D::CPSModulatedEmitter::resizeEmitteeSpeed(), and uint32.
02245 { 02246 nlassert(capacity < (1 << 16)); 02247 CPSEmitter::resize(capacity); 02248 resizeEmitteeSpeed(capacity); 02249 } |
|
Definition at line 434 of file ps_emitter.h. References NL3D::CPSModulatedEmitter::_EmitteeSpeedScheme, NL3D::CPSModulatedEmitter::getModulatedEmitterOwner(), NL3D::CPSAttribMaker< float >::hasMemory(), NL3D::CPSAttribMaker< float >::resize(), and uint32. Referenced by NL3D::CPSSphericalEmitter::resize(), NL3D::CPSEmitterRectangle::resize(), NL3D::CPSEmitterDirectionnal::resize(), and resize().
00435 { 00436 if (_EmitteeSpeedScheme && _EmitteeSpeedScheme->hasMemory()) _EmitteeSpeedScheme->resize(capacity, getModulatedEmitterOwner()->getSize()); 00437 } |
|
==========================================================================
Reimplemented from NL3D::CPSEmitter. Definition at line 2222 of file ps_emitter.cpp.
02223 { 02224 f.serialVersion(1); 02225 CPSEmitter::serial(f); 02226 CPSModulatedEmitter::serialEmitteeSpeedScheme(f); 02227 } |
|
serialization
Definition at line 2180 of file ps_emitter.cpp.
02181 { 02182 bool useScheme; 02183 if (!f.isReading()) 02184 { 02185 useScheme = useEmitteeSpeedScheme(); 02186 } 02187 f.serial(useScheme); 02188 if (useScheme) 02189 { 02190 f.serialPolyPtr(_EmitteeSpeedScheme); 02191 } 02192 else 02193 { 02194 f.serial(_EmitteeSpeed); 02195 } 02196 } |
|
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; } |
|
Definition at line 251 of file ps_emitter.h. References NL3D::CPSEmitter::_BypassAutoLOD.
00251 { _BypassAutoLOD = bypass; } |
|
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 NL3D::CPSEmitter::_BypassEmitOnDeath.
00256 { _BypassEmitOnDeath = bypass; } |
|
========================================================================== 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)
Definition at line 326 of file ps_emitter.cpp. References NL3D::CPSEmitter::_EmissionType, NL3D::CParticleSystem::getBypassMaxNumIntegrationSteps(), NL3D::CParticleSystemProcess::getOwner(), nlassert, nlwarning, NL3D::CParticleSystem::systemDurationChanged(), NL3D::CPSEmitter::TEmissionType, NL3D::CPSEmitter::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 } |
|
==========================================================================
Definition at line 2080 of file ps_emitter.cpp. References NL3D::CPSEmitter::_EmitDelay, NL3D::CParticleSystemProcess::getOwner(), and NL3D::CParticleSystem::systemDurationChanged().
02081 { 02082 _EmitDelay = delay; 02083 if (_Owner && _Owner->getOwner()) 02084 { 02085 _Owner->getOwner()->systemDurationChanged(); 02086 } 02087 } |
|
========================================================================== Set the type of located to be emitted. The default is NULL which mean that no emission will occur
Definition at line 361 of file ps_emitter.cpp. References NL3D::CPSEmitter::_EmittedType, NL3D::CParticleSystem::canFinish(), NL3D::CParticleSystem::getBypassMaxNumIntegrationSteps(), NL3D::CParticleSystemProcess::getOwner(), nlwarning, NL3D::CPSLocated::registerDtorObserver(), NL3D::CParticleSystem::systemDurationChanged(), and NL3D::CPSLocated::unregisterDtorObserver(). Referenced by NL3D::CPSEmitter::notifyTargetRemoved(), NL3D::CPSEmitter::releaseAllRef(), and NL3D::CPSEmitter::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 } |
|
set a constant speed modulation for emittee
Definition at line 396 of file ps_emitter.h. References NL3D::CPSModulatedEmitter::_EmitteeSpeed, and NL3D::CPSModulatedEmitter::_EmitteeSpeedScheme.
00397 { 00398 delete _EmitteeSpeedScheme; 00399 _EmitteeSpeedScheme = NULL; 00400 _EmitteeSpeed = speed; 00401 00402 } |
|
Set a new scheme for speed modulation. It must have been allocated with new, and will be destriyed by this object Definition at line 387 of file ps_emitter.h. References NL3D::CPSModulatedEmitter::_EmitteeSpeedScheme, NL3D::CPSModulatedEmitter::getModulatedEmitterOwner(), and NL3D::CPSAttribMaker< T >::resize().
00388 { 00389 delete _EmitteeSpeedScheme; 00390 _EmitteeSpeedScheme = scheme; 00391 if (getModulatedEmitterOwner() && scheme->hasMemory()) 00392 scheme->resize(getModulatedEmitterOwner()->getMaxSize(), getModulatedEmitterOwner()->getSize()); 00393 } |
|
*************************************************************************************** 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 } |
|
========================================================================== 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 NL3D::CPSEmitter::_GenNb, NL3D::CPSEmitter::_GenNbScheme, and uint32.
00429 { 00430 if (_GenNbScheme) 00431 { 00432 delete _GenNbScheme; 00433 _GenNbScheme = NULL; 00434 } 00435 _GenNb = genNb; 00436 } |
|
==========================================================================
Definition at line 439 of file ps_emitter.cpp. References NL3D::CPSEmitter::_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 } |
|
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; } |
|
========================================================================== 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
Definition at line 2090 of file ps_emitter.cpp. References NL3D::CPSEmitter::_MaxEmissionCount, count, NL3D::CParticleSystem::getBypassMaxNumIntegrationSteps(), NL3D::CParticleSystemProcess::getOwner(), nlassert, nlwarning, NL3D::CParticleSystem::systemDurationChanged(), NL3D::CPSEmitter::testEmitForever(), uint8, and NL3D::CPSEmitter::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 } |
|
set the located bindable name (edition purpose)
Definition at line 946 of file ps_located.h.
00946 { _Name = name; } |
|
==========================================================================
Reimplemented from NL3D::CPSLocatedBindable. Definition at line 111 of file ps_emitter.cpp. References NL3D::CPSEmitter::updateMaxCountVect().
00112 { 00113 CPSLocatedBindable::setOwner(psl); 00114 updateMaxCountVect(); 00115 } |
|
========================================================================== 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 NL3D::CPSEmitter::_Period, NL3D::CPSEmitter::_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 } |
|
==========================================================================
Definition at line 416 of file ps_emitter.cpp. References NL3D::CPSEmitter::_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 } |
|
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 NL3D::CPSEmitter::_SpeedInheritanceFactor.
00185 { 00186 _SpeedInheritanceFactor = fact; 00187 } |
|
|
=============================================================================== 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 NL3D::CPSEmitter::_UserDirectionMatrixMode, NL3D::CPSEmitter::isUserMatrixUsed(), and NL3D::CPSEmitter::updatePSRefCountForUserMatrixUsage().
02610 { 02611 bool wasUserMatNeeded = isUserMatrixUsed(); 02612 _UserDirectionMatrixMode = matrixMode; 02613 updatePSRefCountForUserMatrixUsage(isUserMatrixUsed(), wasUserMatNeeded); 02614 } |
|
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 {} |
|
==========================================================================
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 NL3D::CPSEmitter::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 } |
|
==========================================================================
Definition at line 490 of file ps_emitter.cpp. References NL3D::CPSEmitter::_GenNb, NL3D::CPSEmitter::_GenNbScheme, NL3D::CPSAttribMaker< uint32 >::get(), index, nlassert, NL3D::CPSEmitter::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 } |
|
========================================================================== 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 NL3D::CPSEmitter::_BypassAutoLOD, NL3D::CPSEmitter::_ConsistentEmission, NL3D::CPSEmitter::_EmissionType, NL3D::CPSEmitter::_EmittedType, NL3D::CPSEmitter::_GenNb, NL3D::CPSEmitter::_GenNbScheme, NL3D::CPSEmitter::_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, NL3D::CPSEmitter::processEmit(), NL3D::CPSEmitter::processRegularEmission(), NL3D::CPSEmitter::processRegularEmissionConsistent(), NL3D::CPSEmitter::processRegularEmissionConsistentWithNoLOD(), NL3D::CPSEmitter::processRegularEmissionWithNoLOD(), NL3D::PSEmit, NL3D::PSToolRender, NL3D::CPSEmitter::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 } |
|
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 {} |
|
========================================================================== 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 NL3D::CPSEmitter::getEmissionType(), NL3D::CPSLocated::getLastForever(), NL3D::CPSEmitter::getMaxEmissionCount(), nlassert, and nlwarning. Referenced by NL3D::CParticleSystem::canFinish(), NL3D::CPSEmitter::setEmissionType(), and NL3D::CPSEmitter::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 } |
|
==========================================================================
Definition at line 2059 of file ps_emitter.cpp. References NL3D::CPSEmitter::_MaxEmissionCount, NL3D::CPSEmitter::_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 NL3D::CPSEmitter::setMaxEmissionCount(), and NL3D::CPSEmitter::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 } |
|
========================================================================== 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 NL3D::CPSEmitter::enableSpeedBasisEmission(), NL3D::CPSEmitter::enableUserMatrixModeForEmissionDirection(), and NL3D::CPSEmitter::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 } |
|
check wether a speed modulation scheme is being used
Definition at line 414 of file ps_emitter.h. References NL3D::CPSModulatedEmitter::_EmitteeSpeedScheme.
00414 { return _EmitteeSpeedScheme != NULL; } |
|
Indicate whether a GenNb scheme is used or not.
Definition at line 165 of file ps_emitter.h. References NL3D::CPSEmitter::_GenNbScheme.
00165 { return _GenNbScheme != NULL; } |
|
Indicate whether a period scheme is used or not.
Definition at line 129 of file ps_emitter.h. References NL3D::CPSEmitter::_PeriodScheme.
00129 { return _PeriodScheme != NULL; } |
|
Reimplemented in NL3D::CPSForce. Definition at line 986 of file ps_located.h. |
|
Definition at line 1033 of file ps_located.h. Referenced by NL3D::CPSLocatedBindable::isActive(), and NL3D::CPSLocatedBindable::setActive(). |
|
Definition at line 356 of file ps_emitter.h. Referenced by NL3D::CPSEmitter::getBypassAutoLOD(), NL3D::CPSEmitter::setBypassAutoLOD(), and NL3D::CPSEmitter::step(). |
|
Definition at line 42 of file ps_emitter.cpp. Referenced by NL3D::CPSEmitter::deleteElement(), and NL3D::CPSEmitter::setBypassEmitOnDeath(). |
|
Definition at line 355 of file ps_emitter.h. Referenced by NL3D::CPSEmitter::enableConsistenEmission(), NL3D::CPSEmitter::isConsistentEmissionEnabled(), and NL3D::CPSEmitter::step(). |
|
Definition at line 347 of file ps_emitter.h. Referenced by NL3D::CPSEmitter::bounceOccured(), NL3D::CPSEmitter::deleteElement(), NL3D::CPSEmitter::getEmissionType(), NL3D::CPSEmitter::setEmissionType(), and NL3D::CPSEmitter::step(). |
|
|
|
Definition at line 440 of file ps_emitter.h. Referenced by NL3D::CPSModulatedEmitter::CPSModulatedEmitter(), NL3D::CPSModulatedEmitter::getEmitteeSpeed(), and NL3D::CPSModulatedEmitter::setEmitteeSpeed(). |
|
|
Definition at line 1027 of file ps_located.h. Referenced by NL3D::CPSLocatedBindable::getExternID(), NL3D::CPSLocatedBindable::setExternID(), and NL3D::CPSLocatedBindable::~CPSLocatedBindable(). |
|
|
|
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(). |
|
|
Definition at line 1031 of file ps_located.h. |
|
|
|
|
|
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 NL3D::CPSEmitter::deleteElement(), NL3D::CPSEmitter::newElement(), NL3D::CPSEmitter::processRegularEmission(), NL3D::CPSEmitter::processRegularEmissionConsistent(), NL3D::CPSEmitter::processRegularEmissionConsistentWithNoLOD(), NL3D::CPSEmitter::processRegularEmissionWithNoLOD(), NL3D::CPSEmitter::resize(), and NL3D::CPSEmitter::step(). |
|
Definition at line 354 of file ps_emitter.h. Referenced by NL3D::CPSEmitter::enableSpeedBasisEmission(), NL3D::CPSEmitter::isSpeedBasisEmissionEnabled(), NL3D::CPSEmitter::isUserMatrixUsed(), NL3D::CPSEmitter::processEmit(), and NL3D::CPSEmitter::processEmitConsistent(). |
|
Definition at line 346 of file ps_emitter.h. Referenced by NL3D::CPSEmitter::getSpeedInheritanceFactor(), NL3D::CPSEmitter::processEmit(), NL3D::CPSEmitter::processEmitConsistent(), and NL3D::CPSEmitter::setSpeedInheritanceFactor(). |
|
|