#include <ps_located.h>
Inheritance diagram for NL3D::CPSLocated:

Definition at line 130 of file ps_located.h.
Public Types | |
| typedef CPSAttrib< CParametricInfo > | TPSAttribParametricInfo |
| WARNING : private use by forces only. | |
Public Member Functions | |
| void | addNonIntegrableForceRef (void) |
| *************************************************************************************** | |
| bool | bind (CPSLocatedBindable *lb) |
| *************************************************************************************** | |
| void | collisionUpdate (const CPSCollisionInfo &ci, uint32 index) |
| bool | computeBBox (NLMISC::CAABBox &aabbox) const |
| *************************************************************************************** | |
| NLMISC::CVector | computeI (void) const |
| *************************************************************************************** | |
| NLMISC::CVector | computeJ (void) const |
| *************************************************************************************** | |
| NLMISC::CVector | computeK (void) const |
| *************************************************************************************** | |
| CPSLocated () | |
| *************************************************************************************** | |
| void | deleteElement (uint32 index) |
| *************************************************************************************** | |
| void | enableParametricMotion (bool enable=true) |
| *************************************************************************************** | |
| void | enableTriggerOnDeath (bool enable=true) |
| Enable a trigger on death. It is used to create emission on an emitter with a given ID. | |
| virtual void | enumTexs (std::vector< NLMISC::CSmartPtr< ITexture > > &dest, IDriver &drv) |
| *************************************************************************************** | |
| float | evalMaxDuration () const |
| *************************************************************************************** | |
| void | forceLODDegradation (bool enable=true) |
| CPSLocatedBindable * | getBoundObject (uint32 index) |
| const CPSLocatedBindable * | getBoundObject (uint32 index) const |
| virtual std::string | getClassName ()=0 |
| const TPSAttribCollisionInfo & | getCollisionInfo (void) const |
| get a const ref to the collision infos | |
| TPSAttribCollisionInfo & | getCollisionInfo (void) |
| get a ref to the collision infos | |
| IDriver * | getDriver () const |
| *************************************************************************************** | |
| uint32 | getFrameRate (void) const |
| uint | getIndexOf (const CPSLocatedBindable *lb) const |
| *************************************************************************************** | |
| TAnimationTime | getInitialLife (void) const |
| get the life of created particles (valid if they have a limited life time) | |
| float | getInitialMass (void) const |
| get the mass of created particle | |
| const TPSAttribFloat & | getInvMass (void) const |
| get mass inverse attrib const ref | |
| TPSAttribFloat & | getInvMass (void) |
| get mass inverse attrib ref | |
| bool | getLastForever (void) const |
| retrieve immortality for locateds | |
| const CPSAttribMaker< float > * | getLifeScheme (void) const |
| CPSAttribMaker< float > * | getLifeScheme (void) |
| get the life scheme of created particle, null if none (valid if they have a limited life time) | |
| const NLMISC::CMatrix & | getLocalToWorldMatrix () const |
| void | getLODVect (NLMISC::CVector &v, float &offset, TPSMatrixMode matrixMode) |
| *************************************************************************************** | |
| const CPSAttribMaker< float > * | getMassScheme (void) const |
| CPSAttribMaker< float > * | getMassScheme (void) |
| get the scheme that compute mass of created particles, null if none | |
| TPSMatrixMode | getMatrixMode () const |
| uint32 | getMaxSize (void) const |
| std::string | getName (void) const |
| get the located bindable name (edition purpose) | |
| uint32 | getNbBoundObjects (void) const |
| uint32 | getNewElementIndex (void) const |
| const CParticleSystem * | getOwner (void) const |
| retrieve the particle system that owns this process (const version) | |
| CParticleSystem * | getOwner (void) |
| Retrieve the particle system that owns this process. | |
| TPSAttribParametricInfo & | getParametricInfos () |
| PRIVATE USE : access to parametric infos. | |
| const TPSAttribVector & | getPos (void) const |
| get Pos attrib const ref | |
| TPSAttribVector & | getPos (void) |
| get Pos attrib ref | |
| CScene * | getScene (void) |
| *************************************************************************************** | |
| uint32 | getSize (void) const |
| get the current number of instance in this located container | |
| const TPSAttribVector & | getSpeed (void) const |
| get Speed attrib const ref | |
| TPSAttribVector & | getSpeed (void) |
| get Speed attrib ref | |
| const TPSAttribTime & | getTime (void) const |
| get Time attrib const ref | |
| TPSAttribTime & | getTime (void) |
| get Time attrib ref | |
| const TPSAttribTime & | getTimeIncrement (void) const |
| get TotalTime attrib const ref | |
| TPSAttribTime & | getTimeIncrement (void) |
| get TotalTime attrib ref | |
| uint32 | getTriggerEmitterID (void) const |
| Get the ID for the emitter to be triggered on death. | |
| virtual uint | getUserMatrixUsageCount () const |
| *************************************************************************************** | |
| float | getUserParam (uint numParam) const |
| *************************************************************************************** | |
| const NLMISC::CMatrix & | getWorldToLocalMatrix () const |
| bool | hasCollisionInfos () const |
| test wether this located has collision infos | |
| virtual bool | hasEmitters (void) const |
| tells wether there are alive emitters / particles in the system | |
| bool | hasLODDegradation (void) const |
| virtual bool | hasParticles (void) const |
| tells wether there are alive entities / particles in the system | |
| void | incrementNbDrawnParticles (uint num) |
| *************************************************************************************** | |
| void | integrableForceBasisChanged (TPSMatrixMode basis) |
| *************************************************************************************** | |
| void | integrateSingle (float startDate, float deltaT, uint numStep, uint32 indexInLocated, NLMISC::CVector *destPos, uint posStride=sizeof(NLMISC::CVector)) |
| *************************************************************************************** | |
| bool | isBound (const CPSLocatedBindable *lb) const |
| *************************************************************************************** | |
| virtual bool | isLocated () const |
| bool | isParametricMotionEnabled (void) const |
| test wether parametric motion is enabled | |
| bool | isTriggerOnDeathEnabled (void) const |
| Test wether a trigger on death has been enabled. | |
| sint32 | newElement (const NLMISC::CVector &pos, const NLMISC::CVector &speed, CPSLocated *emitterLocated, uint32 indexInEmitter, TPSMatrixMode speedCoordSystem, TAnimationTime ellapsedTime) |
| *************************************************************************************** | |
| NLMISC_DECLARE_CLASS (CPSLocated) | |
| void | notifyMaxNumFacesChanged (void) |
| *************************************************************************************** | |
| virtual void | performParametricMotion (TAnimationTime date, TAnimationTime ellapsedTime, TAnimationTime realEllapsedTime) |
| *************************************************************************************** | |
| virtual uint | querryMaxWantedNumFaces (void) |
| *************************************************************************************** | |
| void | queryCollisionInfo (void) |
| *************************************************************************************** | |
| void | registerDtorObserver (CPSLocatedBindable *observer) |
| *************************************************************************************** | |
| void | registerIntegrableForce (CPSForce *f) |
| *************************************************************************************** | |
| virtual void | releaseAllRef () |
| *************************************************************************************** | |
| void | releaseCollisionInfo (void) |
| *************************************************************************************** | |
| void | releaseNonIntegrableForceRef (void) |
| *************************************************************************************** | |
| virtual void | releaseRefTo (const CParticleSystemProcess *other) |
| *************************************************************************************** | |
| void | remove (const CPSLocatedBindable *lb) |
| *************************************************************************************** | |
| void | resize (uint32 newSize) |
| void | serial (NLMISC::IStream &f) throw (NLMISC::EStream) |
| *************************************************************************************** | |
| void | setFrameRate (uint32 nbFramesToSkip=0) |
| void | setInitialLife (TAnimationTime lifeTime) |
| *************************************************************************************** | |
| void | setInitialMass (float mass) |
| *************************************************************************************** | |
| bool | setLastForever () |
| *************************************************************************************** | |
| void | setLifeScheme (CPSAttribMaker< float > *scheme) |
| *************************************************************************************** | |
| void | setMassScheme (CPSAttribMaker< float > *scheme) |
| *************************************************************************************** | |
| virtual void | setMatrixMode (TPSMatrixMode matrixMode) |
| *************************************************************************************** | |
| void | setName (const std::string &name) |
| set the located bindable name (edition purpose) | |
| void | setOwner (CParticleSystem *ps) |
| Set the process owner. Called by the particle system during attachment. | |
| void | setTriggerEmitterID (uint32 id) |
| Set an ID for the emitter to be triggered on death. | |
| void | setupDriverModelMatrix (void) |
| Setup the driver model matrix. It is set accrodingly to the basis of the located. | |
| virtual void | setZBias (float value) |
| *************************************************************************************** | |
| virtual void | step (TPSProcessPass pass, TAnimationTime ellapsedTime, TAnimationTime realEt) |
| *************************************************************************************** | |
| bool | supportParametricMotion (void) const |
| Test wether this located support parametric motion. | |
| virtual void | systemDateChanged () |
| *************************************************************************************** | |
| CPSLocatedBindable * | unbind (uint index) |
| *************************************************************************************** | |
| void | unregisterDtorObserver (CPSLocatedBindable *anObserver) |
| *************************************************************************************** | |
| void | unregisterIntegrableForce (CPSForce *f) |
| *************************************************************************************** | |
| virtual void | updateLife (TAnimationTime ellapsedTime) |
| *************************************************************************************** | |
| virtual | ~CPSLocated () |
| dtor | |
Useful methods for edition | |
| const CFontGenerator * | getFontGenerator (void) const |
| Shortcut to get a font generator if one was set, const version (edition mode). | |
| CFontGenerator * | getFontGenerator (void) |
| Shortcut to get a font generator if one was set (edition mode). | |
| const CFontManager * | getFontManager (void) const |
| Shortcut to get a font Manager if one was set, const version (edition mode). | |
| CFontManager * | getFontManager (void) |
| Shortcut to get a font Manager if one was set (edition mode). | |
Useful methods for edition | |
| const CFontGenerator * | getFontGenerator (void) const |
| Shortcut to get a font generator if one was set, const version (edition mode). | |
| CFontGenerator * | getFontGenerator (void) |
| Shortcut to get a font generator if one was set (edition mode). | |
| const CFontManager * | getFontManager (void) const |
| Shortcut to get a font Manager if one was set, const version (edition mode). | |
| CFontManager * | getFontManager (void) |
| Shortcut to get a font Manager if one was set (edition mode). | |
Static Public Member Functions | |
| const NLMISC::CMatrix & | getConversionMatrix (const CPSLocated *A, const CPSLocated *B) |
| const NLMISC::CMatrix & | getConversionMatrix (const CParticleSystem &ps, TPSMatrixMode to, TPSMatrixMode from) |
Data Fields | |
| CPSAttrib< CParametricInfo > | _PInfo |
Protected Types | |
| typedef CPSVector< CPSLocatedBindable * >::V | TDtorObserversVect |
| typedef CPSVector< CPSForce * >::V | TForceVect |
| a vector of integrable forces that apply on this located | |
| typedef CPSVector< CPSLocatedBindable * >::V | TLocatedBoundCont |
| typedef std::stack< CPostNewElementRequestInfo > | TNewElementRequestStack |
Protected Member Functions | |
| void | allocateParametricInfos (void) |
| allocate parametric infos | |
| void | checkIntegrity () const |
| *************************************************************************************** | |
| void | notifyMotionTypeChanged (void) |
| *************************************************************************************** | |
| void | postNewElement (const NLMISC::CVector &pos=NLMISC::CVector::Null, const NLMISC::CVector &speed=NLMISC::CVector::Null) |
| *************************************************************************************** | |
| void | releaseParametricInfos (void) |
| release paametric infos | |
| void | resetCollisionInfo (void) |
| *************************************************************************************** | |
| void | updateNewElementRequestStack (void) |
| *************************************************************************************** | |
Protected Attributes | |
| TPSAttribCollisionInfo * | _CollisionInfo |
| uint32 | _CollisionInfoNbRef |
| TDtorObserversVect | _DtorObserversVect |
| float | _InitialLife |
| float | _InitialMass |
| TForceVect | _IntegrableForces |
| TPSAttribFloat | _InvMass |
| bool | _LastForever |
| CPSAttribMaker< float > * | _LifeScheme |
| TLocatedBoundCont | _LocatedBoundCont |
| bool | _LODDegradation |
| true when LOD degradation apply to this located | |
| CPSAttribMaker< float > * | _MassScheme |
| TPSMatrixMode | _MatrixMode |
| uint32 | _MaxNumFaces |
| cache the max number of faces this located may want | |
| uint32 | _MaxSize |
| std::string | _Name |
| uint32 | _NbFramesToSkip |
| uint16 | _NonIntegrableForceNbRefs |
| uint16 | _NumIntegrableForceWithDifferentBasis |
| number of forces that apply on that located that have the same basis that this one (required for parametric animation) | |
| CParticleSystem * | _Owner |
| bool | _ParametricMotion |
| When set to true, this tells the system to use parametric motion. Only parametric forces must have been applied. | |
| TPSAttribVector | _Pos |
| TNewElementRequestStack | _RequestStack |
| this stack is used after each update to generate located | |
| uint32 | _Size |
| TPSAttribVector | _Speed |
| TPSAttribTime | _Time |
| TPSAttribTime | _TimeIncrement |
| uint32 | _TriggerID |
| bool | _TriggerOnDeath |
| bool | _UpdateLock |
Friends | |
| class | CPSForce |
|
|
Definition at line 722 of file ps_located.h. Referenced by releaseAllRef(), and ~CPSLocated(). |
|
|
a vector of integrable forces that apply on this located
Definition at line 735 of file ps_located.h. |
|
|
Definition at line 600 of file ps_located.h. |
|
|
Definition at line 690 of file ps_located.h. Referenced by serial(). |
|
|
WARNING : private use by forces only.
Definition at line 645 of file ps_located.h. Referenced by getParametricInfos(). |
|
|
*************************************************************************************** Constructor Definition at line 68 of file ps_located.cpp. References NL3D::DefaultMaxLocatedInstance, and uint32.
00068 : _MaxNumFaces(0), 00069 _Name(std::string("located")), 00070 _NbFramesToSkip(0), 00071 _MaxSize(DefaultMaxLocatedInstance), 00072 _Size(0), 00073 _LastForever(true), 00074 _CollisionInfo(NULL), 00075 _CollisionInfoNbRef(0), 00076 _InitialLife(1.f), 00077 _LifeScheme(NULL), 00078 _InitialMass(1.f), 00079 _MassScheme(NULL), 00080 _UpdateLock(false), 00081 _LODDegradation(false), 00082 _NonIntegrableForceNbRefs(0), 00083 _NumIntegrableForceWithDifferentBasis(0), 00084 _TriggerOnDeath(false), 00085 _TriggerID((uint32) 'NONE'), 00086 _ParametricMotion(false) 00087 { 00088 } |
|
|
dtor
Definition at line 715 of file ps_located.cpp. References _CollisionInfo, _CollisionInfoNbRef, _DtorObserversVect, _IntegrableForces, _LifeScheme, _LocatedBoundCont, _MassScheme, _NonIntegrableForceNbRefs, CHECK_PS_INTEGRITY, nlassert, and TDtorObserversVect.
00716 {
00717 CHECK_PS_INTEGRITY
00718 // we must do a copy, because the subsequent call can modify this vector
00719 TDtorObserversVect copyVect(_DtorObserversVect.begin(), _DtorObserversVect.end());
00720 // call all the dtor observers
00721 for (TDtorObserversVect::iterator it = copyVect.begin(); it != copyVect.end(); ++it)
00722 {
00723 (*it)->notifyTargetRemoved(this);
00724 }
00725
00726 nlassert(_CollisionInfoNbRef == 0); //If this is not = 0, then someone didnt call releaseCollisionInfo
00727 // If this happen, you can register with the registerDTorObserver
00728 // (observer pattern)
00729 // and override notifyTargetRemove to call releaseCollisionInfo
00730 nlassert(_IntegrableForces.size() == 0);
00731 nlassert(_NonIntegrableForceNbRefs == 0);
00732 nlassert(!_CollisionInfo);
00733
00734 // delete all bindable
00735 for (TLocatedBoundCont::iterator it2 = _LocatedBoundCont.begin(); it2 != _LocatedBoundCont.end(); ++it2)
00736 {
00737 (*it2)->finalize();
00738 delete *it2;
00739 }
00740
00741
00742 delete _LifeScheme;
00743 delete _MassScheme;
00744 CHECK_PS_INTEGRITY
00745 }
|
|
|
***************************************************************************************
Definition at line 1866 of file ps_located.cpp. References _NonIntegrableForceNbRefs, CHECK_PS_INTEGRITY, and releaseParametricInfos(). Referenced by NL3D::CPSZone::attachTarget(), and NL3D::CPSForce::attachTarget().
01867 {
01868 CHECK_PS_INTEGRITY
01869 ++_NonIntegrableForceNbRefs;
01870 releaseParametricInfos();
01871 CHECK_PS_INTEGRITY
01872 }
|
|
|
allocate parametric infos
Definition at line 341 of file ps_located.cpp. References _ParametricMotion, _PInfo, NL3D::CPSAttrib< T >::begin(), CHECK_PS_INTEGRITY, NL3D::CPSAttrib< T >::end(), NL3D::CParticleSystem::getSystemDate(), NL3D::CPSAttrib< CParametricInfo >::insert(), nlassert, notifyMotionTypeChanged(), NL3D::CPSAttrib< CParametricInfo >::resize(), and supportParametricMotion(). Referenced by enableParametricMotion().
00342 {
00343 CHECK_PS_INTEGRITY
00344 if (_ParametricMotion) return;
00345 nlassert(supportParametricMotion());
00346 nlassert(_Owner);
00347 const float date = _Owner->getSystemDate();
00348 _PInfo.resize(_MaxSize);
00349 // copy back infos from current position and speeds
00350 TPSAttribVector::const_iterator posIt = _Pos.begin(), endPosIt = _Pos.end();
00351 TPSAttribVector::const_iterator speedIt = _Speed.begin();
00352 while (posIt != endPosIt)
00353 {
00354 _PInfo.insert( CParametricInfo(*posIt, *speedIt, date) );
00355 ++posIt;
00356 }
00357 _ParametricMotion = true;
00358 notifyMotionTypeChanged();
00359 CHECK_PS_INTEGRITY
00360 }
|
|
|
*************************************************************************************** attach a bindable object to this located, such as a force or a particle a bindable must be attached only once (-> nlassert) The bindable is then owned by the system and will be deleted by it.
Definition at line 751 of file ps_located.cpp. References _LocatedBoundCont, _ParametricMotion, NL3D::CParticleSystem::canFinish(), CHECK_PS_INTEGRITY, NL3D::CParticleSystem::getBypassMaxNumIntegrationSteps(), NL3D::CPSLocatedBindable::getExternID(), getIndexOf(), NL3D::CPSLocatedBindable::motionTypeChanged(), NL3D::CPSLocatedBindable::newElement(), nlassert, nlwarning, notifyMaxNumFacesChanged(), NL3D::CParticleSystem::registerLocatedBindableExternID(), NL3D::CPSLocatedBindable::resize(), NL3D::CPSLocatedBindable::setOwner(), NL3D::CParticleSystem::systemDurationChanged(), uint, uint32, and unbind().
00752 {
00753 CHECK_PS_INTEGRITY
00754 nlassert(std::find(_LocatedBoundCont.begin(), _LocatedBoundCont.end(), lb) == _LocatedBoundCont.end());
00755 TLocatedBoundCont::iterator it = _LocatedBoundCont.begin();
00756 while (it != _LocatedBoundCont.end() && **it < *lb) // the "<" operator sort them correctly
00757 {
00758 ++it;
00759 }
00760
00761 _LocatedBoundCont.insert(it, lb);
00762 lb->setOwner(this);
00763 lb->resize(_MaxSize);
00764
00765 // any located bindable that is bound to us should have no element in it for now !!
00766 // we resize it anyway...
00767
00768 uint32 initialSize = _Size;
00769 for (uint k = 0; k < initialSize; ++k)
00770 {
00771 _Size = k;
00772 lb->newElement(NULL, 0);
00773 }
00774 _Size = initialSize;
00775
00776
00777 if (_ParametricMotion) lb->motionTypeChanged(true);
00778
00780 notifyMaxNumFacesChanged();
00781
00782 if (_Owner)
00783 {
00784 CParticleSystem *ps = _Owner;
00785 if (ps->getBypassMaxNumIntegrationSteps())
00786 {
00787 if (!ps->canFinish())
00788 {
00789 unbind(getIndexOf(lb));
00790 nlwarning("<CPSLocated::bind> Can't bind the located : this causes the system to last forever, and it has been flagged with 'BypassMaxNumIntegrationSteps'. Located is not bound.");
00791 return false;
00792 }
00793 }
00794 // if there's an extern id, register in lb list
00795 if (lb->getExternID() != 0)
00796 {
00797 // register in ID list
00798 ps->registerLocatedBindableExternID(lb->getExternID(), lb);
00799 }
00800 _Owner->systemDurationChanged();
00801 }
00802
00803 CHECK_PS_INTEGRITY
00804 return true;
00805 }
|
|
|
***************************************************************************************
Definition at line 133 of file ps_located.cpp. References _CollisionInfo, _InvMass, _TimeIncrement, NL3D::CPSAttrib< T >::getMaxSize(), NL3D::CPSAttrib< float >::getMaxSize(), NL3D::CPSAttrib< T >::getSize(), NL3D::CPSAttrib< float >::getSize(), and nlassert.
00134 {
00135 nlassert(_InvMass.getMaxSize() == _Pos.getMaxSize());
00136 nlassert(_Pos.getMaxSize() == _Speed.getMaxSize());
00137 nlassert(_Speed.getMaxSize() == _Time.getMaxSize());
00138 nlassert(_Time.getMaxSize() == _TimeIncrement.getMaxSize());
00139 //
00140 nlassert(_InvMass.getSize() == _Pos.getSize());
00141 nlassert(_Pos.getSize() == _Speed.getSize());
00142 nlassert(_Speed.getSize() == _Time.getSize());
00143 nlassert(_Time.getSize() == _TimeIncrement.getSize());
00144 //
00145 if (_CollisionInfo)
00146 {
00147 nlassert(_InvMass.getMaxSize() == _CollisionInfo->getMaxSize());
00148 nlassert(_InvMass.getSize() == _CollisionInfo->getSize());
00149 }
00150 }
|
|
||||||||||||
|
A collider must call this when a collision occurs If the collider was nearer that another one it will be taken in account the index of instance that collided Definition at line 784 of file ps_located.h. References _CollisionInfo, NL3D::CPSCollisionInfo::dist, index, nlassert, and uint32.
|
|
|
*************************************************************************************** Compute the aabbox of this located, (expressed in world basis
Implements NL3D::CParticleSystemProcess. Definition at line 1716 of file ps_located.cpp. References _LocatedBoundCont, CHECK_PS_INTEGRITY, NLMISC::CAABBox::computeAABBoxUnion(), NLMISC::CVector::maxof(), min, NLMISC::CAABBox::setMinMax(), and v.
01717 {
01718 CHECK_PS_INTEGRITY
01719 if (!_Size) return false; // something to compute ?
01720
01721
01722 TLocatedBoundCont::const_iterator it;
01723 TPSAttribVector::const_iterator it2;
01724
01725 // check whether any object bound to us need a bbox
01726
01727 for (it = _LocatedBoundCont.begin(); it != _LocatedBoundCont.end(); ++it)
01728 {
01729 if ((*it)->doesProduceBBox())
01730 {
01731 break;
01732 }
01733 }
01734
01735 if (it == _LocatedBoundCont.end())
01736 {
01737 return false;
01738 }
01739
01740 CVector min = _Pos[0], max = _Pos[0];
01741
01742 for (it2 = _Pos.begin(); it2 != _Pos.end(); ++ it2)
01743 {
01744 const CVector &v = (*it2);
01745 min.minof(min, v);
01746 max.maxof(max, v);
01747 }
01748
01749 box.setMinMax(min, max);
01750
01751 // we've considered that located had no extent in space
01752 // now, we must call each objects that are bound to the located in order
01753 // to complete the bbox if they have no null extent
01754
01755 NLMISC::CAABBox tmpBox, startBox = box;
01756
01757 for (it = _LocatedBoundCont.begin(); it != _LocatedBoundCont.end(); ++it)
01758 {
01759 if ((*it)->doesProduceBBox())
01760 {
01761 tmpBox = startBox;
01762 if ((*it)->completeBBox(tmpBox))
01763 {
01764 box = NLMISC::CAABBox::computeAABBoxUnion(tmpBox, box);
01765 }
01766 }
01767 }
01768 CHECK_PS_INTEGRITY
01769 return true;
01770 }
|
|
|
*************************************************************************************** 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 612 of file ps_located.cpp. References CHECK_PS_INTEGRITY, NLMISC::CMatrix::getI(), NL3D::CParticleSystem::getInvertedViewMat(), NL3D::CParticleSystemProcess::getMatrixMode(), NL3D::CParticleSystem::getSysMat(), getWorldToLocalMatrix(), NLMISC::CMatrix::mulVector(), and NL3D::PSIdentityMatrix. Referenced by NL3D::CPSLocatedBindable::computeI(), and NL3D::CPSRibbonLookAt::displayRibbons().
00613 {
00614 CHECK_PS_INTEGRITY
00615 const NLMISC::CMatrix &sysMat = _Owner->getSysMat();
00616 if (getMatrixMode() == PSIdentityMatrix)
00617 {
00618 if (!sysMat.hasScalePart())
00619 {
00620 return _Owner->getInvertedViewMat().getI();
00621 }
00622 else
00623 {
00624 return sysMat.getScaleUniform() * _Owner->getInvertedViewMat().getI();
00625 }
00626 }
00627 else
00628 {
00629 if (!sysMat.hasScalePart())
00630 {
00631 // we must express the I vector in the system basis, so we need to multiply it by the inverted matrix of the system
00632 return getWorldToLocalMatrix().mulVector(_Owner->getInvertedViewMat().getI());
00633 }
00634 else
00635 {
00636 return sysMat.getScaleUniform() * getWorldToLocalMatrix().mulVector(_Owner->getInvertedViewMat().getI());
00637 }
00638 }
00639 CHECK_PS_INTEGRITY
00640 }
|
|
|
*************************************************************************************** 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 643 of file ps_located.cpp. References CHECK_PS_INTEGRITY, NL3D::CParticleSystem::getInvertedViewMat(), NLMISC::CMatrix::getJ(), NL3D::CParticleSystemProcess::getMatrixMode(), NL3D::CParticleSystem::getSysMat(), getWorldToLocalMatrix(), NLMISC::CMatrix::mulVector(), and NL3D::PSIdentityMatrix. Referenced by NL3D::CPSLocatedBindable::computeJ().
00644 {
00645 CHECK_PS_INTEGRITY
00646 const NLMISC::CMatrix &sysMat = _Owner->getSysMat();
00647 if (getMatrixMode() == PSIdentityMatrix)
00648 {
00649 if (!sysMat.hasScalePart())
00650 {
00651 return _Owner->getInvertedViewMat().getJ();
00652 }
00653 else
00654 {
00655 return sysMat.getScaleUniform() * _Owner->getInvertedViewMat().getJ();
00656 }
00657 }
00658 else
00659 {
00660 if (!sysMat.hasScalePart())
00661 {
00662 // we must express the J vector in the system basis, so we need to multiply it by the inverted matrix of the system
00663 return getWorldToLocalMatrix().mulVector(_Owner->getInvertedViewMat().getJ());
00664 }
00665 else
00666 {
00667 return sysMat.getScaleUniform() * getWorldToLocalMatrix().mulVector(_Owner->getInvertedViewMat().getJ());
00668 }
00669 }
00670 CHECK_PS_INTEGRITY
00671 }
|
|
|
*************************************************************************************** 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 674 of file ps_located.cpp. References CHECK_PS_INTEGRITY, NL3D::CParticleSystem::getInvertedViewMat(), NLMISC::CMatrix::getK(), NL3D::CParticleSystemProcess::getMatrixMode(), NL3D::CParticleSystem::getSysMat(), getWorldToLocalMatrix(), NLMISC::CMatrix::mulVector(), and NL3D::PSIdentityMatrix. Referenced by NL3D::CPSLocatedBindable::computeK(), and NL3D::CPSRibbonLookAt::displayRibbons().
00675 {
00676 CHECK_PS_INTEGRITY
00677 const NLMISC::CMatrix &sysMat = _Owner->getSysMat();
00678 if (getMatrixMode() == PSIdentityMatrix)
00679 {
00680 if (!sysMat.hasScalePart())
00681 {
00682 return _Owner->getInvertedViewMat().getK();
00683 }
00684 else
00685 {
00686 return sysMat.getScaleUniform() * _Owner->getInvertedViewMat().getK();
00687 }
00688 }
00689 else
00690 {
00691 if (!sysMat.hasScalePart())
00692 {
00693 // we must express the K vector in the system basis, so we need to multiply it by the inverted matrix of the system
00694 return getWorldToLocalMatrix().mulVector(_Owner->getInvertedViewMat().getK());
00695 }
00696 else
00697 {
00698 return sysMat.getScaleUniform() * getWorldToLocalMatrix().mulVector(_Owner->getInvertedViewMat().getK());
00699 }
00700 }
00701 CHECK_PS_INTEGRITY
00702 }
|
|
|
*************************************************************************************** Delete one located in the container not present -> nlassert Definition at line 1051 of file ps_located.cpp. References _CollisionInfo, _InvMass, _LocatedBoundCont, _ParametricMotion, _PInfo, _TimeIncrement, _TriggerID, _TriggerOnDeath, _UpdateLock, CHECK_PS_INTEGRITY, NL3D::CParticleSystem::getLocatedBindableByExternID(), NL3D::CParticleSystem::getNumLocatedBindableByExternID(), NL3D::CPSLocatedBindable::getOwner(), getSize(), NL3D::CPSLocatedBindable::getType(), NL3D::IDToLittleEndian(), index, nlassert, NL3D::PSEmitter, NL3D::CPSAttrib< CParametricInfo >::remove(), NL3D::CPSAttrib< T >::remove(), NL3D::CPSAttrib< float >::remove(), NL3D::CPSEmitter::singleEmit(), uint, and uint32. Referenced by NL3D::CompensateEmission(), NL3D::CParticleSystemInstanceUser::removeByID(), resize(), step(), and updateLife().
01052 {
01053 CHECK_PS_INTEGRITY
01054
01055 nlassert(index < _Size);
01056
01057 // delete all bindable before : they may need our coordinate
01058 // to perform a destruction task
01059
01060 _UpdateLock = true;
01061
01062
01063 for (TLocatedBoundCont::iterator it = _LocatedBoundCont.begin(); it != _LocatedBoundCont.end(); ++it)
01064 {
01065 (*it)->deleteElement(index);
01066 }
01067
01068
01069 _UpdateLock = false;
01070
01071 // remove common located's attributes
01072
01073 _InvMass.remove(index);
01074 _Pos.remove(index);
01075 _Speed.remove(index);
01076 _Time.remove(index);
01077 _TimeIncrement.remove(index);
01078
01079 if (_CollisionInfo)
01080 {
01081 _CollisionInfo->remove(index);
01082 }
01083
01084 if (_ParametricMotion)
01085 {
01086 _PInfo.remove(index);
01087 }
01088
01089 --_Size;
01090
01091 if (_TriggerOnDeath)
01092 {
01093 const uint32 id = IDToLittleEndian(_TriggerID);
01094 nlassert(_Owner);
01095 uint numLb = _Owner->getNumLocatedBindableByExternID(id);
01096 for (uint k = 0; k < numLb; ++k)
01097 {
01098 CPSLocatedBindable *lb = _Owner->getLocatedBindableByExternID(id, k);
01099 if (lb->getType() == PSEmitter)
01100 {
01101 CPSEmitter *e = NLMISC::safe_cast<CPSEmitter *>(lb);
01102 nlassert(e->getOwner());
01103 uint nbInstances = e->getOwner()->getSize();
01104 for (uint l = 0; l < nbInstances; ++l)
01105 {
01106 e->singleEmit(l, 1);
01107 }
01108 }
01109 }
01110 }
01111 CHECK_PS_INTEGRITY
01112 }
|
|
|
*************************************************************************************** When set to true, this tells the system to use parametric motion. This is needed in a few case only, and can only work if all the forces that apply to the system are integrable. An assertion happens otherwise Definition at line 385 of file ps_located.cpp. References allocateParametricInfos(), CHECK_PS_INTEGRITY, nlassert, releaseParametricInfos(), and supportParametricMotion().
00386 {
00387 CHECK_PS_INTEGRITY
00388 nlassert(supportParametricMotion());
00389 if (enable)
00390 {
00391 allocateParametricInfos();
00392 }
00393 else
00394 {
00395 releaseParametricInfos();
00396 }
00397 CHECK_PS_INTEGRITY
00398 }
|
|
|
Enable a trigger on death. It is used to create emission on an emitter with a given ID.
Definition at line 552 of file ps_located.h. References _TriggerOnDeath.
00552 { _TriggerOnDeath = enable; }
|
|
||||||||||||
|
***************************************************************************************
Implements NL3D::CParticleSystemProcess. Definition at line 2295 of file ps_located.cpp. References _LocatedBoundCont.
02296 {
02297 for(TLocatedBoundCont::const_iterator it = _LocatedBoundCont.begin(); it != _LocatedBoundCont.end(); ++it)
02298 {
02299 (*it)->enumTexs(dest, drv);
02300 }
02301 }
|
|
|
*************************************************************************************** eval max duration of the located (if no scheme is used, this is the lifetime) nb : return -1 if located last for ever Definition at line 125 of file ps_located.cpp. References _InitialLife, _LastForever, _LifeScheme, and NL3D::CPSAttribMaker< float >::getMaxValue(). Referenced by NL3D::CParticleSystem::evalDuration().
00126 {
00127 if (_LastForever) return -1.f;
00128 return _LifeScheme ? _LifeScheme->getMaxValue() : _InitialLife;
00129 }
|
|
|
Enable the to force LOD degradation. This will suppress instances immediately, (during the motion pass) so that there won't be more than maxNbInstance * dist / maxDist instances. This may not be desirable every time since particle dissapear on screen, which may be noticeable. Definition at line 509 of file ps_located.h. References _LODDegradation.
00509 { _LODDegradation = enable; }
|
|
|
get a pointer to a bound object Definition at line 209 of file ps_located.h. References _LocatedBoundCont, index, nlassert, and uint32.
00210 {
00211 nlassert(index < _LocatedBoundCont.size());
00212 return _LocatedBoundCont[index];
00213 }
|
|
|
get a pointer to a bound object (const version) Definition at line 199 of file ps_located.h. References _LocatedBoundCont, index, nlassert, and uint32. Referenced by NL3D::CParticleSystem::activateEmitters(), NL3D::CParticleSystem::canFinish(), NL3D::CPSEmitter::checkLoop(), NL3D::CParticleSystem::evalDuration(), NL3D::CParticleSystem::getCurrNumParticles(), NL3D::CParticleSystem::getMaxNumParticles(), NL3D::CParticleSystem::getTargeters(), NL3D::CParticleSystem::hasActiveEmitters(), NL3D::CParticleSystem::hasEmittersTemplates(), NL3D::CParticleSystem::hasLightableObjects(), NL3D::CParticleSystem::hasLoop(), NL3D::CParticleSystem::hasOpaqueObjects(), NL3D::CParticleSystem::hasTransparentObjects(), NL3D::CParticleSystem::reactivateSound(), and NL3D::CParticleSystem::stopSound().
00200 {
00201 nlassert(index < _LocatedBoundCont.size());
00202 return _LocatedBoundCont[index];
00203 }
|
|
|
Implemented in NLAIAGENT::CNumericIndex, NLAIC::IPointerGestion, NLAIC::CIdentType, and CAutomataDesc. Referenced by NLMISC::CClassRegistry::checkObject(), and NL3D::GetTextureSize(). |
|
|
get a const ref to the collision infos
Definition at line 445 of file ps_located.h. References _CollisionInfo, nlassert, and NL3D::TPSAttribCollisionInfo.
00446 {
00447 nlassert(_CollisionInfo);
00448 return *_CollisionInfo;
00449 }
|
|
|
get a ref to the collision infos
Definition at line 438 of file ps_located.h. References _CollisionInfo, nlassert, and NL3D::TPSAttribCollisionInfo. Referenced by NL3D::CompensateEmission().
00439 {
00440 nlassert(_CollisionInfo);
00441 return *_CollisionInfo;
00442 }
|
|
||||||||||||
|
get a matrix that helps to express located B coordinate in located A basis A and B must belong to the same system Definition at line 1133 of file ps_located.h. References NL3D::CParticleSystemProcess::_Owner, getConversionMatrix(), NL3D::CParticleSystemProcess::getMatrixMode(), and nlassert.
01134 {
01135 nlassert(A);
01136 nlassert(B);
01137 nlassert(A->_Owner == B->_Owner); // conversion must be made between entity of the same system
01138 const CParticleSystem *ps = A->_Owner;
01139 nlassert(ps);
01140 return getConversionMatrix(*ps, A->getMatrixMode(), B->getMatrixMode());
01141 }
|
|
||||||||||||||||
|
Definition at line 570 of file ps_located.cpp. References NL3D::CParticleSystem::getFXToUserMatrix(), NL3D::CParticleSystem::getInvertedSysMat(), NL3D::CParticleSystem::getInvertedUserMatrix(), NL3D::CParticleSystem::getSysMat(), NL3D::CParticleSystem::getUserMatrix(), NL3D::CParticleSystem::getUserToFXMatrix(), nlassert, NL3D::PSFXWorldMatrix, NL3D::PSIdentityMatrix, and NL3D::PSUserMatrix. Referenced by getConversionMatrix(), and newElement().
00571 {
00572 switch(destMode)
00573 {
00574 case PSFXWorldMatrix:
00575 switch(srcMode)
00576 {
00577 case PSFXWorldMatrix: return NLMISC::CMatrix::Identity;
00578 case PSIdentityMatrix: return ps.getInvertedSysMat();
00579 case PSUserMatrix: return ps.getUserToFXMatrix();
00580 default:
00581 nlassert(0);
00582 }
00583 break;
00584 case PSIdentityMatrix:
00585 switch(srcMode)
00586 {
00587 case PSFXWorldMatrix: return ps.getSysMat();
00588 case PSIdentityMatrix: return NLMISC::CMatrix::Identity;
00589 case PSUserMatrix: return ps.getUserMatrix();
00590 default:
00591 nlassert(0);
00592 }
00593 break;
00594 case PSUserMatrix:
00595 switch(srcMode)
00596 {
00597 case PSFXWorldMatrix: return ps.getFXToUserMatrix();
00598 case PSIdentityMatrix: return ps.getInvertedUserMatrix();
00599 case PSUserMatrix: return NLMISC::CMatrix::Identity;
00600 default:
00601 nlassert(0);
00602 }
00603 break;
00604 default:
00605 nlassert(0);
00606 }
00607 nlassert(0);
00608 return NLMISC::CMatrix::Identity;
00609 }
|
|
|
***************************************************************************************
Definition at line 705 of file ps_located.cpp. References CHECK_PS_INTEGRITY, NL3D::CParticleSystem::getDriver(), and nlassert. Referenced by NL3D::CPSLocatedBindable::getDriver(), and setupDriverModelMatrix().
00706 {
00707 CHECK_PS_INTEGRITY
00708 nlassert(_Owner);
00709 nlassert (_Owner->getDriver() ); // you haven't called setDriver on the system
00710 return _Owner->getDriver();
00711 }
|
|
|
Shortcut to get a font generator if one was set, const version (edition mode).
Definition at line 78 of file particle_system_process.cpp. References NL3D::CParticleSystem::getFontGenerator(), and nlassert.
|
|
|
Shortcut to get a font generator if one was set (edition mode).
Definition at line 71 of file particle_system_process.cpp. References NL3D::CParticleSystem::getFontGenerator(), and nlassert. Referenced by NL3D::CPSLocatedBindable::getFontGenerator().
|
|
|
Shortcut to get a font Manager if one was set, const version (edition mode).
Definition at line 92 of file particle_system_process.cpp. References NL3D::CParticleSystem::getFontManager(), and nlassert.
|
|
|
Shortcut to get a font Manager if one was set (edition mode).
Definition at line 85 of file particle_system_process.cpp. References NL3D::CParticleSystem::getFontManager(), and nlassert. Referenced by NL3D::CPSLocatedBindable::getFontManager().
|
|
|
Definition at line 382 of file ps_located.h. References _NbFramesToSkip, and uint32.
00382 { return _NbFramesToSkip; }
|
|
|
*************************************************************************************** Get the index of a located bindable that is bound to that object. If it isn't bound, an assertion is raised Definition at line 1923 of file ps_located.cpp. References _LocatedBoundCont, CHECK_PS_INTEGRITY, nlassert, and uint. Referenced by bind().
01924 {
01925 CHECK_PS_INTEGRITY
01926 for(uint k = 0; k < _LocatedBoundCont.size(); ++k)
01927 {
01928 if (_LocatedBoundCont[k] == lb) return k;
01929 }
01930 nlassert(0);
01931 return 0;
01932 }
|
|
|
get the life of created particles (valid if they have a limited life time)
Definition at line 292 of file ps_located.h. References _InitialLife, and NL3D::TAnimationTime. Referenced by NL3D::CompensateEmission().
00292 { return _InitialLife; }
|
|
|
get the mass of created particle
Definition at line 311 of file ps_located.h. References _InitialMass.
00311 { return _InitialMass; }
|
|
|
get mass inverse attrib const ref
Definition at line 331 of file ps_located.h. References _InvMass, and NL3D::TPSAttribFloat.
00331 { return _InvMass; }
|
|
|
get mass inverse attrib ref
Definition at line 329 of file ps_located.h. References _InvMass, and NL3D::TPSAttribFloat. Referenced by NL3D::CPSAttribMakerT< T, F >::get(), NL3D::CPSAttribMakerT< uint32, CPSValueBlendFunc< uint32 > >::make(), NL3D::CPSAttribMakerT< uint32, CPSValueBlendFunc< uint32 > >::make4(), and NL3D::CPSAttribMakerT< uint32, CPSValueBlendFunc< uint32 > >::makeN().
00329 { return _InvMass; }
|
|
|
retrieve immortality for locateds
Definition at line 326 of file ps_located.h. References _LastForever. Referenced by NL3D::CParticleSystem::canFinish(), NL3D::CompensateEmission(), NL3D::CParticleSystem::evalDuration(), NL3D::CPSAttribMakerT< uint32, CPSValueBlendFunc< uint32 > >::make(), NL3D::CPSAttribMakerT< uint32, CPSValueBlendFunc< uint32 > >::make4(), NL3D::CPSAttribMakerT< uint32, CPSValueBlendFunc< uint32 > >::makeN(), and NL3D::CPSEmitter::testEmitForever().
00326 { return _LastForever; }
|
|
|
Definition at line 296 of file ps_located.h. References _LifeScheme.
00296 { return _LifeScheme; }
|
|
|
get the life scheme of created particle, null if none (valid if they have a limited life time)
Definition at line 295 of file ps_located.h. References _LifeScheme. Referenced by NL3D::CompensateEmission().
00295 { return _LifeScheme; }
|
|
|
Definition at line 92 of file ps_located.cpp. References NL3D::CParticleSystemProcess::getMatrixMode(), NL3D::CParticleSystem::getSysMat(), NL3D::CParticleSystem::getUserMatrix(), nlassert, NL3D::PSFXWorldMatrix, NL3D::PSIdentityMatrix, and NL3D::PSUserMatrix. Referenced by NL3D::CPSFaceLookAtHelper::drawLookAt(), NL3D::CPSLocatedBindable::getLocalToWorldMatrix(), setupDriverModelMatrix(), and NL3D::CPSSound::step().
00093 {
00094 nlassert(_Owner);
00095 switch(getMatrixMode())
00096 {
00097 case PSFXWorldMatrix: return _Owner->getSysMat();
00098 case PSIdentityMatrix: return NLMISC::CMatrix::Identity;
00099 case PSUserMatrix: return _Owner->getUserMatrix();
00100 default:
00101 nlassert(0);
00102 }
00103 nlassert(0);
00104 return NLMISC::CMatrix::Identity;
00105 }
|
|
||||||||||||||||
|
***************************************************************************************
Definition at line 475 of file ps_located.cpp. References CHECK_PS_INTEGRITY, NL3D::CParticleSystem::getLODVect(), nlassert, offset, and v. Referenced by NL3D::CPSAttribMakerT< T, F >::get(), NL3D::CPSAttribMakerT< uint32, CPSValueBlendFunc< uint32 > >::make(), NL3D::CPSAttribMakerT< uint32, CPSValueBlendFunc< uint32 > >::make4(), and NL3D::CPSAttribMakerT< uint32, CPSValueBlendFunc< uint32 > >::makeN().
00476 {
00477 nlassert(_Owner);
00478 CHECK_PS_INTEGRITY
00479 _Owner->getLODVect(v, offset, matrixMode);
00480 CHECK_PS_INTEGRITY
00481 }
|
|
|
Definition at line 315 of file ps_located.h. References _MassScheme.
00315 { return _MassScheme; }
|
|
|
get the scheme that compute mass of created particles, null if none
Definition at line 314 of file ps_located.h. References _MassScheme.
00314 { return _MassScheme; }
|
|
|
|
|
get the located bindable name (edition purpose)
Definition at line 495 of file ps_located.h.
00495 { return _Name; }
|
|
|
|
Get the index of the new element that is created Valid only after the newElement method (overridable) of a LocatedBindable is called : you get the index of the located being generated, if you need its pos, speed, or mass. Definition at line 266 of file ps_located.h. References uint32. Referenced by NL3D::CPSRibbonBase::newElement(), NL3D::CPSConstraintMesh::newElement(), and NL3D::CPSFace::newElement().
00266 { return _Size; }
|
|
|
retrieve the particle system that owns this process (const version)
Definition at line 114 of file particle_system_process.h.
00114 { return _Owner ; }
|
|
|
|
PRIVATE USE : access to parametric infos.
Definition at line 772 of file ps_located.h. References _PInfo, and TPSAttribParametricInfo. Referenced by NL3D::CompensateEmission().
00772 { return _PInfo; }
|
|
|
get Pos attrib const ref
Definition at line 336 of file ps_located.h. References NL3D::TPSAttribVector.
00336 { return _Pos; }
|
|
|
|
***************************************************************************************
Definition at line 492 of file ps_located.cpp. References CHECK_PS_INTEGRITY, NL3D::CParticleSystem::getScene(), and nlassert. Referenced by NL3D::CPSMesh::deleteElement(), NL3D::CPSLight::deleteElement(), NL3D::CPSMesh::newElement(), NL3D::CPSMesh::releaseAllRef(), NL3D::CPSLight::releaseAllRef(), NL3D::CPSConstraintMesh::update(), NL3D::CPSMesh::updatePos(), and NL3D::CPSMesh::~CPSMesh().
00493 {
00494 nlassert(_Owner);
00495 CHECK_PS_INTEGRITY
00496 return _Owner->getScene();
00497 }
|
|
|
|
get Speed attrib const ref
Definition at line 341 of file ps_located.h. References NL3D::TPSAttribVector.
00341 { return _Speed; }
|
|
|
|
get Time attrib const ref
Definition at line 346 of file ps_located.h. References NL3D::TPSAttribTime.
00346 { return _Time; }
|
|
|
get Time attrib ref
Definition at line 344 of file ps_located.h. References NL3D::TPSAttribTime. Referenced by NL3D::CompensateEmission(), NL3D::CPSFanLight::draw(), NL3D::FillQuadCoordsLocalTime(), NL3D::CPSAttribMakerT< T, F >::get(), NL3D::CPSAttribMakerT< uint32, CPSValueBlendFunc< uint32 > >::make(), NL3D::CPSAttribMakerT< uint32, CPSValueBlendFunc< uint32 > >::make4(), and NL3D::CPSAttribMakerT< uint32, CPSValueBlendFunc< uint32 > >::makeN().
00344 { return _Time; }
|
|
|
get TotalTime attrib const ref
Definition at line 351 of file ps_located.h. References _TimeIncrement, and NL3D::TPSAttribTime.
00351 { return _TimeIncrement; }
|
|
|
get TotalTime attrib ref
Definition at line 349 of file ps_located.h. References _TimeIncrement, and NL3D::TPSAttribTime. Referenced by NL3D::CompensateEmission().
00349 { return _TimeIncrement; }
|
|
|
Get the ID for the emitter to be triggered on death.
Definition at line 565 of file ps_located.h. References _TriggerID, _TriggerOnDeath, nlassert, and uint32.
00566 {
00567 nlassert(_TriggerOnDeath);
00568 return _TriggerID;
00569 }
|
|
|
***************************************************************************************
Reimplemented from NL3D::CParticleSystemProcess. Definition at line 2284 of file ps_located.cpp. References _LocatedBoundCont, count, and uint.
02285 {
02286 uint count = 0;
02287 for(TLocatedBoundCont::const_iterator it = _LocatedBoundCont.begin(); it != _LocatedBoundCont.end(); ++it)
02288 {
02289 count += (*it)->getUserMatrixUsageCount();
02290 }
02291 return count + CParticleSystemProcess::getUserMatrixUsageCount();
02292 }
|
|
|
***************************************************************************************
Definition at line 484 of file ps_located.cpp. References CHECK_PS_INTEGRITY, NL3D::CParticleSystem::getUserParam(), nlassert, and uint. Referenced by NL3D::CPSAttribMakerT< T, F >::get(), NL3D::CPSAttribMakerT< uint32, CPSValueBlendFunc< uint32 > >::make(), NL3D::CPSAttribMakerT< uint32, CPSValueBlendFunc< uint32 > >::make4(), and NL3D::CPSAttribMakerT< uint32, CPSValueBlendFunc< uint32 > >::makeN().
00485 {
00486 nlassert(_Owner);
00487 CHECK_PS_INTEGRITY
00488 return _Owner->getUserParam(numParam);
00489 }
|
|
|
Definition at line 108 of file ps_located.cpp. References NL3D::CParticleSystem::getInvertedSysMat(), NL3D::CParticleSystem::getInvertedUserMatrix(), NL3D::CParticleSystemProcess::getMatrixMode(), nlassert, NL3D::PSFXWorldMatrix, NL3D::PSIdentityMatrix, and NL3D::PSUserMatrix. Referenced by computeI(), computeJ(), and computeK().
00109 {
00110 nlassert(_Owner);
00111 switch(getMatrixMode())
00112 {
00113 case PSFXWorldMatrix: return _Owner->getInvertedSysMat();
00114 case PSIdentityMatrix: return NLMISC::CMatrix::Identity;
00115 case PSUserMatrix: return _Owner->getInvertedUserMatrix();
00116 default:
00117 nlassert(0);
00118 }
00119 nlassert(0);
00120 return NLMISC::CMatrix::Identity;
00121 }
|
|
|
test wether this located has collision infos
Definition at line 435 of file ps_located.h. References _CollisionInfo. Referenced by NL3D::CompensateEmission().
00435 { return _CollisionInfo != NULL; }
|
|
|
tells wether there are alive emitters / particles in the system
Reimplemented from NL3D::CParticleSystemProcess. Definition at line 463 of file ps_located.cpp. References _LocatedBoundCont, CHECK_PS_INTEGRITY, and NL3D::PSEmitter.
00464 {
00465 CHECK_PS_INTEGRITY
00466 for (TLocatedBoundCont::const_iterator it = _LocatedBoundCont.begin(); it != _LocatedBoundCont.end(); ++it)
00467 {
00468 if ((*it)->getType() == PSEmitter && (*it)->hasEmitters()) return true;
00469 }
00470 CHECK_PS_INTEGRITY
00471 return false;
00472 }
|
|
|
Test whether LOD degradation was activated
Definition at line 514 of file ps_located.h. References _LODDegradation.
00514 { return _LODDegradation; }
|
|
|
tells wether there are alive entities / particles in the system
Reimplemented from NL3D::CParticleSystemProcess. Definition at line 450 of file ps_located.cpp. References _LocatedBoundCont, CHECK_PS_INTEGRITY, and NL3D::PSParticle. Referenced by NL3D::CParticleSystem::hasTemporaryParticles().
00451 {
00452 CHECK_PS_INTEGRITY
00453 for (TLocatedBoundCont::const_iterator it = _LocatedBoundCont.begin(); it != _LocatedBoundCont.end(); ++it)
00454 {
00455 if ((*it)->getType() == PSParticle && (*it)->hasParticles()) return true;
00456 }
00457 CHECK_PS_INTEGRITY
00458 return false;
00459 }
|
|
|
*************************************************************************************** Shorcut to increase the particle counter (number of particle drawn, for benchmark purpose ) should be called only by bound object that display particles Definition at line 500 of file ps_located.cpp. References CHECK_PS_INTEGRITY, num, and uint. Referenced by NL3D::CPSTailDot::displayRibbons(), NL3D::CPSRibbonLookAt::displayRibbons(), NL3D::CPSRibbon::displayRibbons(), NL3D::CPSConstraintMesh::draw(), NL3D::CPSDot::draw(), NL3D::CPSFaceHelper::drawFaces(), NL3D::CPSFanLightHelper::drawFanLight(), NL3D::CPSFaceLookAtHelper::drawLookAt(), NL3D::CPSFaceLookAtHelper::drawLookAtAlignOnMotion(), and NL3D::CPSMesh::updatePos().
00501 {
00502 CHECK_PS_INTEGRITY
00503 CParticleSystem::NbParticlesDrawn += num; // for benchmark purpose
00504 }
|
|
|
***************************************************************************************
Definition at line 1885 of file ps_located.cpp. References _NumIntegrableForceWithDifferentBasis, CHECK_PS_INTEGRITY, NL3D::CParticleSystemProcess::getMatrixMode(), and releaseParametricInfos(). Referenced by setMatrixMode().
01886 {
01887 CHECK_PS_INTEGRITY
01888 if (getMatrixMode() != matrixMode)
01889 {
01890 ++_NumIntegrableForceWithDifferentBasis;
01891 releaseParametricInfos();
01892 }
01893 else
01894 {
01895 --_NumIntegrableForceWithDifferentBasis;
01896 }
01897 CHECK_PS_INTEGRITY
01898 }
|
|
||||||||||||||||||||||||||||
|
*************************************************************************************** Compute the trajectory of the given located. NB : only works with object that have parametric trajectories Definition at line 256 of file ps_located.cpp. References _IntegrableForces, _ParametricMotion, _PInfo, CHECK_PS_INTEGRITY, NL3D::CPSLocated::CParametricInfo::Date, NL3D::FillBufUsingSubdiv(), nlassert, NL3D::CPSLocated::CParametricInfo::Pos, NL3D::CPSLocated::CParametricInfo::Speed, stride, supportParametricMotion(), uint, uint32, uint8, NLMISC::CVector::x, NLMISC::CVector::y, and NLMISC::CVector::z. Referenced by NL3D::CPSTailDot::displayRibbons(), NL3D::CPSRibbonLookAt::displayRibbons(), NL3D::CPSRibbon::displayRibbons(), NL3D::GenEmitterPositions(), and NL3D::GenEmitterPositionsWithLOD().
00260 {
00261 CHECK_PS_INTEGRITY
00262 nlassert(supportParametricMotion() && _ParametricMotion);
00263 if (_IntegrableForces.size() != 0)
00264 {
00265 bool accumulate = false;
00266 for (TForceVect::iterator it = _IntegrableForces.begin(); it != _IntegrableForces.end(); ++it)
00267 {
00268 nlassert((*it)->isIntegrable());
00269 (*it)->integrateSingle(startDate, deltaT, numStep, this, indexInLocated, destPos, accumulate, stride);
00270 accumulate = true;
00271 }
00272 }
00273 else // no forces applied, just deduce position from date, initial pos and speed
00274 {
00275 #ifdef NL_DEBUG
00276 NLMISC::CVector *endPos = (NLMISC::CVector *) ( (uint8 *) destPos + stride * numStep);
00277 #endif
00278 const CPSLocated::CParametricInfo &pi = _PInfo[indexInLocated];
00279 destPos = FillBufUsingSubdiv(pi.Pos, pi.Date, startDate, deltaT, numStep, destPos, stride);
00280 if (numStep != 0)
00281 {
00282 float currDate = startDate - pi.Date;
00283 nlassert(currDate >= 0);
00284 do
00285 {
00286 #ifdef NL_DEBUG
00287 nlassert(destPos < endPos);
00288 #endif
00289 destPos->x = pi.Pos.x + currDate * pi.Speed.x;
00290 destPos->y = pi.Pos.y + currDate * pi.Speed.y;
00291 destPos->z = pi.Pos.z + currDate * pi.Speed.z;
00292 currDate += deltaT;
00293 destPos = (NLMISC::CVector *) ( (uint8 *) destPos + stride);
00294 }
00295 while (--numStep);
00296 }
00297 }
00298 CHECK_PS_INTEGRITY
00299 }
|
|
|
***************************************************************************************
Definition at line 1914 of file ps_located.cpp. References _LocatedBoundCont, and CHECK_PS_INTEGRITY.
01915 {
01916 CHECK_PS_INTEGRITY
01917 TLocatedBoundCont::const_iterator it = std::find(_LocatedBoundCont.begin(), _LocatedBoundCont.end(), lb);
01918 return it != _LocatedBoundCont.end();
01919 CHECK_PS_INTEGRITY
01920 }
|
|
|
Reimplemented from NL3D::CParticleSystemProcess. Definition at line 148 of file ps_located.h.
00148 { return true; }
|
|
|
test wether parametric motion is enabled
Reimplemented from NL3D::CParticleSystemProcess. Definition at line 535 of file ps_located.h. References _ParametricMotion. Referenced by NL3D::CompensateEmission(), NL3D::GenEmitterPositions(), and NL3D::GenEmitterPositionsWithLOD().
00535 { return _ParametricMotion;}
|
|
|
Test wether a trigger on death has been enabled.
Definition at line 555 of file ps_located.h. References _TriggerOnDeath.
00555 { return _TriggerOnDeath; }
|
|
||||||||||||||||||||||||||||
|
*************************************************************************************** Generate one more instance in a located. The coordinate are given in the chosen basis for the located. If the emitterLocated ptr is not null, then the coordinate are taken from the emitterLocated basis and are expressed in this located basis. other attributes are generated according to other properties of this class Will succeed only if it hasn't reach the max number of allowed instances return will be -1 if call failed or an index to the created object. Index is only valid after creation. Any processing pass on the system will make it invalid. It can be used with any attribute modification method of located and located bindable
Definition at line 852 of file ps_located.cpp. References _CollisionInfo, _InitialLife, _InitialMass, _InvMass, _LifeScheme, _LocatedBoundCont, _MassScheme, _ParametricMotion, _PInfo, _TimeIncrement, _UpdateLock, CHECK_PS_INTEGRITY, NL3D::CPSAttribMaker< float >::get(), NL3D::CParticleSystem::getAutoCountFlag(), getConversionMatrix(), NL3D::CParticleSystem::getInvertedSysMat(), NL3D::CParticleSystem::getInvertedUserMatrix(), NL3D::CParticleSystemProcess::getMatrixMode(), getMaxSize(), NL3D::CParticleSystem::getSysMat(), NL3D::CParticleSystem::getSystemDate(), NL3D::CParticleSystem::getUserMatrix(), NL3D::CPSAttrib< CParametricInfo >::insert(), NL3D::CPSAttrib< float >::insert(), NL3D::CPSAttrib< T >::insert(), NL3D::CParticleSystem::interpolateFXPosDelta(), NL3D::CParticleSystem::interpolateUserPosDelta(), NLMISC::CMatrix::mulVector(), nlassert, postNewElement(), NL3D::PSFXWorldMatrix, NL3D::PSIdentityMatrix, NL3D::PSUserMatrix, resize(), sint32, NL3D::TAnimationTime, uint, and uint32. Referenced by NL3D::CPSEmitter::processEmit(), NL3D::CPSEmitter::processEmitConsistent(), and updateNewElementRequestStack().
00853 {
00854 CHECK_PS_INTEGRITY
00855 if (_UpdateLock)
00856 {
00857 postNewElement(pos, speed);
00858 return -1;
00859 }
00860
00861
00862 sint32 creationIndex;
00863
00864 // get the convertion matrix from the emitter basis to the emittee basis
00865 // if the emitter is null, we assume that the coordinate are given in the chosen basis for this particle type
00866
00867 if (_MaxSize == _Size)
00868 {
00869 if (_Owner && _Owner->getAutoCountFlag() && getMaxSize() < ((1 << 16) - 1) )
00870 {
00871 // we are probably in edition mode -> auto-count mode helps to compute ideal particle array size
00872 // but at the expense of costly allocations
00873 uint maxSize = getMaxSize();
00874 resize(maxSize == 0 ? 1 : NLMISC::raiseToNextPowerOf2(maxSize) - 1); // force a reserve with next power of 2 (no important in edition mode)
00875 resize(maxSize + 1);
00876 }
00877 else
00878 {
00879 return -1;
00880 }
00881 }
00882 if (_CollisionInfo)
00883 {
00884 _CollisionInfo->insert();
00885 }
00886
00887 // During creation, we interpolate the position of the system (by using the ellapsed time) if particle are created in world basis and if the emitter is in local basis.
00888 // Example a fireball FX let particles in world basis, but the fireball is moving. If we dont interpolate position between 2 frames, emission will appear to be "sporadic".
00889 // For now, we manage the local to world case. The world to local is possible, but not very useful
00890 switch(emitter ? emitter->getMatrixMode() : this->getMatrixMode())
00891 {
00892 case PSFXWorldMatrix:
00893 switch(this->getMatrixMode())
00894 {
00895 case PSFXWorldMatrix:
00896 {
00897 creationIndex =_Pos.insert(pos);
00898 }
00899 break;
00900 case PSIdentityMatrix:
00901 {
00902 CVector fxPosDelta;
00903 _Owner->interpolateFXPosDelta(fxPosDelta, ellapsedTime);
00904 creationIndex =_Pos.insert(_Owner->getSysMat() * pos + fxPosDelta);
00905 }
00906 break;
00907 case PSUserMatrix:
00908 {
00909 CVector fxPosDelta;
00910 _Owner->interpolateFXPosDelta(fxPosDelta, ellapsedTime);
00911 CVector userMatrixPosDelta;
00912 _Owner->interpolateUserPosDelta(userMatrixPosDelta, ellapsedTime);
00913 creationIndex =_Pos.insert(_Owner->getInvertedUserMatrix() * (_Owner->getSysMat() * pos + fxPosDelta - userMatrixPosDelta));
00914 }
00915 break;
00916 default:
00917 nlassert(0);
00918 }
00919 break;
00920 case PSIdentityMatrix:
00921 switch(this->getMatrixMode())
00922 {
00923 case PSFXWorldMatrix:
00924 {
00925 CVector fxPosDelta;
00926 _Owner->interpolateFXPosDelta(fxPosDelta, ellapsedTime);
00927 creationIndex =_Pos.insert(_Owner->getInvertedSysMat() * (pos - fxPosDelta));
00928 }
00929 break;
00930 case PSIdentityMatrix:
00931 {
00932 creationIndex =_Pos.insert(pos);
00933 }
00934 break;
00935 case PSUserMatrix:
00936 {
00937 CVector userMatrixPosDelta;
00938 _Owner->interpolateUserPosDelta(userMatrixPosDelta, ellapsedTime);
00939 creationIndex =_Pos.insert(_Owner->getInvertedUserMatrix() * (pos - userMatrixPosDelta));
00940 }
00941 break;
00942 default:
00943 nlassert(0);
00944 }
00945 break;
00946 case PSUserMatrix:
00947 switch(this->getMatrixMode())
00948 {
00949 case PSFXWorldMatrix:
00950 {
00951 CVector fxPosDelta;
00952 _Owner->interpolateFXPosDelta(fxPosDelta, ellapsedTime);
00953 CVector userMatrixPosDelta;
00954 _Owner->interpolateUserPosDelta(userMatrixPosDelta, ellapsedTime);
00955 creationIndex =_Pos.insert(_Owner->getInvertedSysMat() * (_Owner->getUserMatrix() * pos + userMatrixPosDelta- fxPosDelta));
00956 }
00957 break;
00958 case PSIdentityMatrix:
00959 {
00960 CVector userMatrixPosDelta;
00961 _Owner->interpolateUserPosDelta(userMatrixPosDelta, ellapsedTime);
00962 creationIndex =_Pos.insert(_Owner->getUserMatrix() * pos + userMatrixPosDelta);
00963 }
00964 break;
00965 case PSUserMatrix:
00966 {
00967 creationIndex =_Pos.insert(pos);
00968 }
00969 break;
00970 default:
00971 nlassert(0);
00972 }
00973 break;
00974 default:
00975 nlassert(0);
00976 }
00977
00978
00979 nlassert(creationIndex != -1); // all attributs must contains the same number of elements
00980
00981 if (speedCoordSystem == this->getMatrixMode()) // is speed vector expressed in the good basis ?
00982 {
00983 _Speed.insert(speed);
00984 }
00985 else
00986 {
00987 // must do conversion of speed
00988 nlassert(_Owner);
00989 const NLMISC::CMatrix &convMat = getConversionMatrix(*_Owner, this->getMatrixMode(), speedCoordSystem);
00990 _Speed.insert(convMat.mulVector(speed));
00991 }
00992
00993 _InvMass.insert(1.f / ((_MassScheme && emitter) ? _MassScheme->get(emitter, indexInEmitter) : _InitialMass ) );
00994 _Time.insert(0.0f);
00995 const float lifeTime = (_LifeScheme && emitter) ? _LifeScheme->get(emitter, indexInEmitter) : _InitialLife ;
00996 _TimeIncrement.insert( lifeTime ? 1.f / lifeTime : 10E6f);
00997
00998 // test wether parametric motion is used, and generate the infos that are needed then
00999 if (_ParametricMotion)
01000 {
01001 _PInfo.insert( CParametricInfo(_Pos[creationIndex], _Speed[creationIndex], _Owner->getSystemDate() ) );
01002 }
01003
01004
01006 // generate datas for all bound objects //
01008 _UpdateLock = true;
01009
01010
01011 for (TLocatedBoundCont::iterator it = _LocatedBoundCont.begin(); it != _LocatedBoundCont.end(); ++it)
01012 {
01013 (*it)->newElement(emitter, indexInEmitter);
01014 }
01015
01016
01017 _UpdateLock = false;
01018 ++_Size; // if this is modified, you must also modify the getNewElementIndex in this class
01019 // because that method give the index of the element being created for overrider of the newElement method
01020 // of the CPSLocatedClass (which is called just above)
01021
01022
01023 CHECK_PS_INTEGRITY
01024 return creationIndex;
01025 }
|
|
|
|
|
|
*************************************************************************************** nlassertex(maxNumFaces < ((1 << 16) - 1), ("%s", (*it)->getClassName().c_str())); Definition at line 422 of file ps_located.cpp. References _LocatedBoundCont, _MaxNumFaces, CHECK_PS_INTEGRITY, NL3D::PSParticle, and uint. Referenced by bind(), NL3D::CPSParticle::notifyOwnerMaxNumFacesChanged(), and resize().
00423 {
00424 CHECK_PS_INTEGRITY
00425 if (!_Owner) return;
00426
00427 // we examine wether we have particle attached to us, and ask for the max number of faces they may want
00428 _MaxNumFaces = 0;
00429 for (TLocatedBoundCont::const_iterator it = _LocatedBoundCont.begin(); it != _LocatedBoundCont.end(); ++it)
00430 {
00431 if ((*it)->getType() == PSParticle)
00432 {
00433 uint maxNumFaces = ((CPSParticle *) (*it))->getMaxNumFaces();
00435 _MaxNumFaces += maxNumFaces;
00436 }
00437 }
00438 CHECK_PS_INTEGRITY
00439 }
|
|
|
***************************************************************************************
Definition at line 244 of file ps_located.cpp. References _LocatedBoundCont, _ParametricMotion, and CHECK_PS_INTEGRITY. Referenced by allocateParametricInfos(), and releaseParametricInfos().
00245 {
00246 CHECK_PS_INTEGRITY
00247 for (TLocatedBoundCont::const_iterator it = _LocatedBoundCont.begin(); it != _LocatedBoundCont.end(); ++it)
00248 {
00249 (*it)->motionTypeChanged(_ParametricMotion);
00250 }
00251 CHECK_PS_INTEGRITY
00252 }
|
|
||||||||||||||||
|
***************************************************************************************
Reimplemented from NL3D::CParticleSystemProcess. Definition at line 302 of file ps_located.cpp. References _IntegrableForces, _ParametricMotion, _PInfo, NL3D::CPSAttrib< T >::begin(), NL3D::CPSAttrib< CParametricInfo >::begin(), CHECK_PS_INTEGRITY, NL3D::CPSAttrib< CParametricInfo >::end(), nlassert, supportParametricMotion(), and NL3D::TAnimationTime.
00303 {
00304 CHECK_PS_INTEGRITY
00305 if (!_Size) return;
00306 nlassert(supportParametricMotion() && _ParametricMotion);
00307
00308 if (_IntegrableForces.size() != 0)
00309 {
00310 bool accumulate = false;
00311 for (TForceVect::iterator it = _IntegrableForces.begin(); it != _IntegrableForces.end(); ++it)
00312 {
00313 nlassert((*it)->isIntegrable());
00314 (*it)->integrate(date, this, 0, _Size, &_Pos[0], &_Speed[0], accumulate);
00315 accumulate = true;
00316 }
00317 }
00318 else
00319 {
00320 CPSLocated::TPSAttribParametricInfo::const_iterator it = _PInfo.begin(),
00321 endIt = _PInfo.end();
00322 TPSAttribVector::iterator posIt = _Pos.begin();
00323 float deltaT;
00324 do
00325 {
00326 deltaT = date - it->Date;
00327 posIt->x = it->Pos.x + deltaT * it->Speed.x;
00328 posIt->y = it->Pos.y + deltaT * it->Speed.y;
00329 posIt->z = it->Pos.z + deltaT * it->Speed.z;
00330 ++posIt;
00331 ++it;
00332 }
00333 while (it != endIt);
00334 }
00335 //step(PSEmit, ellapsedTime, realEllapsedTime);
00336 CHECK_PS_INTEGRITY
00337 }
|
|
||||||||||||
|
*************************************************************************************** Post a request for the generation of a new located. it is called by newElement when _UpdateLock is set (when called during newElement or deleteElement) Definition at line 1028 of file ps_located.cpp. References _RequestStack. Referenced by newElement().
01029 {
01030 _RequestStack.push(CPostNewElementRequestInfo(pos, speed));
01031 }
|
|
|
***************************************************************************************
Implements NL3D::CParticleSystemProcess. Definition at line 442 of file ps_located.cpp. References _MaxNumFaces, and uint.
00443 {
00444 return _MaxNumFaces;
00445 }
|
|
|
*************************************************************************************** call this if you need collision infos. The collide info attribute is not included by default to save memory. The first call will create the attribute, and others will add references. You can then access the infos by calling getCollisioInfo You must call releaseCollideInfo after use. Definition at line 1783 of file ps_located.cpp. References _CollisionInfo, _CollisionInfoNbRef, CHECK_PS_INTEGRITY, NL3D::CPSAttrib< T >::insert(), NL3D::CPSAttrib< T >::resize(), NL3D::TPSAttribCollisionInfo, and uint. Referenced by NL3D::CPSZone::attachTarget().
01784 {
01785 CHECK_PS_INTEGRITY
01786 if (_CollisionInfoNbRef)
01787 {
01788 ++ _CollisionInfoNbRef;
01789 }
01790 else
01791 {
01792 _CollisionInfo = new TPSAttribCollisionInfo;
01793 _CollisionInfoNbRef = 1;
01794 _CollisionInfo->resize(_MaxSize);
01795
01796 for(uint k = 0; k < _Size; ++k)
01797 {
01798 _CollisionInfo->insert();
01799 }
01800 }
01801 CHECK_PS_INTEGRITY
01802 }
|
|
|
*************************************************************************************** Register a dtor observer; (that derives from CPSLocatedBindable) Each observer will be called when this object dtor is called (call of method notifyTargetRemoved() ) This allow for objects that hold this as a target to know when it is suppressed (example : collision objects hold located as targets) When an observer is detroyed, it MUST call unregisterDtorObserver, The same observer can only register once, otherwise, an assertion occurs Definition at line 824 of file ps_located.cpp. References _DtorObserversVect, CHECK_PS_INTEGRITY, and nlassert. Referenced by NL3D::CPSTargetLocatedBindable::attachTarget(), and NL3D::CPSEmitter::setEmittedType().
00825 {
00826 CHECK_PS_INTEGRITY
00827 // check wether the observer wasn't registered twice
00828 nlassert(std::find(_DtorObserversVect.begin(), _DtorObserversVect.end(), anObserver) == _DtorObserversVect.end());
00829 _DtorObserversVect.push_back(anObserver);
00830 CHECK_PS_INTEGRITY
00831 }
|
|
|
***************************************************************************************
Definition at line 1836 of file ps_located.cpp. References _IntegrableForces, _NumIntegrableForceWithDifferentBasis, CHECK_PS_INTEGRITY, NL3D::CParticleSystemProcess::getMatrixMode(), NL3D::CPSLocatedBindable::getOwner(), nlassert, and releaseParametricInfos(). Referenced by NL3D::CPSForce::attachTarget().
01837 {
01838 CHECK_PS_INTEGRITY
01839 nlassert(std::find(_IntegrableForces.begin(), _IntegrableForces.end(), f) == _IntegrableForces.end()); // force registered twice
01840 _IntegrableForces.push_back(f);
01841 if (getMatrixMode() != f->getOwner()->getMatrixMode())
01842 {
01843 ++_NumIntegrableForceWithDifferentBasis;
01844 releaseParametricInfos();
01845 }
01846 CHECK_PS_INTEGRITY
01847 }
|
|
|
*************************************************************************************** From CParticleSystemProcess. Release any reference this located may have to other process of the system For example, this is used when detaching a process of a system. Implements NL3D::CParticleSystemProcess. Definition at line 212 of file ps_located.cpp. References _CollisionInfo, _CollisionInfoNbRef, _DtorObserversVect, _IntegrableForces, _LocatedBoundCont, _NonIntegrableForceNbRefs, CHECK_PS_INTEGRITY, nlassert, and TDtorObserversVect.
00213 {
00214 CHECK_PS_INTEGRITY
00215 // located bindables
00216 {
00217 for(TLocatedBoundCont::iterator it = _LocatedBoundCont.begin(); it != _LocatedBoundCont.end(); ++it)
00218 {
00219 (*it)->releaseAllRef();
00220 }
00221 }
00222
00223 // we must do a copy, because the subsequent call can modify this vector
00224 TDtorObserversVect copyVect(_DtorObserversVect.begin(), _DtorObserversVect.end());
00225 // call all the dtor observers
00226 for (TDtorObserversVect::iterator it = copyVect.begin(); it != copyVect.end(); ++it)
00227 {
00228 (*it)->notifyTargetRemoved(this);
00229 }
00230 _DtorObserversVect.clear();
00231
00232 nlassert(_CollisionInfoNbRef == 0); //If this is not = 0, then someone didnt call releaseCollisionInfo
00233 // If this happen, you can register with the registerDTorObserver
00234 // (observer pattern)
00235 // and override notifyTargetRemove to call releaseCollisionInfo
00236 nlassert(_IntegrableForces.size() == 0);
00237 nlassert(_NonIntegrableForceNbRefs == 0);
00238 nlassert(!_CollisionInfo);
00239 CHECK_PS_INTEGRITY
00240 }
|
|
|
***************************************************************************************
Definition at line 1805 of file ps_located.cpp. References _CollisionInfo, _CollisionInfoNbRef, CHECK_PS_INTEGRITY, and nlassert. Referenced by NL3D::CPSZone::releaseTargetRsc().
01806 {
01807 CHECK_PS_INTEGRITY
01808 nlassert(_CollisionInfoNbRef); // check whether queryCollisionInfo was called
01809 // so the number of refs must not = 0
01810 --_CollisionInfoNbRef;
01811 if (_CollisionInfoNbRef == 0)
01812 {
01813 delete _CollisionInfo;
01814 _CollisionInfo = NULL;
01815 }
01816 CHECK_PS_INTEGRITY
01817 }
|
|
|
***************************************************************************************
Definition at line 1875 of file ps_located.cpp. References _NonIntegrableForceNbRefs, CHECK_PS_INTEGRITY, and nlassert. Referenced by NL3D::CPSZone::releaseTargetRsc(), and NL3D::CPSForce::releaseTargetRsc().
01876 {
01877 CHECK_PS_INTEGRITY
01878 nlassert(_NonIntegrableForceNbRefs != 0);
01879 --_NonIntegrableForceNbRefs;
01880 CHECK_PS_INTEGRITY
01881 }
|
|
|
release paametric infos
Definition at line 364 of file ps_located.cpp. References _ParametricMotion, _PInfo, CHECK_PS_INTEGRITY, NLMISC::contReset(), and notifyMotionTypeChanged(). Referenced by addNonIntegrableForceRef(), enableParametricMotion(), integrableForceBasisChanged(), and registerIntegrableForce().
00365 {
00366 CHECK_PS_INTEGRITY
00367 if (!_ParametricMotion) return;
00368 NLMISC::contReset(_PInfo);
00369 _ParametricMotion = false;
00370 notifyMotionTypeChanged();
00371 CHECK_PS_INTEGRITY
00372 }
|
|
|
*************************************************************************************** From CParticleSystemProcess. Release any reference this located may have on the given process. For example, this is used when detaching a located of a system. Implements NL3D::CParticleSystemProcess. Definition at line 185 of file ps_located.cpp. References _DtorObserversVect, _LocatedBoundCont, CHECK_PS_INTEGRITY, and NL3D::CPSLocatedBindable::notifyTargetRemoved().
00186 {
00187 CHECK_PS_INTEGRITY
00188 // located bindables
00189 {
00190 for(TLocatedBoundCont::iterator it = _LocatedBoundCont.begin(); it != _LocatedBoundCont.end(); ++it)
00191 {
00192 (*it)->releaseRefTo(other);
00193 }
00194 }
00195 // dtor observers
00196 {
00197
00198 for(TDtorObserversVect::iterator it = _DtorObserversVect.begin(); it != _DtorObserversVect.end(); ++it)
00199 {
00200 if ((*it)->getOwner() == other)
00201 {
00202 CPSLocatedBindable *refMaker = *it;
00203 refMaker->notifyTargetRemoved(this);
00204 break;
00205 }
00206 }
00207 }
00208 CHECK_PS_INTEGRITY
00209 }
|
|
|
*************************************************************************************** remove a bound object from the located if the object doesnt exist -> nlassert it is deleted Definition at line 808 of file ps_located.cpp. References _LocatedBoundCont, CHECK_PS_INTEGRITY, nlassert, and NL3D::CParticleSystem::systemDurationChanged().
00809 {
00810 CHECK_PS_INTEGRITY
00811 TLocatedBoundCont::iterator it = std::find(_LocatedBoundCont.begin(), _LocatedBoundCont.end(), p);
00812 nlassert(it != _LocatedBoundCont.end());
00813 (*it)->finalize();
00814 delete *it;
00815 _LocatedBoundCont.erase(it);
00816 if (_Owner)
00817 {
00818 _Owner->systemDurationChanged();
00819 }
00820 CHECK_PS_INTEGRITY
00821 }
|
|
|
***************************************************************************************
Definition at line 1821 of file ps_located.cpp. References _CollisionInfo, NL3D::CPSAttrib< T >::begin(), CHECK_PS_INTEGRITY, NL3D::CPSAttrib< T >::end(), and nlassert.
01822 {
01823 CHECK_PS_INTEGRITY
01824 nlassert(_CollisionInfo);
01825
01826 TPSAttribCollisionInfo::iterator it = _CollisionInfo->begin(), endIt = _CollisionInfo->end();
01827
01828 for (; it != endIt; ++it)
01829 {
01830 it->reset();
01831 }
01832 CHECK_PS_INTEGRITY
01833 }
|
|
|
Resize the located container, in order to accept more instances Definition at line 1117 of file ps_located.cpp. References _CollisionInfo, _InvMass, _LocatedBoundCont, _ParametricMotion, _PInfo, _TimeIncrement, CHECK_PS_INTEGRITY, deleteElement(), nlassert, notifyMaxNumFacesChanged(), NL3D::CPSAttrib< CParametricInfo >::resize(), NL3D::CPSAttrib< T >::resize(), NL3D::CPSAttrib< float >::resize(), and uint32. Referenced by NL3D::CParticleSystem::matchArraySize(), and newElement().
01118 {
01119 CHECK_PS_INTEGRITY
01120 nlassert(newSize < (1 << 16));
01121 if (newSize < _Size)
01122 {
01123 for (uint32 k = _Size - 1; k >= newSize; --k)
01124 {
01125 deleteElement(k);
01126
01127 if (k == 0) break; // we're dealing with unsigned quantities
01128 }
01129 _Size = newSize;
01130 }
01131
01132
01133 _MaxSize = newSize;
01134 _InvMass.resize(newSize);
01135 _Pos.resize(newSize);
01136 _Speed.resize(newSize);
01137 _Time.resize(newSize);
01138 _TimeIncrement.resize(newSize);
01139
01140 if (_ParametricMotion)
01141 {
01142 _PInfo.resize(newSize);
01143 }
01144
01145 if (_CollisionInfo)
01146 {
01147 _CollisionInfo->resize(newSize);
01148 }
01149
01150
01151
01152 // resize attributes for all bound objects
01153 for (TLocatedBoundCont::iterator it = _LocatedBoundCont.begin(); it != _LocatedBoundCont.end(); ++it)
01154 {
01155 (*it)->resize(newSize);
01156 }
01157
01158
01160 notifyMaxNumFacesChanged();
01161 CHECK_PS_INTEGRITY
01162 }
|
|
|
***************************************************************************************
Reimplemented from NL3D::CParticleSystemProcess. Definition at line 1165 of file ps_located.cpp. References CHECK_PS_INTEGRITY, len, nlassert, sint, sint32, size, t, TNewElementRequestStack, uint, and uint32.
01166 {
01167 CHECK_PS_INTEGRITY
01168
01169 // version 4 to version 5 : bugfix with reading of collisions
01170 sint ver = f.serialVersion(6);
01171 CParticleSystemProcess::serial(f);
01172
01173 if (f.isReading() && !CParticleSystem::getSerializeIdentifierFlag())
01174 {
01175 // just skip the name
01176 sint32 len;
01177 f.serial(len);
01178 f.seek(len, NLMISC::IStream::current);
01179 }
01180 else
01181 {
01182 f.serial(_Name);
01183 }
01184
01185 f.serial(_InvMass);
01186 f.serial(_Pos);
01187 f.serial(_Speed);
01188 f.serial(_Time);
01189 f.serial(_TimeIncrement);
01190
01191 f.serial(_Size);
01192 f.serial(_MaxSize);
01193
01194 f.serial(_LastForever);
01195
01196 f.serialPtr(_CollisionInfo);
01197 f.serial(_CollisionInfoNbRef);
01198
01199 if (_CollisionInfo)
01200 {
01201 if (ver <= 5) // should be corrected with version 5
01202 {
01203 if (f.isReading())
01204 {
01205 // apparently, with a previous version, collision haven't been saved properly in a few case, so reset them when they are loaded
01206 _CollisionInfo->resize(_Pos.getMaxSize());
01207 _CollisionInfo->clear();
01208 CPSCollisionInfo nullCollision;
01209 uint numInstances = _Pos.getSize();
01210 for(uint k = 0; k < numInstances; ++k)
01211 {
01212 _CollisionInfo->insert(nullCollision);
01213 }
01214 }
01215 }
01216 }
01217
01218 //CHECK_PS_INTEGRITY
01219
01220
01221 if (f.isReading())
01222 {
01223 delete _LifeScheme;
01224 delete _MassScheme;
01225
01226 bool useScheme;
01227 f.serial(useScheme);
01228 if (useScheme)
01229 {
01230 f.serialPolyPtr(_LifeScheme);
01231 }
01232 else
01233 {
01234 f.serial(_InitialLife);
01235 _LifeScheme = NULL;
01236 }
01237
01238 f.serial(useScheme);
01239 if (useScheme)
01240 {
01241 f.serialPolyPtr(_MassScheme);
01242 }
01243 else
01244 {
01245 f.serial(_InitialMass);
01246 nlassert(_InitialMass > 0);
01247 _MassScheme = NULL;
01248 }
01249 }
01250 else
01251 {
01252 bool bFalse = false, bTrue = true;
01253 if (_LifeScheme)
01254 {
01255 f.serial(bTrue);
01256 f.serialPolyPtr(_LifeScheme);
01257 }
01258 else
01259 {
01260 f.serial(bFalse);
01261 f.serial(_InitialLife);
01262 }
01263 if (_MassScheme)
01264 {
01265 f.serial(bTrue);
01266 f.serialPolyPtr(_MassScheme);
01267 }
01268 else
01269 {
01270 f.serial(bFalse);
01271 nlassert(_InitialMass > 0);
01272 f.serial(_InitialMass);
01273 }
01274 }
01275
01276
01277 f.serial(_NbFramesToSkip);
01278
01279 f.serialContPolyPtr(_DtorObserversVect);
01280
01281 if (f.isReading())
01282 {
01283 while(!_RequestStack.empty())
01284 {
01285 _RequestStack.pop();
01286 }
01287 uint32 size;
01288 f.serial(size);
01289 for (uint32 k = 0; k < size; ++k)
01290 {
01291 TNewElementRequestStack::value_type t;
01292 f.serial(t);
01293 _RequestStack.push(t);
01294 }
01295 }
01296 else
01297 {
01298 // when writing the stack, we must make a copy because we can't access elements by their index
01299 // so the stack must be destroyed
01300 TNewElementRequestStack r2;
01301 uint32 size = (uint32) _RequestStack.size();
01302 f.serial(size);
01303
01304 while(!_RequestStack.empty())
01305 {
01306 r2.push(_RequestStack.top());
01307 _RequestStack.pop();
01308 }
01309 // now rebuild the stack while serializing it;
01310 while (!r2.empty())
01311 {
01312 f.serial(r2.top());
01313 _RequestStack.push(r2.top());
01314 r2.pop();
01315 }
01316
01317 }
01318
01319
01320
01321
01322 f.serial(_UpdateLock);
01323
01324 f.serialContPolyPtr(_LocatedBoundCont);
01325
01326 if (ver > 1)
01327 {
01328 f.serial(_LODDegradation);
01329 }
01330
01331 if (ver > 2)
01332 {
01333 f.serial(_ParametricMotion);
01334 }
01335
01336 if (f.isReading())
01337 {
01338 // evaluate our max number of faces
01339 notifyMaxNumFacesChanged();
01340
01341 if (_ParametricMotion)
01342 {
01343 allocateParametricInfos();
01344 }
01345 }
01346
01347 if (ver > 3)
01348 {
01349 f.serial(_TriggerOnDeath, _TriggerID);
01350 }
01351 CHECK_PS_INTEGRITY
01352 }
|
|
|
set the Refresh Rate of this located. Default is motion every frame (frameToSkip = 0) The drawing process will still occur every frame anyway... It's a speed / quality tradeof Definition at line 379 of file ps_located.h. References _NbFramesToSkip, and uint32.
00379 { _NbFramesToSkip = nbFramesToSkip; }
|
|
|
*************************************************************************************** Set the duration of locateds. Any previous call to setLastForever() is discarded Any previous scheme for lifetime is dicarded Reset all particles current date to 0. This is needed because we do not check if particle life is over when the date of the system has not gone beyond the life duration of particles Definition at line 507 of file ps_located.cpp. References _InitialLife, _LastForever, _LifeScheme, CHECK_PS_INTEGRITY, NL3D::CParticleSystem::systemDurationChanged(), NL3D::TAnimationTime, and uint.
00508 {
00509 CHECK_PS_INTEGRITY
00510 _LastForever = false;
00511 _InitialLife = lifeTime;
00512 delete _LifeScheme;
00513 _LifeScheme = NULL;
00514
00518 for (uint k = 0; k < _Size; ++k)
00519 {
00520 _Time[k] = 0.f;
00521 }
00522 //
00523 if (_Owner)
00524 {
00525 _Owner->systemDurationChanged();
00526 }
00527 CHECK_PS_INTEGRITY
00528 }
|
|
|
*************************************************************************************** Set the mass of locateds. Any previous scheme for Mass is dicarded Definition at line 548 of file ps_located.cpp. References _InitialMass, _MassScheme, and CHECK_PS_INTEGRITY.
00549 {
00550 CHECK_PS_INTEGRITY
00551 _InitialMass = mass;
00552 delete _MassScheme;
00553 _MassScheme = NULL;
00554 CHECK_PS_INTEGRITY
00555 }
|
|
|
*************************************************************************************** set immortality for located
Definition at line 153 of file ps_located.cpp. References _LastForever, NL3D::CParticleSystem::canFinish(), CHECK_PS_INTEGRITY, NL3D::CParticleSystem::getBypassMaxNumIntegrationSteps(), and nlwarning.
00154 {
00155 CHECK_PS_INTEGRITY
00156 _LastForever = true;
00157 if (_Owner && _Owner->getBypassMaxNumIntegrationSteps())
00158 {
00159 // Should test that the system is still valid.
00160 if (!_Owner->canFinish())
00161 {
00162 _LastForever = false;
00163 nlwarning("<CPSLocated::setLastForever> Can't set flag : this causes the system to last forever, and it has been flagged with 'BypassMaxNumIntegrationSteps'. Flag is not set");
00164 return false;
00165 }
00166 }
00167 CHECK_PS_INTEGRITY
00168 return true;
00169 }
|
|
|
*************************************************************************************** Set a scheme (allocated by new, released by that object) that generate the duration of locateds. Such a scheme can't own its memory. Any previous call to setLastForever() is discarded Any previous scheme for lifetime is discarded Definition at line 531 of file ps_located.cpp. References _LastForever, _LifeScheme, CHECK_PS_INTEGRITY, NL3D::CPSAttribMaker< T >::hasMemory(), nlassert, and NL3D::CParticleSystem::systemDurationChanged().
00532 {
00533 CHECK_PS_INTEGRITY
00534 nlassert(scheme);
00535 nlassert(!scheme->hasMemory()); // scheme with memory is invalid there !!
00536 _LastForever = false;
00537 delete _LifeScheme;
00538 _LifeScheme = scheme;
00539 //
00540 if (_Owner)
00541 {
00542 _Owner->systemDurationChanged();
00543 }
00544 CHECK_PS_INTEGRITY
00545 }
|
|
|
*************************************************************************************** Set a scheme (allocated by new, released by that object) that generate the mass of locateds. Such a scheme can't own its memory. Any previous scheme for Mass is discarded Definition at line 558 of file ps_located.cpp. References _MassScheme, CHECK_PS_INTEGRITY, NL3D::CPSAttribMaker< T >::hasMemory(), and nlassert.
00559 {
00560 CHECK_PS_INTEGRITY
00561 nlassert(scheme);
00562 nlassert(!scheme->hasMemory()); // scheme with memory is invalid there !!
00563 delete _MassScheme;
00564 _MassScheme = scheme;
00565 CHECK_PS_INTEGRITY
00566 }
|
|
|
***************************************************************************************
Reimplemented from NL3D::CParticleSystemProcess. Definition at line 401 of file ps_located.cpp. References _IntegrableForces, _LocatedBoundCont, CHECK_PS_INTEGRITY, NL3D::CParticleSystemProcess::getMatrixMode(), and integrableForceBasisChanged().
00402 {
00403 CHECK_PS_INTEGRITY
00404 if (matrixMode != getMatrixMode())
00405 {
00406 for (TLocatedBoundCont::const_iterator it = _LocatedBoundCont.begin(); it != _LocatedBoundCont.end(); ++it)
00407 {
00408 (*it)->basisChanged(matrixMode);
00409 }
00410
00411 CParticleSystemProcess::setMatrixMode(matrixMode);
00412
00413 for (TForceVect::iterator fIt = _IntegrableForces.begin(); fIt != _IntegrableForces.end(); ++fIt)
00414 {
00415 integrableForceBasisChanged( (*fIt)->getOwner()->getMatrixMode() );
00416 }
00417 }
00418 CHECK_PS_INTEGRITY
00419 }
|
|
|
set the located bindable name (edition purpose)
Definition at line 492 of file ps_located.h.
00492 { _Name = name; }
|
|
|
Set the process owner. Called by the particle system during attachment.
Definition at line 38 of file particle_system_process.cpp. References NL3D::CParticleSystem::addRefForUserSysCoordInfo(), NL3D::CParticleSystemProcess::getUserMatrixUsageCount(), NL3D::CParticleSystemProcess::releaseAllRef(), and NL3D::CParticleSystem::releaseRefForUserSysCoordInfo(). Referenced by NL3D::CParticleSystem::attach(), NL3D::CParticleSystem::detach(), and NL3D::CParticleSystem::remove().
00039 {
00040 if (ps == _Owner) return;
00041 if (ps == NULL)
00042 {
00043 releaseAllRef();
00044 }
00045 _Owner->releaseRefForUserSysCoordInfo(getUserMatrixUsageCount());
00046 _Owner = ps;
00047 if (_Owner) _Owner->addRefForUserSysCoordInfo(getUserMatrixUsageCount());
00048 }
|
|
|
Set an ID for the emitter to be triggered on death.
Definition at line 558 of file ps_located.h. References _TriggerID, _TriggerOnDeath, nlassert, and uint32.
00559 {
00560 nlassert(_TriggerOnDeath);
00561 _TriggerID = id;
00562 }
|
|
|
Setup the driver model matrix. It is set accrodingly to the basis of the located. Setup the driver model matrix. It is set accordingly to the basis used for rendering Definition at line 1775 of file ps_located.cpp. References CHECK_PS_INTEGRITY, getDriver(), getLocalToWorldMatrix(), and NL3D::IDriver::setupModelMatrix(). Referenced by NL3D::CPSLocatedBindable::setupDriverModelMatrix().
01776 {
01777 CHECK_PS_INTEGRITY
01778 getDriver()->setupModelMatrix(getLocalToWorldMatrix());
01779 CHECK_PS_INTEGRITY
01780 }
|
|
|
***************************************************************************************
Implements NL3D::CParticleSystemProcess. Definition at line 2304 of file ps_located.cpp. References _LocatedBoundCont, and value.
02305 {
02306 for(TLocatedBoundCont::const_iterator it = _LocatedBoundCont.begin(); it != _LocatedBoundCont.end(); ++it)
02307 {
02308 (*it)->setZBias(value);
02309 }
02310 }
|
|
||||||||||||||||
|
*************************************************************************************** process the system Implements NL3D::CParticleSystemProcess. Definition at line 1466 of file ps_located.cpp. References _CollisionInfo, _LocatedBoundCont, _LODDegradation, _NbFramesToSkip, NL3D::CPSAttrib< T >::begin(), CHECK_PS_INTEGRITY, deleteElement(), NL3D::CParticleSystem::getDate(), NL3D::CParticleSystem::getLOD(), NL3D::CParticleSystem::getOneMinusCurrentLODRatio(), NL3D::IntegrateSpeed(), MINI_TIMER, nlassert, NL3D::PSLod1n2, NL3D::PSMotion, NL3D::PSMotion1, NL3D::PSMotion2, NL3D::PSMotion3, NL3D::PSMotion4, NL3D::TAnimationTime, uint, uint32, updateNewElementRequestStack(), and x.
01467 {
01468 CHECK_PS_INTEGRITY
01469 if (!_Size) return;
01470
01471
01472 if (pass == PSMotion)
01473 {
01474
01475 {
01476 MINI_TIMER(PSMotion1)
01477 // check wether we must perform LOD degradation
01478 if (_LODDegradation)
01479 {
01480 if (ellapsedTime > 0)
01481 {
01482 nlassert(_Owner);
01483 // compute the number of particles to show
01484 const uint maxToHave = (uint) (_MaxSize * _Owner->getOneMinusCurrentLODRatio());
01485 if (_Size > maxToHave) // too much instances ?
01486 {
01487 // choose a random element to start at, and a random step
01488 // this will avoid a pulse effect when the system is far away
01489
01490 uint pos = maxToHave ? rand() % maxToHave : 0;
01491 uint step = maxToHave ? rand() % maxToHave : 0;
01492
01493 do
01494 {
01495 deleteElement(pos);
01496 pos += step;
01497 if (pos >= maxToHave) pos -= maxToHave;
01498 }
01499 while (_Size !=maxToHave);
01500 }
01501 }
01502 }
01503 }
01504
01505
01506 // check if we must skip frames
01507 if (!_NbFramesToSkip || !( (uint32) _Owner->getDate() % (_NbFramesToSkip + 1)))
01508 {
01509
01510 {
01511 MINI_TIMER(PSMotion2)
01512 // update the located creation requests that may have been posted
01513 updateNewElementRequestStack();
01514 }
01515
01516 // there are 2 integration steps : with and without collisions
01517
01518 if (!_CollisionInfo) // no collisionner are used
01519 {
01520 {
01521 MINI_TIMER(PSMotion3)
01522 if (_Size != 0) // avoid referencing _Pos[0] if there's no size, causes STL vectors to assert...
01523 IntegrateSpeed(_Size * 3, &_Pos[0].x, &_Speed[0].x, ellapsedTime);
01524 }
01525 }
01526 else
01527 {
01528 {
01529 MINI_TIMER(PSMotion4)
01530 // integration with collisions
01531 nlassert(_CollisionInfo);
01532 TPSAttribCollisionInfo::iterator itc = _CollisionInfo->begin();
01533 TPSAttribVector::iterator itSpeed = _Speed.begin();
01534 TPSAttribVector::iterator itPos = _Pos.begin();
01535
01536 for (uint k = 0; k < _Size;)
01537 {
01538 if (itc->dist != -1)
01539 {
01540 (*itPos) = itc->newPos;
01541 (*itSpeed) = itc->newSpeed;
01542 // notify each located bindable that a bounce occured ...
01543 for (TLocatedBoundCont::iterator it = _LocatedBoundCont.begin(); it != _LocatedBoundCont.end(); ++it)
01544 {
01545 (*it)->bounceOccured(k);
01546 }
01547 switch(itc->collisionZone->getCollisionBehaviour())
01548 {
01549 case CPSZone::bounce:
01550 itc->reset();
01551 ++k, ++itPos, ++itSpeed, ++itc;
01552 break;
01553 case CPSZone::destroy:
01554 deleteElement(k);
01555 break;
01556 }
01557 }
01558 else
01559 {
01560 (*itPos) += ellapsedTime * (*itSpeed) * itc->TimeSliceRatio;
01561 itc->reset();
01562 ++k, ++itPos, ++itSpeed, ++itc;
01563 }
01564 }
01565
01566
01567 // reset collision info for the next time => done during the traversal
01569 }
01570 }
01571 }
01572 else
01573 {
01574 return; // we skip the frame...
01575 }
01576 }
01577
01578 if (pass != PSMotion)
01579 {
01580 {
01581 /*
01582 uint64 *target;
01583 switch(pass)
01584 {
01585 case PSEmit: target = &PSStatEmit; break;
01586 case PSCollision: target = &PSStatCollision; break;
01587 default:
01588 target = &PSStatRender;
01589 break;
01590 }
01591 MINI_TIMER(*target)
01592 */
01593 // apply the pass to all bound objects
01594 for (TLocatedBoundCont::iterator it = _LocatedBoundCont.begin(); it != _LocatedBoundCont.end(); ++it)
01595 {
01596 if ((*it)->isActive())
01597 {
01598 if ((*it)->getLOD() == PSLod1n2 || _Owner->getLOD() == (*it)->getLOD()) // has this object the right LOD ?
01599 {
01600 (*it)->step(pass, ellapsedTime, realEt);
01601 }
01602 }
01603 }
01604 }
01605 }
01606 else
01607 {
01608 for (TLocatedBoundCont::iterator it = _LocatedBoundCont.begin(); it != _LocatedBoundCont.end(); ++it)
01609 {
01610 if ((*it)->isActive())
01611 {
01612 (*it)->step(pass, ellapsedTime, realEt);
01613 }
01614 }
01615
01616 }
01617 CHECK_PS_INTEGRITY
01618 }
|
|
|
Test wether this located support parametric motion.
Definition at line 376 of file ps_located.cpp. References _NonIntegrableForceNbRefs, and _NumIntegrableForceWithDifferentBasis. Referenced by allocateParametricInfos(), enableParametricMotion(), integrateSingle(), and performParametricMotion().
00377 {
00378 return _NonIntegrableForceNbRefs == 0 && _NumIntegrableForceWithDifferentBasis == 0;
00379 }
|
|
|
***************************************************************************************
Reimplemented from NL3D::CParticleSystemProcess. Definition at line 173 of file ps_located.cpp. References _LocatedBoundCont, and CHECK_PS_INTEGRITY.
00174 {
00175 CHECK_PS_INTEGRITY
00176 for(TLocatedBoundCont::iterator it = _LocatedBoundCont.begin(); it != _LocatedBoundCont.end(); ++it)
00177 {
00178 (*it)->systemDateChanged();
00179 }
00180 CHECK_PS_INTEGRITY
00181 }
|
|
|
*************************************************************************************** Detach a bindable object from this located. Ownership is transferred to the caller Any reference the object may have in the system is lost (targets..) After that is may be inserted an other system. Definition at line 1902 of file ps_located.cpp. References _LocatedBoundCont, CHECK_PS_INTEGRITY, index, nlassert, NL3D::CPSLocatedBindable::setOwner(), and uint. Referenced by bind().
01903 {
01904 CHECK_PS_INTEGRITY
01905 nlassert(index < _LocatedBoundCont.size());
01906 CPSLocatedBindable *lb = _LocatedBoundCont[index];
01907 lb->setOwner(NULL);
01908 _LocatedBoundCont.erase(_LocatedBoundCont.begin() + index);
01909 return lb;
01910 CHECK_PS_INTEGRITY
01911 }
|
|
|
*************************************************************************************** remove a dtor observer (not present -> nlassert) see register dtor observer Definition at line 834 of file ps_located.cpp. References _DtorObserversVect, CHECK_PS_INTEGRITY, and nlassert. Referenced by NL3D::CPSLocatedBindable::notifyTargetRemoved(), NL3D::CPSEmitter::setEmittedType(), and NL3D::CPSEmitter::~CPSEmitter().
00835 {
00836 CHECK_PS_INTEGRITY
00837 // check that it was registered
00838 TDtorObserversVect::iterator it = std::find(_DtorObserversVect.begin(), _DtorObserversVect.end(), anObserver);
00839 nlassert(it != _DtorObserversVect.end());
00840 _DtorObserversVect.erase(it);
00841 CHECK_PS_INTEGRITY
00842 }
|
|
|
***************************************************************************************
Definition at line 1851 of file ps_located.cpp. References _IntegrableForces, _NumIntegrableForceWithDifferentBasis, CHECK_PS_INTEGRITY, NL3D::CParticleSystemProcess::getMatrixMode(), NL3D::CPSLocatedBindable::getOwner(), and nlassert. Referenced by NL3D::CPSForce::releaseTargetRsc().
01852 {
01853 CHECK_PS_INTEGRITY
01854 nlassert(f->getOwner()); // f must be attached to a located
01855 CPSVector<CPSForce *>::V::iterator it = std::find(_IntegrableForces.begin(), _IntegrableForces.end(), f);
01856 nlassert(it != _IntegrableForces.end() );
01857 _IntegrableForces.erase(it);
01858 if (getMatrixMode() != f->getOwner()->getMatrixMode())
01859 {
01860 --_NumIntegrableForceWithDifferentBasis;
01861 }
01862 CHECK_PS_INTEGRITY
01863 }
|
|
|
*************************************************************************************** all particles have the same lifetime Implements NL3D::CParticleSystemProcess. Definition at line 1621 of file ps_located.cpp. References _InitialLife, _LastForever, _LifeScheme, _TimeIncrement, NL3D::CPSAttrib< T >::begin(), CHECK_PS_INTEGRITY, deleteElement(), NL3D::CPSAttrib< T >::end(), NL3D::CParticleSystem::getSystemDate(), nlassert, size, NL3D::TAnimationTime, uint, and uint32.
01622 {
01623 CHECK_PS_INTEGRITY
01624 if (!_Size) return;
01625 if (! _LastForever)
01626 {
01627 if (_LifeScheme != NULL)
01628 {
01629 TPSAttribTime::iterator itTime = _Time.begin(), itTimeInc = _TimeIncrement.begin();
01630 for (uint32 k = 0; k < _Size;)
01631 {
01632 *itTime += ellapsedTime * *itTimeInc;
01633 if (*itTime >= 1.0f)
01634 {
01635 deleteElement(k);
01636 }
01637 else
01638 {
01639 ++k;
01640 ++itTime;
01641 ++itTimeInc;
01642 }
01643 }
01644 }
01645 else
01646 {
01647 if (_InitialLife != 0)
01648 {
01649 nlassert(_Owner);
01650 float timeInc = ellapsedTime * 1.f / _InitialLife;
01651 if (_Owner->getSystemDate() >= (_InitialLife - ellapsedTime))
01652 {
01653 TPSAttribTime::iterator itTime = _Time.begin();
01654 for (uint32 k = 0; k < _Size;)
01655 {
01656 *itTime += timeInc;
01657 if (*itTime >= 1.0f)
01658 {
01659 deleteElement(k);
01660 }
01661 else
01662 {
01663 ++k;
01664 ++itTime;
01665 }
01666 }
01667 }
01668 else
01669 {
01670 TPSAttribTime::iterator itTime = _Time.begin(), itEndTime = _Time.end();
01671 do
01672 {
01673 *itTime += timeInc;
01674 ++itTime;
01675 }
01676 while (itTime != itEndTime);
01677 }
01678 }
01679 else
01680 {
01681 uint size = _Size;
01682 do
01683 {
01684 deleteElement(0);
01685 }
01686 while (--size);
01687 }
01688 }
01689 }
01690 else
01691 {
01692 // the time attribute gives the life in seconds
01693 TPSAttribTime::iterator itTime = _Time.begin(), endItTime = _Time.end();
01694 for (; itTime != endItTime; ++itTime)
01695 {
01696 *itTime += ellapsedTime;
01697 }
01698 }
01699 CHECK_PS_INTEGRITY
01700 }
|
|
|
***************************************************************************************
Definition at line 1703 of file ps_located.cpp. References _RequestStack, CHECK_PS_INTEGRITY, newElement(), and NL3D::PSFXWorldMatrix. Referenced by step().
01704 {
01705 // TODO : update / remove this
01706 CHECK_PS_INTEGRITY
01707 while (!_RequestStack.empty())
01708 {
01709 newElement(_RequestStack.top()._Pos, _RequestStack.top()._Speed, NULL, 0, PSFXWorldMatrix, 0.f);
01710 _RequestStack.pop();
01711 }
01712 CHECK_PS_INTEGRITY
01713 }
|
|
|
Definition at line 588 of file ps_located.h. |
|
|
Used to solve collision detection it is not always instanciated Definition at line 657 of file ps_located.h. Referenced by checkIntegrity(), collisionUpdate(), deleteElement(), getCollisionInfo(), hasCollisionInfos(), newElement(), queryCollisionInfo(), releaseAllRef(), releaseCollisionInfo(), resetCollisionInfo(), resize(), step(), and ~CPSLocated(). |
|
|
Definition at line 662 of file ps_located.h. Referenced by queryCollisionInfo(), releaseAllRef(), releaseCollisionInfo(), and ~CPSLocated(). |
|
|
Definition at line 723 of file ps_located.h. Referenced by registerDtorObserver(), releaseAllRef(), releaseRefTo(), unregisterDtorObserver(), and ~CPSLocated(). |
|
|
Definition at line 667 of file ps_located.h. Referenced by evalMaxDuration(), getInitialLife(), newElement(), setInitialLife(), and updateLife(). |
|
|
Definition at line 672 of file ps_located.h. Referenced by getInitialMass(), newElement(), and setInitialMass(). |
|
|
Definition at line 736 of file ps_located.h. Referenced by integrateSingle(), performParametricMotion(), registerIntegrableForce(), releaseAllRef(), setMatrixMode(), unregisterIntegrableForce(), and ~CPSLocated(). |
|
|
Definition at line 620 of file ps_located.h. Referenced by checkIntegrity(), deleteElement(), getInvMass(), newElement(), and resize(). |
|
|
Definition at line 615 of file ps_located.h. Referenced by evalMaxDuration(), getLastForever(), setInitialLife(), setLastForever(), setLifeScheme(), and updateLife(). |
|
|
Definition at line 668 of file ps_located.h. Referenced by evalMaxDuration(), getLifeScheme(), newElement(), setInitialLife(), setLifeScheme(), updateLife(), and ~CPSLocated(). |
|
|
Definition at line 604 of file ps_located.h. Referenced by bind(), computeBBox(), deleteElement(), enumTexs(), getBoundObject(), getIndexOf(), getNbBoundObjects(), getUserMatrixUsageCount(), hasEmitters(), hasParticles(), isBound(), newElement(), notifyMaxNumFacesChanged(), notifyMotionTypeChanged(), releaseAllRef(), releaseRefTo(), remove(), resize(), setMatrixMode(), setZBias(), step(), systemDateChanged(), unbind(), and ~CPSLocated(). |
|
|
true when LOD degradation apply to this located
Definition at line 726 of file ps_located.h. Referenced by forceLODDegradation(), hasLODDegradation(), and step(). |
|
|
Definition at line 673 of file ps_located.h. Referenced by getMassScheme(), newElement(), setInitialMass(), setMassScheme(), and ~CPSLocated(). |
|
|
|
cache the max number of faces this located may want
Definition at line 592 of file ps_located.h. Referenced by notifyMaxNumFacesChanged(), and querryMaxWantedNumFaces(). |
|
|
Definition at line 607 of file ps_located.h. |
|
|
Definition at line 594 of file ps_located.h. |
|
|
Definition at line 597 of file ps_located.h. Referenced by getFrameRate(), setFrameRate(), and step(). |
|
|
number of force, and zones etc. that are not integrable over time. If this is not 0, then the trajectory cannot be computed at any time. A force that is integrable must be in the same basis than the located. Definition at line 731 of file ps_located.h. Referenced by addNonIntegrableForceRef(), releaseAllRef(), releaseNonIntegrableForceRef(), supportParametricMotion(), and ~CPSLocated(). |
|
|
number of forces that apply on that located that have the same basis that this one (required for parametric animation)
Definition at line 733 of file ps_located.h. Referenced by integrableForceBasisChanged(), registerIntegrableForce(), supportParametricMotion(), and unregisterIntegrableForce(). |
|
|
Definition at line 190 of file particle_system_process.h. Referenced by getConversionMatrix(). |
|
|
When set to true, this tells the system to use parametric motion. Only parametric forces must have been applied.
Definition at line 741 of file ps_located.h. Referenced by allocateParametricInfos(), bind(), deleteElement(), integrateSingle(), isParametricMotionEnabled(), newElement(), notifyMotionTypeChanged(), performParametricMotion(), releaseParametricInfos(), and resize(). |
|
|
WARNING : private use by forces only. this vector is only used if parametric motion is achievable and enabled, because of the extra storage space Definition at line 650 of file ps_located.h. Referenced by allocateParametricInfos(), deleteElement(), getParametricInfos(), integrateSingle(), newElement(), performParametricMotion(), releaseParametricInfos(), and resize(). |
|
|
Definition at line 621 of file ps_located.h. |
|
|
this stack is used after each update to generate located
Definition at line 693 of file ps_located.h. Referenced by postNewElement(), and updateNewElementRequestStack(). |
|
|
Definition at line 611 of file ps_located.h. |
|
|
Definition at line 622 of file ps_located.h. |
|
|
Definition at line 623 of file ps_located.h. |
|
|
Definition at line 624 of file ps_located.h. Referenced by checkIntegrity(), deleteElement(), getTimeIncrement(), newElement(), resize(), and updateLife(). |
|
|
Definition at line 738 of file ps_located.h. Referenced by deleteElement(), getTriggerEmitterID(), and setTriggerEmitterID(). |
|
|
Definition at line 737 of file ps_located.h. Referenced by deleteElement(), enableTriggerOnDeath(), getTriggerEmitterID(), isTriggerOnDeathEnabled(), and setTriggerEmitterID(). |
|
|
this is used to tell wether a newElement or a deleteElement if being performed During these method, creation should use postNewElement to generate new elements Because of the data structures (each located bindable are updated one after each other) inconsistency can happen, when a located generated another located of the same type when he's deleted. Definition at line 707 of file ps_located.h. Referenced by deleteElement(), and newElement(). |
1.3.6