#include <ps_light.h>
Inheritance diagram for NL3D::CPSLight:
Nevrax France
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 |
IDriver * | getDriver () const |
shortcut to get an instance of the driver | |
uint32 | getExternID (void) const |
get the extern ID of this located bindable | |
const CFontGenerator * | getFontGenerator (void) const |
Shortcut to get the font generator if one was set (const version). | |
CFontGenerator * | getFontGenerator (void) |
Shortcut to get the font generator if one was set. | |
const CFontManager * | getFontManager (void) const |
Shortcut to get the font manager if one was set (const version). | |
CFontManager * | getFontManager (void) |
*************************************************************************************** | |
const NLMISC::CMatrix & | getInvertedSysMat (void) const |
shortcut to get the inverted matrix of the system | |
const NLMISC::CMatrix & | getInvertedViewMat (void) const |
shortcut to get the inverted view matrix | |
const NLMISC::CMatrix & | getLocalToWorldMatrix () const |
Shortcut to get the local to world matrix. | |
TPSLod | getLOD (void) const |
get the valid lods for that object | |
std::string | getName (void) const |
get the located bindable name (edition purpose) | |
const CPSLocated * | getOwner (void) const |
get the located that owns this bindable (const version) | |
CPSLocated * | getOwner (void) |
get the located that owns this bindable | |
virtual uint32 | getPriority (void) const |
const NLMISC::CMatrix & | getSysMat (void) const |
*************************************************************************************** | |
virtual uint32 | getType (void) const |
virtual bool | getUserMatrixUsageCount () const |
const NLMISC::CMatrix & | getViewMat (void) const |
shortcut to get the view matrix | |
virtual bool | hasEmitters (void) const |
tells wether there are alive emitters | |
virtual bool | 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 |
|
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 } |
|
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 } |
|
Called when the basis of the owner changed. the default behaviour does nothing
Reimplemented in NL3D::CPSForce. Definition at line 968 of file ps_located.h.
00968 {} |
|
a bounce occured, so some action could be done. The default behaviour does nothing
Reimplemented in NL3D::CPSEmitter. Definition at line 1011 of file ps_located.h.
01011 {} |
|
Reimplemented in NL3D::CPSFanLight, NL3D::CPSQuad, and NL3D::CPSShockWave. Definition at line 884 of file ps_located.h.
00884 { return false ;} |
|
Compute a vector that will map to (1 0 0) after view and model transform. This allow to have object that always faces the user, whatever basis they are in Definition at line 931 of file ps_located.h. References NL3D::CPSLocated::computeI(). Referenced by NL3D::CPSLocatedBindable::displayIcon2d(), NL3D::CPSFanLightHelper::drawFanLight(), NL3D::CPSFaceLookAtHelper::drawLookAt(), NL3D::CPSFaceLookAtHelper::drawLookAtAlignOnMotion(), NL3D::CPSGravity::show(), and NL3D::CPSEmitter::showTool().
00931 { return _Owner->computeI(); } |
|
Compute a vector that will map to (0 1 0) after view and model transform. This allow to have object that always faces the user, whatever basis they are in Definition at line 936 of file ps_located.h. References NL3D::CPSLocated::computeJ(). Referenced by NL3D::CPSFaceLookAtHelper::drawLookAt().
00936 { return _Owner->computeJ(); } |
|
Compute a vector that will map to (0 0 1) after view and model transform. This allow to have object that always faces the user, whatever basis they are in Definition at line 940 of file ps_located.h. References NL3D::CPSLocated::computeK(). Referenced by NL3D::CPSLocatedBindable::displayIcon2d(), NL3D::CPSFanLightHelper::drawFanLight(), NL3D::CPSFaceLookAtHelper::drawLookAt(), NL3D::CPSFaceLookAtHelper::drawLookAtAlignOnMotion(), and NL3D::CPSEmitter::showTool().
00940 { return _Owner->computeK(); } |
|
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 } |
|
*************************************************************************************** show an drawing to represent the object, and in red if it is selected
Definition at line 2038 of file ps_located.cpp. References NL3D::CPSLocatedBindable::computeI(), NL3D::CPSLocatedBindable::computeK(), NL3D::CParticleSystem::getCurrentEditedElement(), NL3D::CPSLocatedBindable::getDriver(), NL3D::CParticleSystemProcess::getOwner(), NL3D::CPSLocated::getPos(), NL3D::CPSLocated::getSize(), index, NL3D::CMaterial::setBlend(), NL3D::CMaterial::setBlendFunc(), NL3D::CMaterial::setColor(), NL3D::CMaterial::setLighting(), NL3D::CPSLocatedBindable::setupDriverModelMatrix(), NL3D::CMaterial::setZFunc(), NL3D::CMaterial::setZWrite(), size, uint, uint32, NLMISC::CLine::V0, NLMISC::CLine::V1, NLMISC::CVector::x, and NLMISC::CVector::y. Referenced by NL3D::CPSSpring::show(), NL3D::CPSCentralGravity::show(), and NL3D::CPSParticle::showTool().
02039 { 02040 uint32 size = _Owner->getSize(); 02041 if (!size) return; 02042 setupDriverModelMatrix(); 02043 02044 const CVector I = computeI(); 02045 const CVector K = computeK(); 02046 02047 static std::vector<NLMISC::CLine> lines; 02048 02049 lines.clear(); 02050 02051 // ugly slow code, but not for runtime 02052 for (uint k = 0; k < size; ++k) 02053 { 02054 // center of the current particle 02055 const CVector p = _Owner->getPos()[k]; 02056 02057 02058 02059 for (uint l = 0; l < nbSegs; ++l) 02060 { 02061 NLMISC::CLine li; 02062 li.V0 = p + scale * (tab[l << 1].x * I + tab[l << 1].y * K); 02063 li.V1 = p + scale * (tab[(l << 1) + 1].x * I + tab[(l << 1) + 1].y * K); 02064 lines.push_back(li); 02065 } 02066 02067 CMaterial mat; 02068 02069 mat.setBlendFunc(CMaterial::one, CMaterial::one); 02070 mat.setZWrite(false); 02071 mat.setLighting(false); 02072 mat.setBlend(true); 02073 mat.setZFunc(CMaterial::less); 02074 02075 02076 02077 CPSLocated *loc; 02078 uint32 index; 02079 CPSLocatedBindable *lb; 02080 _Owner->getOwner()->getCurrentEditedElement(loc, index, lb); 02081 02082 mat.setColor((lb == NULL || this == lb) && loc == _Owner && index == k ? CRGBA::Red : CRGBA(127, 127, 127)); 02083 02084 02085 CDRU::drawLinesUnlit(lines, mat, *getDriver() ); 02086 } 02087 02088 } |
|
Reimplemented in NL3D::CPSForce. Definition at line 888 of file ps_located.h.
00888 { return true; } |
|
Reimplemented in NL3D::CPSFanLight, NL3D::CPSQuad, NL3D::CPSRibbon, NL3D::CPSRibbonLookAt, and NL3D::CPSShockWave. Definition at line 977 of file ps_located.h.
00977 {} |
|
*************************************************************************************** this should be called before to delete any bindable inserted in a system, but this is done by the system, so you should never need calling it. This has been introduced because calls in dtor are not polymorphic to derived class (which are already destroyed anyway), and some infos are needed in some dtor. The default behaviour does nothing Reimplemented in NL3D::CPSTargetLocatedBindable. Definition at line 1975 of file ps_located.cpp. References NL3D::CParticleSystemProcess::getOwner(), NL3D::CPSLocatedBindable::getUserMatrixUsageCount(), and NL3D::CParticleSystem::releaseRefForUserSysCoordInfo().
01976 { 01977 if (_Owner && _Owner->getOwner()) 01978 { 01979 _Owner->getOwner()->releaseRefForUserSysCoordInfo(getUserMatrixUsageCount()); 01980 } 01981 } |
|
Definition at line 82 of file ps_light.h. References _AttenEnd.
00082 { return _AttenEnd; } |
|
Definition at line 86 of file ps_light.h. References _AttenEndScheme.
00086 { return _AttenEndScheme; } |
|
Definition at line 74 of file ps_light.h. References _AttenStart.
00074 { return _AttenStart; } |
|
Definition at line 78 of file ps_light.h. References _AttenStartScheme.
00078 { return _AttenStartScheme; } |
|
Implemented in NLAIAGENT::CNumericIndex, NLAIC::IPointerGestion, NLAIC::CIdentType, and CAutomataDesc. Referenced by NLMISC::CClassRegistry::checkObject(), and NL3D::GetTextureSize(). |
|
Definition at line 66 of file ps_light.h.
00066 { return _Color; } |
|
Definition at line 70 of file ps_light.h. References _ColorScheme.
00070 { return _ColorScheme; } |
|
|
get the extern ID of this located bindable
Definition at line 964 of file ps_located.h. References NL3D::CPSLocatedBindable::_ExternID, and uint32. Referenced by NL3D::CPSLocated::bind(), and NL3D::CParticleSystem::unregisterLocatedBindableExternID().
00964 { return _ExternID; } |
|
Shortcut to get the font generator if one was set (const version).
Definition at line 904 of file ps_located.h. References NL3D::CParticleSystemProcess::getFontGenerator(), and nlassert.
|
|
Shortcut to get the font generator if one was set.
Definition at line 897 of file ps_located.h. References NL3D::CParticleSystemProcess::getFontGenerator(), and nlassert. Referenced by NL3D::CPSZoneRectangle::show(), NL3D::CPSZoneCylinder::show(), NL3D::CPSZoneDisc::show(), NL3D::CPSZonePlane::show(), NL3D::CPSCylindricVortex::show(), NL3D::CPSGravity::show(), and NL3D::CPSEmitterRectangle::showTool().
|
|
Shortcut to get the font manager if one was set (const version).
Definition at line 2099 of file ps_located.cpp. References NL3D::CParticleSystemProcess::getFontManager(), and nlassert.
|
|
***************************************************************************************
Definition at line 2091 of file ps_located.cpp. References NL3D::CParticleSystemProcess::getFontManager(), and nlassert. Referenced by NL3D::CPSZoneRectangle::show(), NL3D::CPSZoneCylinder::show(), NL3D::CPSZoneDisc::show(), NL3D::CPSZonePlane::show(), NL3D::CPSCylindricVortex::show(), NL3D::CPSGravity::show(), and NL3D::CPSEmitterRectangle::showTool().
|
|
shortcut to get the inverted matrix of the system
Definition at line 2116 of file ps_located.cpp. References NL3D::CParticleSystem::getInvertedSysMat(), NL3D::CParticleSystemProcess::getOwner(), and nlassert.
|
|
shortcut to get the inverted view matrix
Definition at line 2134 of file ps_located.cpp. References NL3D::CParticleSystem::getInvertedViewMat(), NL3D::CParticleSystemProcess::getOwner(), and nlassert.
|
|
Shortcut to get the local to world matrix.
Definition at line 1144 of file ps_located.h. References NL3D::CPSLocated::getLocalToWorldMatrix(), and nlassert. Referenced by NL3D::CPSRibbonLookAt::displayRibbons(), NL3D::CPSSound::newElement(), NL3D::CPSZoneRectangle::show(), NL3D::CPSZoneCylinder::show(), NL3D::CPSZoneDisc::show(), NL3D::CPSZonePlane::show(), show(), NL3D::CPSGravity::show(), NL3D::CPSEmitterRectangle::showTool(), step(), and NL3D::CPSMesh::updatePos().
|
|
get the valid lods for that object
Definition at line 954 of file ps_located.h. References NL3D::CPSLocatedBindable::_LOD, and NL3D::TPSLod.
00954 { return _LOD; } |
|
get the located bindable name (edition purpose)
Definition at line 948 of file ps_located.h.
00948 { return _Name; } |
|
get the located that owns this bindable (const version)
Definition at line 944 of file ps_located.h.
00944 { return _Owner; } |
|
get the located that owns this bindable
Definition at line 942 of file ps_located.h. Referenced by NL3D::CPSLocated::deleteElement(), NL3D::CParticleSystemInstanceUser::emit(), NL3D::CPSFaceLookAt::CSecondSize::getSizeOwner(), NL3D::CPSSound::newElement(), NL3D::CPSLocated::registerIntegrableForce(), NL3D::CParticleSystem::registerLocatedBindableExternID(), NL3D::CParticleSystemInstanceUser::removeByID(), NL3D::CPSSound::resize(), resize(), NL3D::CPSSound::step(), NL3D::CPSLocated::unregisterIntegrableForce(), and NL3D::CParticleSystem::unregisterLocatedBindableExternID().
00942 { return _Owner; } |
|
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; }
|
|
***************************************************************************************
Definition at line 2108 of file ps_located.cpp. References NL3D::CParticleSystemProcess::getOwner(), NL3D::CParticleSystem::getSysMat(), and nlassert.
|
|
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 } |
|
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; }
|
|
shortcut to get the view matrix
Definition at line 2125 of file ps_located.cpp. References NL3D::CParticleSystemProcess::getOwner(), NL3D::CParticleSystem::getViewMat(), and nlassert. Referenced by NL3D::CPSRibbonLookAt::displayRibbons(), and NL3D::CPSFaceLookAtHelper::drawLookAt().
|
|
tells wether there are alive emitters
Definition at line 958 of file ps_located.h.
00958 { return false; } |
|
tells wether there are alive entities / particles
Reimplemented in NL3D::CPSParticle. Definition at line 956 of file ps_located.h.
00956 { return false; } |
|
Definition at line 844 of file ps_located.h. References NL3D::CPSLocatedBindable::_Active. Referenced by NL3D::CParticleSystem::hasActiveEmitters().
00844 { return _Active; } |
|
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 {} |
|
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 } |
|
ctor
|
|
*************************************************************************************** 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
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 }
|
|
*************************************************************************************** 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 } |
|
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 {} |
|
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 } |
|
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 } |
|
Activate / Deactivate this object. When not active, the owning system won't try to call the 'step' method.
Definition at line 843 of file ps_located.h. References NL3D::CPSLocatedBindable::_Active. Referenced by NL3D::CParticleSystem::activateEmitters(), and NL3D::CParticleSystemInstanceUser::setActive().
00843 { _Active = active; } |
|
Definition at line 295 of file ps_light.cpp. References _AttenEnd, and _AttenEndScheme.
00296 { 00297 delete _AttenEndScheme; 00298 _AttenEndScheme = NULL; 00299 _AttenEnd = radius; 00300 } |
|
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 } |
|
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 } |
|
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 } |
|
Definition at line 256 of file ps_light.cpp. References _ColorScheme.
00257 { 00258 delete _ColorScheme; 00259 _ColorScheme = NULL; 00260 _Color = color; 00261 } |
|
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 } |
|
*************************************************************************************** set the extern ID of this located bindable. 0 means no extern access. The map of ID-locatedBindable. Is in th particle system, so this located bindable must have been attached to a particle system, otherwise an assertion is raised Definition at line 2149 of file ps_located.cpp. References NL3D::CPSLocatedBindable::_ExternID, NL3D::CParticleSystemProcess::getOwner(), NL3D::CParticleSystem::registerLocatedBindableExternID(), uint32, and NL3D::CParticleSystem::unregisterLocatedBindableExternID().
02150 { 02151 if (id == _ExternID) return; 02152 CParticleSystem *ps = NULL; 02153 if (_Owner && _Owner->getOwner()) 02154 { 02155 ps = _Owner->getOwner(); 02156 } 02157 if (ps) 02158 { 02159 ps->unregisterLocatedBindableExternID(this); 02160 _ExternID = 0; 02161 } 02162 if (id != 0) 02163 { 02164 if (ps) ps->registerLocatedBindableExternID(id, this); 02165 _ExternID = id; 02166 } 02167 } |
|
set the LODs that apply to that object (warning : it is based on the position of the system, and don't act on a per instance basis ...) To have per instance precision, you must use an attribute maker that has LOD as its input Definition at line 952 of file ps_located.h. References NL3D::CPSLocatedBindable::_LOD.
00952 { _LOD = lod; } |
|
set the located bindable name (edition purpose)
Definition at line 946 of file ps_located.h.
00946 { _Name = name; } |
|
***************************************************************************************
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 } |
|
|
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 {} |
|
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 } |
|
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 } |
|
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 {} |
|
Reimplemented in NL3D::CPSForce. Definition at line 986 of file ps_located.h. |
|
Definition at line 1033 of file ps_located.h. Referenced by NL3D::CPSLocatedBindable::isActive(), and NL3D::CPSLocatedBindable::setActive(). |
|
Definition at line 101 of file ps_light.h. Referenced by getAttenEnd(), setAttenEnd(), show(), and step(). |
|
Definition at line 102 of file ps_light.h. Referenced by deleteElement(), getAttenEndScheme(), newElement(), resize(), setAttenEnd(), setAttenEndScheme(), show(), step(), and ~CPSLight(). |
|
Definition at line 99 of file ps_light.h. Referenced by getAttenStart(), setAttenStart(), show(), and step(). |
|
Definition at line 100 of file ps_light.h. Referenced by deleteElement(), getAttenStartScheme(), newElement(), resize(), setAttenStart(), setAttenStartScheme(), show(), step(), and ~CPSLight(). |
|
Definition at line 97 of file ps_light.h. |
|
Definition at line 98 of file ps_light.h. Referenced by deleteElement(), getColorScheme(), newElement(), resize(), setColor(), setColorScheme(), step(), and ~CPSLight(). |
|
Definition at line 1027 of file ps_located.h. Referenced by NL3D::CPSLocatedBindable::getExternID(), NL3D::CPSLocatedBindable::setExternID(), and NL3D::CPSLocatedBindable::~CPSLocatedBindable(). |
|
Definition at line 96 of file ps_light.h. Referenced by deleteElement(), newElement(), releaseAllRef(), resize(), show(), step(), and ~CPSLight(). |
|
tells when this object must be dealt with
Definition at line 1029 of file ps_located.h. Referenced by NL3D::CPSLocatedBindable::getLOD(), and NL3D::CPSLocatedBindable::setLOD(). |
|
Definition at line 1031 of file ps_located.h. |
|