NL3D::CPSLight Class Reference

#include <ps_light.h>

Inheritance diagram for NL3D::CPSLight:

NL3D::CPSLocatedBindable NLMISC::IStreamable NLMISC::IClassable

Detailed Description

A group of dynamic light created by a particle system
Author:
Nicolas Vizerie

Nevrax France

Date:
2003

Definition at line 42 of file ps_light.h.

Public Member Functions

virtual void basisChanged (TPSMatrixMode systemBasis)
virtual bool completeBBox (NLMISC::CAABBox &box) const
NLMISC::CVector computeI (void) const
NLMISC::CVector computeJ (void) const
NLMISC::CVector computeK (void) const
virtual bool doesProduceBBox (void) const
virtual void enumTexs (std::vector< NLMISC::CSmartPtr< ITexture > > &dest, IDriver &drv)
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)
 ***************************************************************************************

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)

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

CPSLocatedgetOwner (void)
 get the located that owns this bindable

virtual uint32 getPriority (void) const
const NLMISC::CMatrixgetSysMat (void) const
 ***************************************************************************************

virtual uint32 getType (void) const
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

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

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

virtual void releaseRefTo (const CParticleSystemProcess *other)
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 setLOD (TPSLod lod)
void setName (const std::string &name)
 set the located bindable name (edition purpose)

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

virtual void setZBias (float value)
virtual void step (TPSProcessPass pass, TAnimationTime ellapsedTime, TAnimationTime realEt)
virtual void systemDateChanged ()
object
 CPSLight ()
 ctor

 NLMISC_DECLARE_CLASS (CPSLight)
 ctor

virtual void serial (NLMISC::IStream &f) throw (NLMISC::EStream)
 Serialisation. Derivers must override this, and call their parent version.

 ~CPSLight ()
 ctor

Attributes
float getAttenEnd () const
CPSAttribMaker< float > * getAttenEndScheme () const
float getAttenStart () const
CPSAttribMaker< float > * getAttenStartScheme () const
NLMISC::CRGBA getColor () const
CPSAttribMaker< NLMISC::CRGBA > * getColorScheme () const
void setAttenEnd (float radius)
void setAttenEndScheme (CPSAttribMaker< float > *scheme)
void setAttenStart (float radius)
void setAttenStartScheme (CPSAttribMaker< float > *scheme)
void setColor (NLMISC::CRGBA color)
void setColorScheme (CPSAttribMaker< NLMISC::CRGBA > *scheme)

Protected Member Functions

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

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

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

void show ()
 Show the lights (edition mode).


Protected Attributes

bool _Active
uint32 _ExternID
TPSLod _LOD
 tells when this object must be dealt with

std::string _Name
CPSLocated_Owner

Private Attributes

float _AttenEnd
CPSAttribMaker< float > * _AttenEndScheme
float _AttenStart
CPSAttribMaker< float > * _AttenStartScheme
NLMISC::CRGBA _Color
CPSAttribMaker< NLMISC::CRGBA > * _ColorScheme
CPSAttrib< CPointLightModel * > _Lights

Friends

class CPSLocated


Constructor & Destructor Documentation

NL3D::CPSLight::CPSLight  ) 
 

ctor

Definition at line 40 of file ps_light.cpp.

00040                    : _Color(CRGBA::White),
00041                                            _ColorScheme(NULL),
00042                                            _AttenStart(0.1f),
00043                                            _AttenStartScheme(NULL),
00044                                            _AttenEnd(1.f),
00045                                            _AttenEndScheme(NULL)
00046 {       
00047 }

NL3D::CPSLight::~CPSLight  ) 
 

ctor

Definition at line 50 of file ps_light.cpp.

References _AttenEndScheme, _AttenStartScheme, _ColorScheme, _Lights, NL3D::CScene::deleteModel(), NL3D::CParticleSystemProcess::getOwner(), NL3D::CParticleSystem::getScene(), NL3D::CPSAttrib< CPointLightModel * >::getSize(), nlassert, and uint.

00051 {
00052         if (_Owner && _Owner->getOwner())
00053         {
00054                 // check that all lights have been deleted
00055                 for(uint k = 0; k < _Lights.getSize(); ++k)
00056                 {
00057                         if (_Lights[k]) _Owner->getOwner()->getScene()->deleteModel(_Lights[k]);                        
00058                 }
00059         }
00060         else
00061         {
00062                 #ifdef NL_DEBUG
00063                         // check that all lights have been deleted
00064                         for(uint k = 0; k < _Lights.getSize(); ++k)
00065                         {
00066                                 nlassert(_Lights[k] == NULL); // error there's  leak!
00067                         }
00068                 #endif
00069         }
00070         delete _ColorScheme;
00071         delete _AttenStartScheme;
00072         delete _AttenEndScheme;
00073 }


Member Function Documentation

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

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

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

Reimplemented in NL3D::CPSForce.

Definition at line 968 of file ps_located.h.

00968 {}

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 {}

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(); }

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

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

Implements NL3D::CPSLocatedBindable.

Definition at line 323 of file ps_light.cpp.

References _AttenEndScheme, _AttenStartScheme, _ColorScheme, _Lights, NL3D::CPSAttribMaker< float >::deleteElement(), NL3D::CScene::deleteModel(), NL3D::CPSLocated::getScene(), NL3D::CPSAttribMaker< float >::hasMemory(), index, nlassert, NL3D::CPSAttrib< CPointLightModel * >::remove(), and uint32.

00324 {
00325         if (_ColorScheme && _ColorScheme->hasMemory()) _ColorScheme->deleteElement(index);
00326         if (_AttenStartScheme && _AttenStartScheme->hasMemory()) _AttenStartScheme->deleteElement(index);
00327         if (_AttenEndScheme && _AttenEndScheme->hasMemory()) _AttenEndScheme->deleteElement(index);     
00328         if (_Lights[index])
00329         {       
00330                 nlassert(_Owner && _Owner->getScene());
00331                 _Owner->getScene()->deleteModel(_Lights[index]);                
00332         }
00333         _Lights.remove(index);
00334 }

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

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

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

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

Definition at line 2038 of file ps_located.cpp.

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

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

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

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

Reimplemented in NL3D::CPSForce.

Definition at line 888 of file ps_located.h.

00888 { return true; }

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

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

Definition at line 977 of file ps_located.h.

00977 {}

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

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

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

Reimplemented in NL3D::CPSTargetLocatedBindable.

Definition at line 1975 of file ps_located.cpp.

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

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

float NL3D::CPSLight::getAttenEnd  )  const [inline]
 

Definition at line 82 of file ps_light.h.

References _AttenEnd.

00082 { return _AttenEnd; }

CPSAttribMaker<float>* NL3D::CPSLight::getAttenEndScheme  )  const [inline]
 

Definition at line 86 of file ps_light.h.

References _AttenEndScheme.

00086 { return _AttenEndScheme; }

float NL3D::CPSLight::getAttenStart  )  const [inline]
 

Definition at line 74 of file ps_light.h.

References _AttenStart.

00074 { return _AttenStart; }

CPSAttribMaker<float>* NL3D::CPSLight::getAttenStartScheme  )  const [inline]
 

Definition at line 78 of file ps_light.h.

References _AttenStartScheme.

00078 { return _AttenStartScheme; }

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().

NLMISC::CRGBA NL3D::CPSLight::getColor void   )  const [inline]
 

Definition at line 66 of file ps_light.h.

00066 { return _Color; }      

CPSAttribMaker<NLMISC::CRGBA>* NL3D::CPSLight::getColorScheme  )  const [inline]
 

Definition at line 70 of file ps_light.h.

References _ColorScheme.

00070 { return _ColorScheme; }

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(), 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 }

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(), show(), NL3D::CPSGravity::show(), NL3D::CPSEmitterRectangle::showTool(), 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; }       

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(), resize(), NL3D::CPSSound::step(), NL3D::CPSLocated::unregisterIntegrableForce(), and NL3D::CParticleSystem::unregisterLocatedBindableExternID().

00942 { return _Owner; }

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

Get the priority of the bindable The more high it is, the earlier it is dealt with

Implements NL3D::CPSLocatedBindable.

Definition at line 56 of file ps_light.h.

References uint32.

00056 { return 600; }

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

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

Definition at line 2108 of file ps_located.cpp.

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

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

uint32 NL3D::CPSLight::getType void   )  const [virtual]
 

Gives the type for this bindable. types are encoded as constant uint32

Implements NL3D::CPSLocatedBindable.

Definition at line 140 of file ps_light.cpp.

References NL3D::PSLight, and uint32.

00141 {
00142         return PSLight; 
00143 }

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; }

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 void NL3D::CPSLocatedBindable::motionTypeChanged bool  parametric  )  [inline, virtual, inherited]
 

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

Reimplemented in NL3D::CPSRibbonBase.

Definition at line 971 of file ps_located.h.

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

00971 {}

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

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

Implements NL3D::CPSLocatedBindable.

Definition at line 314 of file ps_light.cpp.

References _AttenEndScheme, _AttenStartScheme, _ColorScheme, _Lights, NL3D::CPSAttribMaker< float >::hasMemory(), NL3D::CPSAttrib< CPointLightModel * >::insert(), NL3D::CPSAttribMaker< float >::newElement(), and uint32.

00315 {
00316         if (_ColorScheme && _ColorScheme->hasMemory()) _ColorScheme->newElement(emitterLocated, emitterIndex);
00317         if (_AttenStartScheme && _AttenStartScheme->hasMemory()) _AttenStartScheme->newElement(emitterLocated, emitterIndex);
00318         if (_AttenEndScheme && _AttenEndScheme->hasMemory()) _AttenEndScheme->newElement(emitterLocated, emitterIndex);
00319         _Lights.insert(NULL); // instance is created during step()
00320 }

NL3D::CPSLight::NLMISC_DECLARE_CLASS CPSLight   ) 
 

ctor

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

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

Can be used by located bindable that have located as targets (emitter, collision zone, forces) to be notified that one of their target has been removed. To do this : The object that focus the target must call registerDTorObserver on the target, with himself as a parameter When the target is removed, this target will call this method for all registered CPSLocated The default behaviour remove this object as an observer

See also:
CPSLocated::registerDTorObserver()

Reimplemented in NL3D::CPSEmitter, and NL3D::CPSTargetLocatedBindable.

Definition at line 1996 of file ps_located.cpp.

References NL3D::CPSLocated::unregisterDtorObserver().

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

01997 {
01998         ptr->unregisterDtorObserver(this);
01999 }

void NL3D::CPSLight::releaseAllRef  )  [protected, virtual]
 

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

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

Reimplemented from NL3D::CPSLocatedBindable.

Definition at line 347 of file ps_light.cpp.

References _Lights, NL3D::CScene::deleteModel(), NL3D::CPSLocated::getScene(), NL3D::CPSAttrib< CPointLightModel * >::getSize(), nlassert, and uint.

00348 {
00349         CPSLocatedBindable::releaseAllRef();    
00350         // delete all lights, because pointer to the scene is lost after detaching from a system.
00351         for(uint k = 0; k < _Lights.getSize(); ++k)
00352         {
00353                 if (_Lights[k])
00354                 {
00355                         nlassert(_Owner && _Owner->getScene()); // if there's an instance there must be a scene from which it was created.
00356                         _Owner->getScene()->deleteModel(_Lights[k]);
00357                         _Lights[k] = NULL;
00358                 }
00359         }
00360 }

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

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

Reimplemented in NL3D::CPSEmitter, and NL3D::CPSTargetLocatedBindable.

Definition at line 871 of file ps_located.h.

00871 {}

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

Resize the bindable attributes containers should not be called directly. Call CPSLocated::resize instead

Implements NL3D::CPSLocatedBindable.

Definition at line 337 of file ps_light.cpp.

References _AttenEndScheme, _AttenStartScheme, _ColorScheme, _Lights, NL3D::CPSLocatedBindable::getOwner(), NL3D::CPSAttribMaker< float >::hasMemory(), nlassert, NL3D::CPSAttrib< CPointLightModel * >::resize(), NL3D::CPSAttribMaker< float >::resize(), size, and uint32.

00338 {
00339         nlassert(size < (1 << 16));             
00340         if (_ColorScheme && _ColorScheme->hasMemory()) _ColorScheme->resize(size, getOwner() ? getOwner()->getSize() : 0);
00341         if (_AttenStartScheme && _AttenStartScheme->hasMemory()) _AttenStartScheme->resize(size, getOwner() ? getOwner()->getSize() : 0);
00342         if (_AttenEndScheme && _AttenEndScheme->hasMemory()) _AttenEndScheme->resize(size, getOwner() ? getOwner()->getSize() : 0);
00343         _Lights.resize(size);   
00344 }

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

Serialisation. Derivers must override this, and call their parent version.

Reimplemented from NL3D::CPSLocatedBindable.

Definition at line 76 of file ps_light.cpp.

References sint, uint, and uint32.

00077 {
00078         CPSLocatedBindable::serial(f);
00079         // version 1 : in version 0, scheme where not resized correctly; Fixed in this version
00080         // version 0 : color, start attenuation radius, end attenuation radius.
00081         sint ver = f.serialVersion(1);  
00082         // color
00083         bool hasColorScheme = _ColorScheme != NULL;
00084         f.serial(hasColorScheme);
00085         if (hasColorScheme)
00086         {
00087                 f.serialPolyPtr(_ColorScheme);
00088         }
00089         else
00090         {
00091                 f.serial(_Color);
00092         }
00093         // Atten start
00094         bool hasAttenStartScheme = _AttenStartScheme != NULL;
00095         f.serial(hasAttenStartScheme);
00096         if (hasAttenStartScheme)
00097         {
00098                 f.serialPolyPtr(_AttenStartScheme);
00099         }
00100         else
00101         {
00102                 f.serial(_AttenStart);
00103         }
00104         // Atten end
00105         bool hasAttenEndScheme = _AttenEndScheme != NULL;
00106         f.serial(hasAttenEndScheme);
00107         if (hasAttenEndScheme)
00108         {
00109                 f.serialPolyPtr(_AttenEndScheme);
00110         }
00111         else
00112         {
00113                 f.serial(_AttenEnd);
00114         }
00115         
00116         // save # of lights
00117         if (ver == 0)
00118         {       
00119                 uint32 dummyNumLights; // from old buggy version
00120                 f.serial(dummyNumLights);
00121         }
00122         if (f.isReading())
00123         {               
00124                 if (_Owner)
00125                 {               
00126                         resize(_Owner->getMaxSize());           
00127                         for(uint k = 0; k < _Owner->getSize(); ++k)
00128                         {
00129                                 newElement(NULL, 0);
00130                         }
00131                 }
00132                 else
00133                 {
00134                         resize(0);
00135                 }
00136         }       
00137 }

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::CPSLight::setAttenEnd float  radius  ) 
 

Definition at line 295 of file ps_light.cpp.

References _AttenEnd, and _AttenEndScheme.

00296 {
00297         delete _AttenEndScheme;
00298         _AttenEndScheme = NULL;
00299         _AttenEnd = radius;
00300 }

void NL3D::CPSLight::setAttenEndScheme CPSAttribMaker< float > *  scheme  ) 
 

Definition at line 303 of file ps_light.cpp.

References _AttenEndScheme, NL3D::CPSLocated::getMaxSize(), NL3D::CPSLocated::getSize(), NL3D::CPSAttribMaker< float >::hasMemory(), and NL3D::CPSAttribMaker< float >::resize().

00304 {
00305         delete _AttenEndScheme;
00306         _AttenEndScheme = scheme;
00307         if (_Owner)
00308         {       
00309                 if (_AttenEndScheme && _AttenEndScheme->hasMemory()) _AttenEndScheme->resize(_Owner->getMaxSize(), _Owner->getSize());
00310         }
00311 }

void NL3D::CPSLight::setAttenStart float  radius  ) 
 

Definition at line 275 of file ps_light.cpp.

References _AttenStart, _AttenStartScheme, and nlassert.

00276 {
00277         nlassert(radius > 0.f);
00278         delete _AttenStartScheme;
00279         _AttenStartScheme =     NULL;
00280         _AttenStart = radius;
00281 }

void NL3D::CPSLight::setAttenStartScheme CPSAttribMaker< float > *  scheme  ) 
 

Definition at line 284 of file ps_light.cpp.

References _AttenStartScheme, NL3D::CPSLocated::getMaxSize(), NL3D::CPSLocated::getSize(), NL3D::CPSAttribMaker< float >::hasMemory(), and NL3D::CPSAttribMaker< float >::resize().

00285 {
00286         delete _AttenStartScheme;
00287         _AttenStartScheme = scheme;
00288         if (_Owner)
00289         {       
00290                 if (_AttenStartScheme && _AttenStartScheme->hasMemory()) _AttenStartScheme->resize(_Owner->getMaxSize(), _Owner->getSize());
00291         }
00292 }

void NL3D::CPSLight::setColor NLMISC::CRGBA  color  ) 
 

Definition at line 256 of file ps_light.cpp.

References _ColorScheme.

00257 {
00258         delete _ColorScheme;
00259         _ColorScheme = NULL;
00260         _Color = color;
00261 }

void NL3D::CPSLight::setColorScheme CPSAttribMaker< NLMISC::CRGBA > *  scheme  ) 
 

Definition at line 264 of file ps_light.cpp.

References _ColorScheme, NL3D::CPSLocated::getMaxSize(), and NL3D::CPSLocated::getSize().

00265 {
00266         delete _ColorScheme;
00267         _ColorScheme = scheme;
00268         if (_Owner)
00269         {       
00270                 if (_ColorScheme && _ColorScheme->hasMemory()) _ColorScheme->resize(_Owner->getMaxSize(), _Owner->getSize());
00271         }
00272 }

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::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::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::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::CPSLight::show  )  [protected]
 

Show the lights (edition mode).

Definition at line 363 of file ps_light.cpp.

References _AttenEnd, _AttenEndScheme, _AttenStart, _AttenStartScheme, _Lights, NLMISC::clamp(), NL3D::CPSAttribMaker< float >::get(), NL3D::CParticleSystem::getCurrentEditedElement(), NL3D::CPSLocatedBindable::getDriver(), NL3D::CPSLocatedBindable::getLocalToWorldMatrix(), NL3D::CParticleSystemProcess::getOwner(), NL3D::CPSLocated::getPos(), NL3D::CPSAttrib< CPointLightModel * >::getSize(), index, NLMISC::CMatrix::setRot(), NL3D::IDriver::setupModelMatrix(), uint, and uint32.

Referenced by step().

00364 {       
00365         uint32 index;
00366         CPSLocated *loc;
00367         CPSLocatedBindable *lb;
00368         _Owner->getOwner()->getCurrentEditedElement(loc, index, lb);
00369 
00370         NLMISC::CMatrix xzMat;
00371         xzMat.setRot(CVector::I, CVector::K, CVector::Null);
00372         NLMISC::CMatrix xyMat;
00373         xyMat.setRot(CVector::I, CVector::J, CVector::Null);
00374         NLMISC::CMatrix yzMat;
00375         yzMat.setRot(CVector::J, CVector::K, CVector::Null);
00376 
00377 
00378         getDriver()->setupModelMatrix(NLMISC::CMatrix::Identity);
00379         const uint numSubdiv = 32;
00380         // for each element, see if it is the selected element, and if yes, display in red
00381         for (uint k = 0; k < _Lights.getSize(); ++k)
00382         {
00383                 float radiusStart = _AttenStartScheme ? _AttenStartScheme->get(_Owner, k) : _AttenStart;
00384                 float radiusEnd = _AttenEndScheme ? _AttenEndScheme->get(_Owner, k) : _AttenEnd;
00385                 NLMISC::clamp(radiusStart, 0.f, radiusEnd);
00386                 const NLMISC::CRGBA colStart = (((lb == NULL || this == lb) && loc == _Owner && index == k)  ? CRGBA::Blue : CRGBA(0, 0, 127));
00387                 const NLMISC::CRGBA colEnd = (((lb == NULL || this == lb) && loc == _Owner && index == k)  ? CRGBA::Red : CRGBA(127, 0, 0));
00388                 //
00389                 CPSUtil::displayDisc(*getDriver(), radiusStart, getLocalToWorldMatrix() * _Owner->getPos()[k], xzMat, numSubdiv, colStart);
00390                 CPSUtil::displayDisc(*getDriver(), radiusStart, getLocalToWorldMatrix() * _Owner->getPos()[k], xyMat, numSubdiv, colStart);
00391                 CPSUtil::displayDisc(*getDriver(), radiusStart, getLocalToWorldMatrix() * _Owner->getPos()[k], yzMat, numSubdiv, colStart);
00392                 //
00393                 CPSUtil::displayDisc(*getDriver(), radiusEnd, getLocalToWorldMatrix() * _Owner->getPos()[k], xzMat, numSubdiv, colEnd);
00394                 CPSUtil::displayDisc(*getDriver(), radiusEnd, getLocalToWorldMatrix() * _Owner->getPos()[k], xyMat, numSubdiv, colEnd);
00395                 CPSUtil::displayDisc(*getDriver(), radiusEnd, getLocalToWorldMatrix() * _Owner->getPos()[k], yzMat, numSubdiv, colEnd);
00396                 //
00397         }
00398 }

void NL3D::CPSLight::step TPSProcessPass  pass,
TAnimationTime  ellapsedTime,
TAnimationTime  realEt
[virtual]
 

From CPSLocatedBindable. For lights, this update their pos, colors and attenuation distances in the engine

Implements NL3D::CPSLocatedBindable.

Definition at line 146 of file ps_light.cpp.

References _AttenEnd, _AttenEndScheme, _AttenStart, _AttenStartScheme, _ColorScheme, _Lights, NL3D::CPSAttrib< T >::begin(), NL3D::CPSAttrib< CPointLightModel * >::begin(), NL3D::CScene::createModel(), NL3D::CPointLight::getAttenuationBegin(), NL3D::CPointLight::getAttenuationEnd(), NL3D::CPointLight::getDiffuse(), NL3D::CParticleSystem::getGlobalColor(), NL3D::CPSLocatedBindable::getLocalToWorldMatrix(), NL3D::CParticleSystemProcess::getOwner(), NL3D::ITransformable::getPos(), NL3D::CPSLocated::getPos(), NL3D::CParticleSystem::getScene(), NL3D::CPSAttrib< CPointLightModel * >::getSize(), NL3D::CPSAttribMaker< float >::make(), min, NLMISC::CRGBA::modulateFromColor(), nlassert, NL3D::CPointLightModel::PointLight, NL3D::PointLightModelId, NL3D::PSMotion, NL3D::PSToolRender, NL3D::CPointLight::setColor(), NL3D::ITransformable::setPos(), NL3D::CPointLight::setupAttenuation(), show(), NL3D::TAnimationTime, uint, uint32, and uint8.

00147 {       
00148         if (pass != PSMotion) 
00149         {
00150                 if (pass == PSToolRender)
00151                 {
00152                         show();
00153                 }
00154                 return;
00155         }
00156         nlassert(_Owner);
00157         nlassert(_Owner->getOwner());
00158         CScene *scene = _Owner->getOwner()->getScene();
00159         const uint32 BATCH_SIZE = 512;  
00160         uint32 numLeftLights = _Lights.getSize();
00161         // avoid ctor call for color array
00162         uint8              colorArray[BATCH_SIZE * sizeof(NLMISC::CRGBA)];
00163         NLMISC::CRGBA *colors = (NLMISC::CRGBA *) colorArray;
00164         float             attenStart[BATCH_SIZE];
00165         float             attenEnd[BATCH_SIZE];
00166         CPSAttrib<CPointLightModel *>::iterator lightIt = _Lights.begin();
00167         const CMatrix *convMat = &(getLocalToWorldMatrix());
00168         TPSAttribVector::const_iterator posIt = _Owner->getPos().begin();
00169         CRGBA globalColor = _Owner->getOwner()->getGlobalColor();
00170         while (numLeftLights)
00171         {
00172                 uint32 toProcess = std::min(numLeftLights, BATCH_SIZE);
00173                 // compute colors
00174                 NLMISC::CRGBA *colPointer;
00175                 uint   colStride;
00176                 if (_ColorScheme)
00177                 {
00178                         colPointer = (CRGBA *) _ColorScheme->make(_Owner, _Lights.getSize() - numLeftLights, colors, sizeof(CRGBA), toProcess, true);
00179                         colStride = 1;
00180                 }
00181                 else
00182                 {
00183                         colPointer = &_Color;
00184                         colStride = 0;
00185                 }
00186                 // compute start attenuation
00187                 float *attenStartPointer;
00188                 uint   attenStartStride;
00189                 if (_AttenStartScheme)
00190                 {
00191                         attenStartPointer = (float *) _AttenStartScheme->make(_Owner, _Lights.getSize() - numLeftLights, attenStart, sizeof(float), toProcess, true);
00192                         attenStartStride = 1;
00193                 }
00194                 else
00195                 {
00196                         attenStartPointer = &_AttenStart;
00197                         attenStartStride = 0;
00198                 }
00199                 // compute end attenuation
00200                 float *attenEndPointer;
00201                 uint   attenEndStride;
00202                 if (_AttenEndScheme)
00203                 {
00204                         attenEndPointer = (float *) _AttenEndScheme->make(_Owner, _Lights.getSize() - numLeftLights, attenEnd, sizeof(float), toProcess, true);
00205                         attenEndStride = 1;
00206                 }
00207                 else
00208                 {
00209                         attenEndPointer = &_AttenEnd;
00210                         attenEndStride = 0;
00211                 }
00212                 numLeftLights -= toProcess;
00213                 do 
00214                 {
00215                         if (!*lightIt)
00216                         {
00217                                 // light not created, create it from scene
00218                                 if (scene)
00219                                 {
00220                                         *lightIt = NLMISC::safe_cast<CPointLightModel *>(scene->createModel(PointLightModelId));                                        
00221                                         if (*lightIt)
00222                                         {
00223                                                 (*lightIt)->setTransformMode(CTransform::RotEuler);
00224                                         }
00225                                 }
00226                         }
00227                         if (*lightIt)
00228                         {
00229                                 NLMISC::CVector pos = *convMat * *posIt;
00230                                 CPointLightModel *plm = *lightIt;
00231                                 if (pos != plm->getPos()) plm->setPos(pos);
00232                                 CRGBA newCol = *colPointer;
00233                                 newCol.modulateFromColor(newCol, globalColor);
00234                                 if (newCol != plm->PointLight.getDiffuse()) 
00235                                 {                                       
00236                                         plm->PointLight.setColor(newCol);
00237                                 }
00238                                 colPointer += colStride;
00239                                 if (*attenStartPointer != plm->PointLight.getAttenuationBegin()
00240                                     || *attenEndPointer != plm->PointLight.getAttenuationEnd()
00241                                    )
00242                                 {
00243                                         plm->PointLight.setupAttenuation(*attenStartPointer, *attenEndPointer);
00244                                 }
00245                                 attenStartPointer += attenStartStride;
00246                                 attenEndPointer += attenEndStride;
00247                         }
00248                         ++ lightIt;
00249                         ++ posIt;
00250                 } 
00251                 while(--toProcess);             
00252         }               
00253 }

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 CPSLocated [friend, inherited]
 

Reimplemented in NL3D::CPSForce.

Definition at line 986 of file ps_located.h.


Field Documentation

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

Definition at line 1033 of file ps_located.h.

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

float NL3D::CPSLight::_AttenEnd [private]
 

Definition at line 101 of file ps_light.h.

Referenced by getAttenEnd(), setAttenEnd(), show(), and step().

CPSAttribMaker<float>* NL3D::CPSLight::_AttenEndScheme [private]
 

Definition at line 102 of file ps_light.h.

Referenced by deleteElement(), getAttenEndScheme(), newElement(), resize(), setAttenEnd(), setAttenEndScheme(), show(), step(), and ~CPSLight().

float NL3D::CPSLight::_AttenStart [private]
 

Definition at line 99 of file ps_light.h.

Referenced by getAttenStart(), setAttenStart(), show(), and step().

CPSAttribMaker<float>* NL3D::CPSLight::_AttenStartScheme [private]
 

Definition at line 100 of file ps_light.h.

Referenced by deleteElement(), getAttenStartScheme(), newElement(), resize(), setAttenStart(), setAttenStartScheme(), show(), step(), and ~CPSLight().

NLMISC::CRGBA NL3D::CPSLight::_Color [private]
 

Definition at line 97 of file ps_light.h.

CPSAttribMaker<NLMISC::CRGBA>* NL3D::CPSLight::_ColorScheme [private]
 

Definition at line 98 of file ps_light.h.

Referenced by deleteElement(), getColorScheme(), newElement(), resize(), setColor(), setColorScheme(), step(), and ~CPSLight().

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().

CPSAttrib<CPointLightModel *> NL3D::CPSLight::_Lights [private]
 

Definition at line 96 of file ps_light.h.

Referenced by deleteElement(), newElement(), releaseAllRef(), resize(), show(), step(), and ~CPSLight().

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().


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