NL3D::CPSBrownianForce Class Reference

#include <ps_force.h>

Inheritance diagram for NL3D::CPSBrownianForce:

NL3D::CPSForceIntensityHelper NL3D::CPSForce NL3D::CPSForceIntensity NL3D::CPSTargetLocatedBindable NL3D::CPSLocatedBindable NLMISC::IStreamable NLMISC::IClassable

Detailed Description

A Brownian motion

Definition at line 576 of file ps_force.h.

Public Member Functions

virtual void attachTarget (CPSLocated *ptr)
 inherited from CPSLocatedBindableTarget, we use that to tell wether this force is integrable or not

virtual bool completeBBox (NLMISC::CAABBox &box) const
NLMISC::CVector computeI (void) const
NLMISC::CVector computeJ (void) const
NLMISC::CVector computeK (void) const
 CPSBrownianForce (float intensity=1.f)
 ==========================================================

void detachTarget (CPSLocated *ptr)
virtual bool doesProduceBBox (void) const
 Override of CPSLocatedBindable::doesProduceBBox. forces usually are not part of the bbox.

virtual void enumTexs (std::vector< NLMISC::CSmartPtr< ITexture > > &dest, IDriver &drv)
virtual void finalize (void)
 ***************************************************************************************

virtual std::string getClassName ()=0
IDrivergetDriver () const
 shortcut to get an instance of the driver

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

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

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

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

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

float getIntensity (void) const
 get the constant intensity that was set for the force

const CPSAttribMaker< float > * getIntensityScheme (void) const
CPSAttribMaker< float > * getIntensityScheme (void)
 get the attribute maker for a non constant intensity

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

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

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

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

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

uint32 getNbTargets (void) const
 return the number of targets

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

CPSLocatedgetOwner (void)
 get the located that owns this bindable

float getParametricFactor () const
virtual uint32 getPriority (void) const
 return priority for forces

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

const CPSLocatedgetTarget (uint32 index) const
 Return a const ptr on a target. Invalid range -> nlassert.

CPSLocatedgetTarget (uint32 index)
 Return a ptr on a target. Invalid range -> nlassert.

uint32 getType (void) const
 return this bindable type

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

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

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

virtual void integrate (float date, CPSLocated *src, uint32 startIndex, uint32 numObjects, NLMISC::CVector *destPos=NULL, NLMISC::CVector *destSpeed=NULL, bool accumulate=false, uint posStride=sizeof(NLMISC::CVector), uint speedStride=sizeof(NLMISC::CVector))
 ==========================================================

virtual void integrateSingle (float startDate, float deltaT, uint numStep, CPSLocated *src, uint32 indexInLocated, NLMISC::CVector *destPos, bool accumulate=false, uint posStride=sizeof(NLMISC::CVector))
 ==========================================================

bool isActive () const
virtual bool isIntegrable (void) const
 check wether this force is integrable over time. The default is false

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

virtual void performDynamic (TAnimationTime ellapsedTime)
 ==========================================================

virtual void releaseAllRef ()
 ***************************************************************************************

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

void releaseTargetRsc (CPSLocated *target)
 inherited from CPSLocatedBindableTarget

void serial (NLMISC::IStream &f) throw (NLMISC::EStream)
 Serial the force definition. MUST be called by deriver during their serialisation.

void serialForceIntensity (NLMISC::IStream &f) throw (NLMISC::EStream)
void setActive (bool active)
 Activate / Deactivate this object. When not active, the owning system won't try to call the 'step' method.

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

void setIntensity (float value)
 ==========================================================

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

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

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

virtual void setupFunctor (uint32 indexInLocated)
virtual void setZBias (float value)
void show (TAnimationTime ellapsedTime)
 Show the force (edition mode).

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

Static Public Member Functions

void initPrecalc ()
 ==========================================================


Data Fields

virtual NLMISC_DECLARE_CLASS(CPSBrownianForce) virtual
void serial(NLMISC boo 
isIntegrable )(void) const
 ==========================================================


Protected Types

typedef CPSVector< CPSLocated
* >::V 
TTargetCont

Protected Member Functions

virtual void basisChanged (TPSMatrixMode systemBasis)
virtual void bounceOccured (uint32 index)
void cancelIntegrable (void)
 if this force is not integrable anymore, it tells that to its targets

virtual void deleteElement (uint32 index)
void deleteForceIntensityElement (uint32 index)
void displayIcon2d (const NLMISC::CVector tab[], uint nbSegs, float scale)
 ***************************************************************************************

virtual CPSLocatedgetForceIntensityOwner (void)
 deriver must return the located that own them here

virtual void newElement (CPSLocated *emitterLocated, uint32 emitterIndex)
void newForceIntensityElement (CPSLocated *emitterLocated, uint32 emitterIndex)
virtual void notifyTargetRemoved (CPSLocated *ptr)
 ***************************************************************************************

void registerToTargets (void)
 register integrable and non-integrable forces to the targets

void renewIntegrable (void)
 if this force has become integrable again, this method tells it to the target

virtual void resize (uint32 size)
void resizeForceIntensity (uint32 size)
virtual void setOwner (CPSLocated *psl)
 ***************************************************************************************


Protected Attributes

bool _Active
uint32 _ExternID
CPSAttribMaker< float > * _IntensityScheme
float _K
TPSLod _LOD
 tells when this object must be dealt with

std::string _Name
CPSLocated_Owner
float _ParametricFactor
TTargetCont _Targets

Static Protected Attributes

NLMISC::CVector PrecomputedImpulsions []
 various impulsion for normal motion

NLMISC::CVector PrecomputedPos []
 used to avoid to have to call rand for each particle the force applies on...

NLMISC::CVector PrecomputedSpeed []

Friends

class CPSForceIntensity
class CPSLocated


Member Typedef Documentation

typedef CPSVector<CPSLocated *>::V NL3D::CPSTargetLocatedBindable::TTargetCont [protected, inherited]
 

Definition at line 1122 of file ps_located.h.


Constructor & Destructor Documentation

NL3D::CPSBrownianForce::CPSBrownianForce float  intensity = 1.f  ) 
 

==========================================================

Definition at line 1035 of file ps_force.cpp.

References setIntensity().

01035                                                              : _ParametricFactor(1.f)
01036 {
01037         setIntensity(intensity);
01038         if (CParticleSystem::getSerializeIdentifierFlag()) _Name = std::string("BrownianForce");
01039 
01040 }


Member Function Documentation

void NL3D::CPSForce::attachTarget CPSLocated ptr  )  [virtual, inherited]
 

inherited from CPSLocatedBindableTarget, we use that to tell wether this force is integrable or not

Reimplemented from NL3D::CPSTargetLocatedBindable.

Definition at line 94 of file ps_force.cpp.

References NL3D::CPSLocated::addNonIntegrableForceRef(), NL3D::CPSForce::isIntegrable(), nlassert, and NL3D::CPSLocated::registerIntegrableForce().

00095 {
00096         nlassert(_Owner);       
00097         CPSTargetLocatedBindable::attachTarget(ptr);
00098         // check wether we are integrable, and if so, add us to the list
00099         if (this->isIntegrable())
00100         {
00101                 ptr->registerIntegrableForce(this);
00102         }
00103         else
00104         {
00105                 ptr->addNonIntegrableForceRef();
00106         }
00107 }

void NL3D::CPSForce::basisChanged TPSMatrixMode  systemBasis  )  [protected, virtual, inherited]
 

inherited from CPSLocatedBindable. When we deal with integrable forces, they must be in the same basis than their target. If this change, we must notify the target of it.

Reimplemented from NL3D::CPSLocatedBindable.

Definition at line 123 of file ps_force.cpp.

References NL3D::CPSForce::isIntegrable().

00124 {
00125         if (!this->isIntegrable()) return;
00126         for (TTargetCont::iterator it = _Targets.begin(); it != _Targets.end(); ++it)
00127         {       
00128                 (*it)->integrableForceBasisChanged(matrixMode);
00129         }               
00130 }

virtual void NL3D::CPSLocatedBindable::bounceOccured uint32  index  )  [inline, protected, virtual, inherited]
 

a bounce occured, so some action could be done. The default behaviour does nothing

Parameters:
index the index of the element that bounced

Reimplemented in NL3D::CPSEmitter.

Definition at line 1011 of file ps_located.h.

References index, and uint32.

01011 {}

void NL3D::CPSForce::cancelIntegrable void   )  [protected, inherited]
 

if this force is not integrable anymore, it tells that to its targets

Definition at line 133 of file ps_force.cpp.

References NL3D::CParticleSystemProcess::getMatrixMode(), and nlassert.

Referenced by setIntensityScheme(), and NL3D::CPSGravity::setIntensityScheme().

00134 {
00135         nlassert(_Owner);       
00136         for (TTargetCont::iterator it = _Targets.begin(); it != _Targets.end(); ++it)
00137         {
00138                 if ((*it)->getMatrixMode() == _Owner->getMatrixMode())
00139                 {
00140                         (*it)->unregisterIntegrableForce(this);
00141                         (*it)->addNonIntegrableForceRef();
00142                 }
00143         }
00144 }

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

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

Definition at line 884 of file ps_located.h.

00884 { return false ;}

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

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

Definition at line 931 of file ps_located.h.

References NL3D::CPSLocated::computeI().

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

00931 { return _Owner->computeI(); }

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

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

Definition at line 936 of file ps_located.h.

References NL3D::CPSLocated::computeJ().

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

00936 { return _Owner->computeJ(); }

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

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

Definition at line 940 of file ps_located.h.

References NL3D::CPSLocated::computeK().

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

00940 { return _Owner->computeK(); }

virtual void NL3D::CPSBrownianForce::deleteElement uint32  index  )  [inline, protected, virtual]
 

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

Reimplemented from NL3D::CPSForceIntensityHelper.

Definition at line 621 of file ps_force.h.

References NL3D::CPSForceIntensity::deleteForceIntensityElement(), index, and uint32.

00621 { deleteForceIntensityElement(index); }

void NL3D::CPSForceIntensity::deleteForceIntensityElement uint32  index  )  [inline, protected, inherited]
 

Definition at line 203 of file ps_force.h.

References NL3D::CPSForceIntensity::_IntensityScheme, NL3D::CPSAttribMaker< float >::deleteElement(), NL3D::CPSAttribMaker< float >::hasMemory(), index, and uint32.

Referenced by NL3D::CPSTurbul::deleteElement(), deleteElement(), NL3D::CPSFluidFriction::deleteElement(), and NL3D::CPSForceIntensityHelper::deleteElement().

00204         {
00205                 if (_IntensityScheme && _IntensityScheme->hasMemory()) _IntensityScheme->deleteElement(index);
00206         }

void NL3D::CPSTargetLocatedBindable::detachTarget CPSLocated ptr  )  [inline, inherited]
 

remove a target

See also:
attachTarget

Definition at line 1076 of file ps_located.h.

References NL3D::CPSTargetLocatedBindable::notifyTargetRemoved().

01077         {
01078                 notifyTargetRemoved(ptr);
01079         }

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

***************************************************************************************

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

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

Definition at line 2038 of file ps_located.cpp.

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

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

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

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

Override of CPSLocatedBindable::doesProduceBBox. forces usually are not part of the bbox.

Reimplemented from NL3D::CPSLocatedBindable.

Definition at line 67 of file ps_force.h.

00067 { return false; }

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

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

Definition at line 977 of file ps_located.h.

00977 {}

void NL3D::CPSTargetLocatedBindable::finalize void   )  [virtual, inherited]
 

***************************************************************************************

Release the collisionInfos we've querried. We can't do it in the dtor, as calls to releaseTargetRsc wouldn't be polymorphics for derived class! And the behaviour of releaseTergetRsc is implemented in derived class

Reimplemented from NL3D::CPSLocatedBindable.

Definition at line 2238 of file ps_located.cpp.

References NL3D::CPSTargetLocatedBindable::_Targets, and NL3D::CPSTargetLocatedBindable::releaseTargetRsc().

02239 {       
02243         for (TTargetCont::iterator it = _Targets.begin(); it != _Targets.end(); ++it)
02244         {               
02245                 releaseTargetRsc(*it);
02246         }
02247         CPSLocatedBindable::finalize(); 
02248 }

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

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

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

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

shortcut to get an instance of the driver

Definition at line 890 of file ps_located.h.

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

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

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

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

get the extern ID of this located bindable

Definition at line 964 of file ps_located.h.

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

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

00964 { return _ExternID; }

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

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

Definition at line 904 of file ps_located.h.

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

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

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

Shortcut to get the font generator if one was set.

Definition at line 897 of file ps_located.h.

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

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

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

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

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

Definition at line 2099 of file ps_located.cpp.

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

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

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

***************************************************************************************

Definition at line 2091 of file ps_located.cpp.

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

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

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

virtual CPSLocated* NL3D::CPSBrownianForce::getForceIntensityOwner void   )  [inline, protected, virtual]
 

deriver must return the located that own them here

Reimplemented from NL3D::CPSForceIntensityHelper.

Definition at line 619 of file ps_force.h.

00619 { return _Owner; }

float NL3D::CPSForceIntensity::getIntensity void   )  const [inline, inherited]
 

get the constant intensity that was set for the force

Definition at line 173 of file ps_force.h.

References NL3D::CPSForceIntensity::_K.

00173 { return _K; }

const CPSAttribMaker<float>* NL3D::CPSForceIntensity::getIntensityScheme void   )  const [inline, inherited]
 

Definition at line 186 of file ps_force.h.

References NL3D::CPSForceIntensity::_IntensityScheme.

00186 { return _IntensityScheme; }

CPSAttribMaker<float>* NL3D::CPSForceIntensity::getIntensityScheme void   )  [inline, inherited]
 

get the attribute maker for a non constant intensity

Definition at line 185 of file ps_force.h.

References NL3D::CPSForceIntensity::_IntensityScheme.

00185 { return _IntensityScheme; }

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

shortcut to get the inverted matrix of the system

Definition at line 2116 of file ps_located.cpp.

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

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

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

shortcut to get the inverted view matrix

Definition at line 2134 of file ps_located.cpp.

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

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

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

Shortcut to get the local to world matrix.

Definition at line 1144 of file ps_located.h.

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

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

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

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

get the valid lods for that object

Definition at line 954 of file ps_located.h.

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

00954 { return _LOD; }

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

get the located bindable name (edition purpose)

Definition at line 948 of file ps_located.h.

00948 { return _Name; }       

uint32 NL3D::CPSTargetLocatedBindable::getNbTargets void   )  const [inline, inherited]
 

return the number of targets

Definition at line 1091 of file ps_located.h.

References NL3D::CPSTargetLocatedBindable::_Targets, and uint32.

Referenced by NL3D::CParticleSystem::getTargeters().

01091 { return _Targets.size(); }

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

get the located that owns this bindable (const version)

Definition at line 944 of file ps_located.h.

00944 { return _Owner; }              

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

get the located that owns this bindable

Definition at line 942 of file ps_located.h.

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

00942 { return _Owner; }

float NL3D::CPSBrownianForce::getParametricFactor  )  const [inline]
 

Definition at line 616 of file ps_force.h.

References _ParametricFactor.

00616 { return _ParametricFactor; }

virtual uint32 NL3D::CPSForce::getPriority void   )  const [inline, virtual, inherited]
 

return priority for forces

Implements NL3D::CPSLocatedBindable.

Definition at line 64 of file ps_force.h.

References uint32.

00064 { return 4000; }

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

***************************************************************************************

Definition at line 2108 of file ps_located.cpp.

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

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

const CPSLocated* NL3D::CPSTargetLocatedBindable::getTarget uint32  index  )  const [inline, inherited]
 

Return a const ptr on a target. Invalid range -> nlassert.

Definition at line 1099 of file ps_located.h.

References NL3D::CPSTargetLocatedBindable::_Targets, index, nlassert, and uint32.

01100         {
01101                 nlassert(index < _Targets.size());
01102                 return _Targets[index];
01103         }               

CPSLocated* NL3D::CPSTargetLocatedBindable::getTarget uint32  index  )  [inline, inherited]
 

Return a ptr on a target. Invalid range -> nlassert.

Definition at line 1093 of file ps_located.h.

References NL3D::CPSTargetLocatedBindable::_Targets, index, nlassert, and uint32.

Referenced by NL3D::CParticleSystem::getTargeters().

01094         {
01095                 nlassert(index < _Targets.size());
01096                 return _Targets[index];
01097         }

uint32 NL3D::CPSForce::getType void   )  const [inline, virtual, inherited]
 

return this bindable type

Implements NL3D::CPSLocatedBindable.

Definition at line 59 of file ps_force.h.

References NL3D::PSForce, and uint32.

00059 { return PSForce; }

virtual bool NL3D::CPSLocatedBindable::getUserMatrixUsageCount  )  const [inline, virtual, inherited]
 

Reimplemented in NL3D::CPSEmitter.

Definition at line 974 of file ps_located.h.

Referenced by NL3D::CPSLocatedBindable::finalize(), and NL3D::CPSLocatedBindable::setOwner().

00974 { return 0; }

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

shortcut to get the view matrix

Definition at line 2125 of file ps_located.cpp.

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

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

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

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

tells wether there are alive emitters

Definition at line 958 of file ps_located.h.

00958 { return false; }

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

tells wether there are alive entities / particles

Reimplemented in NL3D::CPSParticle.

Definition at line 956 of file ps_located.h.

00956 { return false; }

void NL3D::CPSBrownianForce::initPrecalc  )  [static]
 

==========================================================

create the pos table

Definition at line 1232 of file ps_force.cpp.

References NL3D::BFNumPrecomputedImpulsions, NL3D::BFNumPredefinedPos, NL3D::BFPredefinedNumInterp, nlassert, PrecomputedImpulsions, PrecomputedPos, PrecomputedSpeed, NLMISC::CVector::set(), and uint.

01233 {       
01235         nlassert(BFNumPredefinedPos % BFPredefinedNumInterp == 0);
01236         
01237         NLMISC::CVector p0(0, 0, 0), p1;
01238         const uint numStep = BFNumPredefinedPos / BFPredefinedNumInterp;
01239         NLMISC::CVector *dest = PrecomputedPos;
01240         uint k, l;
01241         for (k = 0; k < numStep; ++k)
01242         {
01243                 if (k != numStep - 1)
01244                 {
01245                         p1.set(2.f * (NLMISC::frand(1.f) - 0.5f),
01246                                    2.f * (NLMISC::frand(1.f) - 0.5f),
01247                                    2.f * (NLMISC::frand(1.f) - 0.5f));
01248                 }
01249                 else
01250                 {
01251                         p1.set(0, 0, 0);
01252                 }
01253                 float lambda     = 0.f;
01254                 float lambdaStep = 1.f / BFPredefinedNumInterp;
01255                 for (l = 0; l < BFPredefinedNumInterp; ++l)
01256                 {
01257                         *dest++ = lambda * p1 + (1.f - lambda) * p0;
01258                         lambda += lambdaStep;
01259                 }
01260                 p0 = p1;                                
01261         }
01262 
01263         // now, filter the table several time to get something more smooth
01264         for (k = 0; k < (BFPredefinedNumInterp << 2) ; ++k)
01265         {
01266                 for (l = 1; l < (BFNumPredefinedPos - 1); ++l)
01267                 {
01268                         PrecomputedPos[l] = 0.5f * (PrecomputedPos[l - 1] + PrecomputedPos[l + 1]);
01269                 }
01270         }
01271 
01272 
01273         // compute the table of speeds, by using on a step of 1.s
01274         for (l = 1; l < (BFNumPredefinedPos - 1); ++l)
01275         {
01276                 PrecomputedSpeed[l] = 0.5f * (PrecomputedPos[l + 1] - PrecomputedPos[l - 1]);
01277         }
01278         PrecomputedSpeed[BFNumPredefinedPos - 1] = NLMISC::CVector::Null;
01279 
01280         // compute the table of impulsion
01281         for (k = 0; k < BFNumPrecomputedImpulsions; ++k)
01282         {
01283                 static double divRand = (2.f / RAND_MAX);
01284                 PrecomputedImpulsions[k].set( (float) (rand() * divRand - 1),
01285                                                                           (float) (rand() * divRand - 1),
01286                                                                           (float) (rand() * divRand - 1) 
01287                                                                         );
01288         }
01289 }

void NL3D::CPSBrownianForce::integrate float  date,
CPSLocated src,
uint32  startIndex,
uint32  numObjects,
NLMISC::CVector destPos = NULL,
NLMISC::CVector destSpeed = NULL,
bool  accumulate = false,
uint  posStride = sizeof(NLMISC::CVector),
uint  speedStride = sizeof(NLMISC::CVector)
[virtual]
 

==========================================================

MASS DIFFERENT FROM 1 IS NOT SUPPORTED

Reimplemented from NL3D::CPSForce.

Definition at line 1050 of file ps_force.cpp.

References _ParametricFactor, NL3D::BFNumPredefinedPos, index, NEXT_POS, NEXT_SPEED, PrecomputedPos, PrecomputedSpeed, NLMISC::CVector::set(), src, uint, uint32, NLMISC::CVector::x, NLMISC::CVector::y, and NLMISC::CVector::z.

01058 {
01060         float deltaT;
01061         if (!destPos && !destSpeed) return;
01062         CPSLocated::TPSAttribParametricInfo::const_iterator it = src->_PInfo.begin() + startIndex,
01063                                                                                                                 endIt = src->_PInfo.begin() + startIndex + numObjects;
01064         float lookUpFactor = _ParametricFactor * BFNumPredefinedPos;
01065         float speedFactor  = _ParametricFactor * _K;
01066         if (!accumulate) // compute coords from initial condition, and applying this force
01067         {
01068                 if (destPos && !destSpeed) // fills dest pos only
01069                 {
01070                         while (it != endIt)
01071                         {
01072                                 float deltaT = date - it->Date;
01073                                 uint index = (uint) (lookUpFactor * deltaT) & (BFNumPredefinedPos - 1);
01074                                 destPos->set(it->Pos.x + deltaT * it->Speed.x + _K * PrecomputedPos[index].x,
01075                                                          it->Pos.y + deltaT * it->Speed.y + _K * PrecomputedPos[index].y,
01076                                                          it->Pos.z + deltaT * it->Speed.z + _K * PrecomputedPos[index].z );
01077                                 ++it;
01078                                 NEXT_POS;       
01079                         }
01080                 }
01081                 else if (!destPos && destSpeed) // fills dest speed only
01082                 {
01083                         while (it != endIt)
01084                         {
01085                                 deltaT = date - it->Date;
01086                                 uint index = (uint) (lookUpFactor * deltaT) & (BFNumPredefinedPos - 1);
01087                                 destSpeed->x = it->Speed.x  + speedFactor * PrecomputedSpeed[index].x;                          
01088                                 destSpeed->y = it->Speed.y  + speedFactor * PrecomputedSpeed[index].y;
01089                                 destSpeed->z = it->Speed.z  + speedFactor * PrecomputedSpeed[index].z;
01090                                 ++it;
01091                                 NEXT_SPEED;     
01092                         }
01093                 }
01094                 else // fills both speed and pos
01095                 {
01096                         while (it != endIt)
01097                         {
01098                                 deltaT = date - it->Date;
01099                                 uint index = (uint) (lookUpFactor * deltaT) & (BFNumPredefinedPos - 1);
01100                                 destPos->x = it->Pos.x + deltaT * it->Speed.x + _K * PrecomputedPos[index].x;                           
01101                                 destPos->y = it->Pos.y + deltaT * it->Speed.y + _K * PrecomputedPos[index].y;
01102                                 destPos->z = it->Pos.z + deltaT * it->Speed.z + _K * PrecomputedPos[index].z;
01103 
01104                                 destSpeed->x = it->Speed.x + speedFactor * PrecomputedSpeed[index].x;                           
01105                                 destSpeed->y = it->Speed.y + speedFactor * PrecomputedSpeed[index].y;
01106                                 destSpeed->z = it->Speed.z + speedFactor * PrecomputedSpeed[index].z;
01107 
01108                                 ++it;
01109                                 NEXT_POS;
01110                                 NEXT_SPEED;
01111                         }
01112                 }
01113         }
01114         else // accumulate datas
01115         {
01116                 if (destPos && !destSpeed) // fills dest pos only
01117                 {
01118                         while (it != endIt)
01119                         {
01120                                 deltaT = date - it->Date;
01121                                 uint index = (uint) (lookUpFactor * deltaT) & (BFNumPredefinedPos - 1);
01122                                 destPos->set(destPos->x + _K * PrecomputedPos[index].x,
01123                                                          destPos->y + _K * PrecomputedPos[index].y,
01124                                                          destPos->z + _K * PrecomputedPos[index].z);
01125                                 ++it;
01126                                 NEXT_POS;       
01127                         }
01128                 }
01129                 else if (!destPos && destSpeed) // fills dest speed only
01130                 {
01131                         while (it != endIt)
01132                         {
01133                                 deltaT = date - it->Date;
01134                                 uint index = (uint) (lookUpFactor * deltaT) & (BFNumPredefinedPos - 1);
01135                                 destSpeed->set(destSpeed->x + speedFactor * PrecomputedSpeed[index].x,
01136                                                            destSpeed->y + speedFactor * PrecomputedSpeed[index].y,
01137                                                            destSpeed->z + speedFactor * PrecomputedSpeed[index].z);
01138                                 ++it;
01139                                 NEXT_SPEED;     
01140                         }
01141                 }
01142                 else // fills both speed and pos
01143                 {
01144                         while (it != endIt)
01145                         {
01146                                 deltaT = date - it->Date;
01147                                 uint index = (uint) (lookUpFactor * deltaT) & (BFNumPredefinedPos - 1);
01148                                 destPos->set(destPos->x + _K * PrecomputedPos[index].x,
01149                                                          destPos->y + _K * PrecomputedPos[index].y,
01150                                                          destPos->z + _K * PrecomputedPos[index].z);
01151                                 destSpeed->set(destSpeed->x + speedFactor * PrecomputedSpeed[index].x,
01152                                                            destSpeed->y + speedFactor * PrecomputedSpeed[index].y,
01153                                                            destSpeed->z + speedFactor * PrecomputedSpeed[index].z);     
01154                                 ++it;
01155                                 NEXT_POS;
01156                                 NEXT_SPEED;
01157                         }
01158                 }
01159         }       
01160 }

void NL3D::CPSBrownianForce::integrateSingle float  startDate,
float  deltaT,
uint  numStep,
CPSLocated src,
uint32  indexInLocated,
NLMISC::CVector destPos,
bool  accumulate = false,
uint  stride = sizeof(NLMISC::CVector)
[virtual]
 

==========================================================

fill start of datas (particle didn't exist at that time, so we fill by the start position)

Reimplemented from NL3D::CPSForce.

Definition at line 1164 of file ps_force.cpp.

References _ParametricFactor, NL3D::BFNumPredefinedPos, NL3D::BFPredefinedNumInterp, NL3D::CPSLocated::CParametricInfo::Date, NL3D::FillBufUsingSubdiv(), index, nlassert, NL3D::CPSLocated::CParametricInfo::Pos, PrecomputedPos, NL3D::ScaleFloatGE(), NL3D::CPSLocated::CParametricInfo::Speed, src, stride, uint, uint32, uint8, NLMISC::CVector::x, NLMISC::CVector::y, and NLMISC::CVector::z.

01169 {
01170         nlassert(src->isParametricMotionEnabled());
01171         nlassert(deltaT > 0);
01172         nlassert(numStep > 0);
01173         #ifdef NL_DEBUG
01174                 NLMISC::CVector *endPos = (NLMISC::CVector *) ( (uint8 *) destPos + stride * numStep);
01175         #endif
01176         const CPSLocated::CParametricInfo &pi = src->_PInfo[indexInLocated];
01177         const NLMISC::CVector &startPos   = pi.Pos;     
01178         if (numStep != 0)
01179         {
01180                 float lookUpFactor = _ParametricFactor * BFPredefinedNumInterp;
01181                 if (!accumulate)
01182                 {                               
01184                         destPos = FillBufUsingSubdiv(startPos, pi.Date, startDate, deltaT, numStep, destPos, stride);
01185                         if (numStep != 0)
01186                         {
01187                                 float currDate = startDate - pi.Date;
01188                                 nlassert(currDate >= 0);                                
01189                                 const NLMISC::CVector &startSpeed = pi.Speed;                   
01190                                 do
01191                                 {
01192                                         #ifdef NL_DEBUG
01193                                                 nlassert(destPos < endPos);
01194                                         #endif
01195                                         uint index = (uint) (lookUpFactor * currDate) & (BFNumPredefinedPos - 1);
01196                                         destPos->x = startPos.x + currDate * startSpeed.x + _K * PrecomputedPos[index].x;
01197                                         destPos->y = startPos.y + currDate * startSpeed.y + _K * PrecomputedPos[index].y;
01198                                         destPos->z = startPos.z + currDate * startSpeed.z + _K * PrecomputedPos[index].z;
01199                                         currDate += deltaT;
01200                                         destPos = (NLMISC::CVector *) ( (uint8 *) destPos + stride);
01201                                 }
01202                                 while (--numStep);
01203                         }
01204                 }
01205                 else
01206                 {
01207                         uint numToSkip = ScaleFloatGE(startDate, deltaT, pi.Date, numStep);             
01208                         if (numToSkip < numStep)
01209                         {
01210                                 numStep -= numToSkip;                           
01211                                 float currDate = startDate + deltaT * numToSkip - pi.Date;
01212                                 do
01213                                 {
01214                                         #ifdef NL_DEBUG
01215                                                 nlassert(destPos < endPos);
01216                                         #endif
01217                                         uint index = (uint) (lookUpFactor * currDate) & (BFNumPredefinedPos - 1);
01218                                         destPos->x += _K * PrecomputedPos[index].x;
01219                                         destPos->y += _K * PrecomputedPos[index].y;
01220                                         destPos->z += _K * PrecomputedPos[index].z;
01221                                         currDate += deltaT;
01222                                         destPos = (NLMISC::CVector *) ( (uint8 *) destPos + stride);
01223                                 }
01224                                 while (--numStep);                              
01225                         }
01226                 }
01227         }       
01228 }

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

Definition at line 844 of file ps_located.h.

References NL3D::CPSLocatedBindable::_Active.

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

00844 { return _Active; }                             

virtual bool NL3D::CPSForce::isIntegrable void   )  const [inline, virtual, inherited]
 

check wether this force is integrable over time. The default is false

Reimplemented in NL3D::CPSGravity.

Definition at line 85 of file ps_force.h.

Referenced by NL3D::CPSForce::attachTarget(), NL3D::CPSForce::basisChanged(), NL3D::CPSForce::registerToTargets(), and NL3D::CPSForce::releaseTargetRsc().

00085 { return false; }

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

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

Reimplemented in NL3D::CPSRibbonBase.

Definition at line 971 of file ps_located.h.

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

00971 {}

virtual void NL3D::CPSBrownianForce::newElement CPSLocated emitterLocated,
uint32  emitterIndex
[inline, protected, virtual]
 

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

Reimplemented from NL3D::CPSForceIntensityHelper.

Definition at line 620 of file ps_force.h.

References NL3D::CPSForceIntensity::newForceIntensityElement(), and uint32.

00620 { newForceIntensityElement(emitterLocated, emitterIndex); }

void NL3D::CPSForceIntensity::newForceIntensityElement CPSLocated emitterLocated,
uint32  emitterIndex
[inline, protected, inherited]
 

Definition at line 199 of file ps_force.h.

References NL3D::CPSForceIntensity::_IntensityScheme, NL3D::CPSAttribMaker< float >::hasMemory(), NL3D::CPSAttribMaker< float >::newElement(), and uint32.

Referenced by NL3D::CPSTurbul::newElement(), newElement(), NL3D::CPSFluidFriction::newElement(), and NL3D::CPSForceIntensityHelper::newElement().

00200         {
00201                 if (_IntensityScheme && _IntensityScheme->hasMemory()) _IntensityScheme->newElement(emitterLocated, emitterIndex);
00202         }       

void NL3D::CPSTargetLocatedBindable::notifyTargetRemoved CPSLocated ptr  )  [protected, virtual, inherited]
 

***************************************************************************************

Inherited from CPSLocatedBindable. A target has been remove If not present -> assert This also call releaseTargetRsc for clean up

Reimplemented from NL3D::CPSLocatedBindable.

Definition at line 2223 of file ps_located.cpp.

References NL3D::CPSTargetLocatedBindable::_Targets, nlassert, and NL3D::CPSTargetLocatedBindable::releaseTargetRsc().

Referenced by NL3D::CPSTargetLocatedBindable::detachTarget().

02224 {       
02225         TTargetCont::iterator it = std::find(_Targets.begin(), _Targets.end(), ptr);
02226         nlassert(it != _Targets.end());
02227         releaseTargetRsc(*it);  
02228         _Targets.erase(it);
02229 
02230         CPSLocatedBindable::notifyTargetRemoved(ptr);   
02231 }

void NL3D::CPSBrownianForce::performDynamic TAnimationTime  ellapsedTime  )  [virtual]
 

==========================================================

start at a random position in the precomp impulsion tab

Implements NL3D::CPSForce.

Definition at line 1317 of file ps_force.cpp.

References NL3D::BFNumPrecomputedImpulsions, NL3D::CPSAttribMaker< float >::get(), NL3D::CPSLocated::getSize(), min, PrecomputedImpulsions, size, NL3D::TAnimationTime, uint, uint32, NLMISC::CVector::x, and NLMISC::CVector::y.

01318 {
01319         // perform the operation on each target 
01320         for (uint32 k = 0; k < _Owner->getSize(); ++k)
01321         {               
01322                 float intensity = _IntensityScheme ? _IntensityScheme->get(_Owner, k) : _K;
01323                 for (TTargetCont::iterator it = _Targets.begin(); it != _Targets.end(); ++it)
01324                 {                       
01325                         uint32 size = (*it)->getSize();
01326 
01327                         if (!size) continue;
01328 
01329                         TPSAttribVector::iterator it2 = (*it)->getSpeed().begin(), it2End;
01331                         uint startPos = (uint) ::rand() % BFNumPrecomputedImpulsions;
01332                         NLMISC::CVector *imp = PrecomputedImpulsions + startPos;
01333 
01334                         if ((*it)->getMassScheme())
01335                         {
01336                                 float intensityXtime = intensity * ellapsedTime;
01337                                 TPSAttribFloat::const_iterator invMassIt = (*it)->getInvMass().begin();                                         
01338                                 do
01339                                 {                       
01340                                         uint toProcess = std::min((uint) (BFNumPrecomputedImpulsions - startPos), (uint) size);
01341                                         it2End = it2 + toProcess;
01342                                         do
01343                                         {
01344                                                 float factor = intensityXtime * *invMassIt;
01345                                                 it2->set(it2->x + factor * imp->x,
01346                                                                 it2->y + factor * imp->y,
01347                                                                 it2->z + factor * imp->x);
01348                                                 ++invMassIt;
01349                                                 ++imp;
01350                                                 ++it2;
01351                                         }
01352                                         while (it2 != it2End);
01353                                         startPos = 0;
01354                                         imp = PrecomputedImpulsions;    
01355                                         size -= toProcess;
01356                                 }
01357                                 while (size != 0);
01358                         }
01359                         else
01360                         {                               
01361                                 do
01362                                 {                       
01363                                         uint toProcess = std::min((uint) (BFNumPrecomputedImpulsions - startPos) , (uint) size);
01364                                         it2End = it2 + toProcess;
01365                                         float factor = intensity * ellapsedTime / (*it)->getInitialMass();
01366                                         do
01367                                         {                                               
01368                                                 it2->set(it2->x + factor * imp->x,
01369                                                                 it2->y + factor * imp->y,
01370                                                                 it2->z + factor * imp->x);                                              
01371                                                 ++imp;
01372                                                 ++it2;
01373                                         }
01374                                         while (it2 != it2End);
01375                                         startPos = 0;
01376                                         imp = PrecomputedImpulsions;    
01377                                         size -= toProcess;
01378                                 }
01379                                 while (size != 0);
01380                         }                       
01381                 }
01382         }       
01383 }

void NL3D::CPSForce::registerToTargets void   )  [protected, inherited]
 

register integrable and non-integrable forces to the targets

Definition at line 62 of file ps_force.cpp.

References NL3D::CPSForce::isIntegrable().

Referenced by NL3D::CPSTurbul::NLMISC_DECLARE_CLASS(), and NL3D::CPSFluidFriction::NLMISC_DECLARE_CLASS().

00063 {
00064         for (TTargetCont::iterator it = _Targets.begin(); it != _Targets.end(); ++it)
00065         {
00066                 if (this->isIntegrable())
00067                 {                                               
00068                         (*it)->registerIntegrableForce(this);
00069                 }
00070                 else
00071                 {
00072                         (*it)->addNonIntegrableForceRef();
00073                 }
00074         }
00075 }

void NL3D::CPSTargetLocatedBindable::releaseAllRef  )  [virtual, inherited]
 

***************************************************************************************

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

Reimplemented from NL3D::CPSLocatedBindable.

Definition at line 2272 of file ps_located.cpp.

References NL3D::CPSTargetLocatedBindable::_Targets, and NL3D::CPSTargetLocatedBindable::releaseTargetRsc().

02273 {
02274         for (TTargetCont::iterator it = _Targets.begin(); it != _Targets.end(); ++it)
02275         {
02276                 releaseTargetRsc(*it);
02277                 (*it)->unregisterDtorObserver(this);            
02278         }
02279         _Targets.clear();
02280         CPSLocatedBindable::releaseAllRef();
02281 }

void NL3D::CPSTargetLocatedBindable::releaseRefTo const CParticleSystemProcess other  )  [virtual, inherited]
 

***************************************************************************************

From CPSLocatedBindable. Release any reference this obj may have on the given process. For example, this is used when detaching a located of a system.

Reimplemented from NL3D::CPSLocatedBindable.

Definition at line 2261 of file ps_located.cpp.

References NL3D::CPSTargetLocatedBindable::_Targets, nlassert, and NL3D::CPSTargetLocatedBindable::releaseTargetRsc().

02262 {
02263         TTargetCont::iterator it = std::find(_Targets.begin(), _Targets.end(), other);
02264         if (it == _Targets.end()) return;
02265         releaseTargetRsc(*it);
02266         (*it)->unregisterDtorObserver(this);
02267         _Targets.erase(it);
02268         nlassert(std::find(_Targets.begin(), _Targets.end(), other) == _Targets.end());
02269 }

void NL3D::CPSForce::releaseTargetRsc CPSLocated target  )  [virtual, inherited]
 

inherited from CPSLocatedBindableTarget

Reimplemented from NL3D::CPSTargetLocatedBindable.

Definition at line 109 of file ps_force.cpp.

References NL3D::CPSForce::isIntegrable(), NL3D::CPSLocated::releaseNonIntegrableForceRef(), and NL3D::CPSLocated::unregisterIntegrableForce().

00110 {
00111         if (this->isIntegrable())
00112         {
00113                 target->unregisterIntegrableForce(this);
00114         }
00115         else
00116         {
00117                 target->releaseNonIntegrableForceRef();
00118         }       
00119 }

void NL3D::CPSForce::renewIntegrable void   )  [protected, inherited]
 

if this force has become integrable again, this method tells it to the target

Definition at line 147 of file ps_force.cpp.

References NL3D::CParticleSystemProcess::getMatrixMode(), and nlassert.

Referenced by setIntensity(), and NL3D::CPSGravity::setIntensity().

00148 {
00149         nlassert(_Owner);       
00150         for (TTargetCont::iterator it = _Targets.begin(); it != _Targets.end(); ++it)
00151         {
00152                 if ((*it)->getMatrixMode() == _Owner->getMatrixMode())
00153                 {
00154                         (*it)->registerIntegrableForce(this);
00155                         (*it)->releaseNonIntegrableForceRef();
00156                 }
00157         }
00158 }

virtual void NL3D::CPSBrownianForce::resize uint32  size  )  [inline, protected, virtual]
 

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

Reimplemented from NL3D::CPSForceIntensityHelper.

Definition at line 622 of file ps_force.h.

References NL3D::CPSForceIntensity::resizeForceIntensity(), size, and uint32.

00622 { resizeForceIntensity(size); }

void NL3D::CPSForceIntensity::resizeForceIntensity uint32  size  )  [inline, protected, inherited]
 

Definition at line 207 of file ps_force.h.

References NL3D::CPSForceIntensity::_IntensityScheme, NL3D::CPSForceIntensity::getForceIntensityOwner(), NL3D::CPSAttribMaker< float >::hasMemory(), NL3D::CPSAttribMaker< float >::resize(), size, and uint32.

Referenced by NL3D::CPSTurbul::resize(), resize(), NL3D::CPSFluidFriction::resize(), and NL3D::CPSForceIntensityHelper::resize().

00208         {
00209                 if (_IntensityScheme && _IntensityScheme->hasMemory()) _IntensityScheme->resize(size, getForceIntensityOwner()->getSize());
00210         }

void NL3D::CPSForceIntensityHelper::serial NLMISC::IStream f  )  throw (NLMISC::EStream) [virtual, inherited]
 

Serial the force definition. MUST be called by deriver during their serialisation.

Reimplemented from NL3D::CPSForce.

Reimplemented in NL3D::CPSDirectionnalForce, NL3D::CPSGravity, NL3D::CPSCentralGravity, NL3D::CPSSpring, NL3D::CPSCylindricVortex, and NL3D::CPSMagneticForce.

Definition at line 229 of file ps_force.cpp.

00230 {
00231         f.serialVersion(1);
00232         CPSForce::serial(f);
00233         serialForceIntensity(f);
00234         if (f.isReading())
00235         {
00236                 registerToTargets();
00237         }
00238 }

void NL3D::CPSForceIntensity::serialForceIntensity NLMISC::IStream f  )  throw (NLMISC::EStream) [inherited]
 

Definition at line 190 of file ps_force.cpp.

Referenced by NL3D::CPSTurbul::NLMISC_DECLARE_CLASS(), and NL3D::CPSFluidFriction::NLMISC_DECLARE_CLASS().

00191 {       
00192         f.serialVersion(1);
00193         if (!f.isReading())
00194         {
00195                 if (_IntensityScheme)
00196                 {
00197                         bool bFalse = false;
00198                         f.serial(bFalse);
00199                         f.serialPolyPtr(_IntensityScheme);
00200                 }
00201                 else
00202                 {
00203                         bool bTrue = true;
00204                         f.serial(bTrue);
00205                         f.serial(_K);
00206                 }
00207         }
00208         else
00209         {
00210                 bool constantIntensity;
00211                 f.serial(constantIntensity);
00212                 if (constantIntensity)
00213                 {
00214                         f.serial(_K);
00215                 }
00216                 else
00217                 {
00218                         f.serialPolyPtr(_IntensityScheme);
00219                 }
00220         }       
00221 }

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

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

Definition at line 843 of file ps_located.h.

References NL3D::CPSLocatedBindable::_Active.

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

00843 { _Active = active; }

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

***************************************************************************************

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

Definition at line 2149 of file ps_located.cpp.

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

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

void NL3D::CPSBrownianForce::setIntensity float  value  )  [virtual]
 

==========================================================

Reimplemented from NL3D::CPSForceIntensity.

Definition at line 1292 of file ps_force.cpp.

References NL3D::CPSForce::renewIntegrable(), and value.

Referenced by CPSBrownianForce().

01293 {
01294         if (_IntensityScheme)
01295         {
01296                 CPSForceIntensity::setIntensity(value);
01297                 renewIntegrable(); // integrable again
01298         }
01299         else
01300         {
01301                 CPSForceIntensity::setIntensity(value);
01302         }
01303 }

void NL3D::CPSBrownianForce::setIntensityScheme CPSAttribMaker< float > *  scheme  )  [virtual]
 

==========================================================

Reimplemented from NL3D::CPSForceIntensity.

Definition at line 1307 of file ps_force.cpp.

References NL3D::CPSForce::cancelIntegrable().

01308 {
01309         if (!_IntensityScheme)
01310         {
01311                 cancelIntegrable(); // not integrable anymore
01312         }                       
01313         CPSForceIntensity::setIntensityScheme(scheme);  
01314 }

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

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

Definition at line 952 of file ps_located.h.

References NL3D::CPSLocatedBindable::_LOD.

00952 { _LOD = lod; }

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

set the located bindable name (edition purpose)

Definition at line 946 of file ps_located.h.

00946 { _Name = name; }

void NL3D::CPSLocatedBindable::setOwner CPSLocated psl  )  [protected, virtual, inherited]
 

***************************************************************************************

Reimplemented in NL3D::CPSEmitter.

Definition at line 1948 of file ps_located.cpp.

References NL3D::CParticleSystem::addRefForUserSysCoordInfo(), NL3D::CPSLocatedBindable::deleteElement(), NL3D::CParticleSystemProcess::getOwner(), NL3D::CPSLocated::getSize(), NL3D::CPSLocatedBindable::getUserMatrixUsageCount(), NL3D::CPSLocatedBindable::releaseAllRef(), NL3D::CParticleSystem::releaseRefForUserSysCoordInfo(), and uint.

Referenced by NL3D::CPSLocated::bind(), and NL3D::CPSLocated::unbind().

01949 { 
01950         if (psl == _Owner) return;
01951         if (psl == NULL)
01952         {
01953                 releaseAllRef();
01954                 if (_Owner)
01955                 {
01956                         // empty this located bindable. Need to be empty if it must be rebound to another located.
01957                         for (uint k = 0; k < _Owner->getSize(); ++k)
01958                         {
01959                                 deleteElement(0);
01960                         }
01961                 }                               
01962         }       
01963         if (_Owner && _Owner->getOwner())
01964         {
01965                 _Owner->getOwner()->releaseRefForUserSysCoordInfo(getUserMatrixUsageCount());
01966         }
01967         _Owner = psl;
01968         if (_Owner && _Owner->getOwner())
01969         {
01970                 _Owner->getOwner()->addRefForUserSysCoordInfo(getUserMatrixUsageCount());
01971         } 
01972 }

void NL3D::CPSBrownianForce::setParametricFactor float  factor  )  [inline]
 

When used with parametric integration, this tells factor tells how fast the force acts on particle (how fast it go through the lookup table in fact)

Definition at line 615 of file ps_force.h.

References _ParametricFactor.

00615 {  _ParametricFactor = factor; }

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

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

Definition at line 2142 of file ps_located.cpp.

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

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

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

virtual void NL3D::CPSForceIntensity::setupFunctor uint32  indexInLocated  )  [inline, virtual, inherited]
 

Reimplemented in NL3D::CPSFluidFriction, and NL3D::CPSTurbul.

Definition at line 182 of file ps_force.h.

References uint32.

00182 { }

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

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

Definition at line 980 of file ps_located.h.

References value.

00980 {}

void NL3D::CPSBrownianForce::show TAnimationTime  ellapsedTime  )  [inline, virtual]
 

Show the force (edition mode).

Implements NL3D::CPSForce.

Definition at line 609 of file ps_force.h.

References NL3D::TAnimationTime.

00609 {}

void NL3D::CPSForce::step TPSProcessPass  pass,
TAnimationTime  ellapsedTime,
TAnimationTime  realEllapsedTime
[virtual, inherited]
 

process one pass for the force

Implements NL3D::CPSLocatedBindable.

Definition at line 78 of file ps_force.cpp.

References NL3D::CPSForce::performDynamic(), NL3D::PSMotion, NL3D::PSToolRender, NL3D::CPSForce::show(), and NL3D::TAnimationTime.

00079 {
00080         switch(pass)
00081         {
00082                 case PSMotion:
00083                         performDynamic(ellapsedTime);
00084                         break;
00085                 case PSToolRender:
00086                         show(ellapsedTime);
00087                         break;
00088                 default: break;
00089         }
00090 }

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

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

Reimplemented in NL3D::CPSRibbonBase.

Definition at line 1038 of file ps_located.h.

01038 {}


Friends And Related Function Documentation

friend class CPSForceIntensity [friend, inherited]
 

Definition at line 128 of file ps_force.h.

friend class CPSLocated [friend, inherited]
 

Reimplemented from NL3D::CPSLocatedBindable.

Definition at line 127 of file ps_force.h.


Field Documentation

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

Definition at line 1033 of file ps_located.h.

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

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

Definition at line 1027 of file ps_located.h.

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

CPSAttribMaker<float>* NL3D::CPSForceIntensity::_IntensityScheme [protected, inherited]
 

Definition at line 197 of file ps_force.h.

Referenced by NL3D::CPSForceIntensity::CPSForceIntensity(), NL3D::CPSForceIntensity::deleteForceIntensityElement(), NL3D::CPSForceIntensity::getIntensityScheme(), NL3D::CPSForceIntensity::newForceIntensityElement(), NL3D::CPSForceIntensity::resizeForceIntensity(), NL3D::CPSForceIntensity::setIntensity(), NL3D::CPSForceIntensity::setIntensityScheme(), and NL3D::CPSForceIntensity::~CPSForceIntensity().

float NL3D::CPSForceIntensity::_K [protected, inherited]
 

Definition at line 196 of file ps_force.h.

Referenced by NL3D::CPSForceIntensity::getIntensity(), and NL3D::CPSForceIntensity::setIntensity().

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

tells when this object must be dealt with

Definition at line 1029 of file ps_located.h.

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

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

Definition at line 1031 of file ps_located.h.

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

Definition at line 1026 of file ps_located.h.

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

float NL3D::CPSBrownianForce::_ParametricFactor [protected]
 

Definition at line 624 of file ps_force.h.

Referenced by getParametricFactor(), integrate(), integrateSingle(), and setParametricFactor().

TTargetCont NL3D::CPSTargetLocatedBindable::_Targets [protected, inherited]
 

Definition at line 1123 of file ps_located.h.

Referenced by NL3D::CPSTargetLocatedBindable::attachTarget(), NL3D::CPSTargetLocatedBindable::finalize(), NL3D::CPSTargetLocatedBindable::getNbTargets(), NL3D::CPSTargetLocatedBindable::getTarget(), NL3D::CPSTargetLocatedBindable::notifyTargetRemoved(), NL3D::CPSTargetLocatedBindable::releaseAllRef(), NL3D::CPSTargetLocatedBindable::releaseRefTo(), and NL3D::CPSTargetLocatedBindable::~CPSTargetLocatedBindable().

bool NL3D::CPSBrownianForce::isIntegrable
 

==========================================================

Definition at line 1043 of file ps_force.cpp.

01044 {
01045         return _IntensityScheme == NULL;
01046 }

NLMISC::CVector NL3D::CPSBrownianForce::PrecomputedImpulsions [static, protected]
 

various impulsion for normal motion

Definition at line 1032 of file ps_force.cpp.

Referenced by initPrecalc(), and performDynamic().

NLMISC::CVector NL3D::CPSBrownianForce::PrecomputedPos [static, protected]
 

used to avoid to have to call rand for each particle the force applies on...

Definition at line 1030 of file ps_force.cpp.

Referenced by initPrecalc(), integrate(), and integrateSingle().

NLMISC::CVector NL3D::CPSBrownianForce::PrecomputedSpeed [static, protected]
 

Definition at line 1031 of file ps_force.cpp.

Referenced by initPrecalc(), and integrate().


The documentation for this class was generated from the following files:
Generated on Tue Mar 16 07:04:39 2004 for NeL by doxygen 1.3.6