#include <ps_zone.h>
Inheritance diagram for NL3D::CPSZoneCylinder:
Definition at line 291 of file ps_zone.h.
Public Types | |
enum | TCollisionBehaviour { bounce = 0, destroy = 1 } |
behaviour when a collision occurs More... | |
Public Member Functions | |
virtual void | attachTarget (CPSLocated *ptr) |
Add a new type of located for this zone to apply on. nlassert if already present. | |
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 |
CPSZoneCylinder () | |
void | detachTarget (CPSLocated *ptr) |
virtual bool | doesProduceBBox (void) const |
virtual void | enumTexs (std::vector< NLMISC::CSmartPtr< ITexture > > &dest, IDriver &drv) |
virtual void | finalize (void) |
*************************************************************************************** | |
float | getBounceFactor (void) const |
get the bounce factor. It has meaning only if the behaviour is set to bounce... | |
virtual std::string | getClassName ()=0 |
TCollisionBehaviour | getCollisionBehaviour (void) const |
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 | |
virtual NLMISC::CMatrix | getMatrix (uint32 index) const |
std::string | getName (void) const |
get the located bindable name (edition purpose) | |
uint32 | getNbTargets (void) const |
return the number of targets | |
virtual NLMISC::CVector | getNormal (uint32 index) |
if the object only needs a normal, this return the normal. If not, is return (0, 0, 0) | |
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 |
virtual NLMISC::CVector | getScale (uint32 k) const |
const NLMISC::CMatrix & | getSysMat (void) const |
*************************************************************************************** | |
const CPSLocated * | getTarget (uint32 index) const |
Return a const ptr on a target. Invalid range -> nlassert. | |
CPSLocated * | getTarget (uint32 index) |
Return a ptr on a target. Invalid range -> nlassert. | |
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 | |
NLMISC_DECLARE_CLASS (CPSZoneCylinder) | |
virtual bool | onlyStoreNormal (void) const |
virtual void | performMotion (TAnimationTime ellapsedTime) |
This is usually called by the step method for the pass dedicated to zone. | |
virtual void | releaseAllRef () |
*************************************************************************************** | |
virtual void | releaseRefTo (const CParticleSystemProcess *other) |
*************************************************************************************** | |
virtual void | releaseTargetRsc (CPSLocated *target) |
inherit from CPSTargetLocatedBindable. Its called when one of the targets has been detroyed | |
virtual void | serial (NLMISC::IStream &f) throw (NLMISC::EStream) |
serialization, DERIVER must override this, and call the parent version | |
void | setActive (bool active) |
Activate / Deactivate this object. When not active, the owning system won't try to call the 'step' method. | |
void | setBounceFactor (float bounceFactor) |
set the bounce factor. It has meaning only if the behaviour is set to bounce... | |
void | setCollisionBehaviour (TCollisionBehaviour behaviour) |
void | setExternID (uint32 id) |
*************************************************************************************** | |
void | setLOD (TPSLod lod) |
virtual void | setMatrix (uint32 index, const NLMISC::CMatrix &m) |
void | setName (const std::string &name) |
set the located bindable name (edition purpose) | |
virtual void | setNormal (uint32 index, NLMISC::CVector n) |
if the object only stores a normal, this set the normal of the object. Otherwise it has no effect | |
virtual void | setScale (uint32 k, const NLMISC::CVector &s) |
virtual void | setScale (uint32 k, float scale) |
void | setupDriverModelMatrix (void) |
shortcut to setup the model matrix (system basis or world basis) | |
virtual void | setZBias (float value) |
virtual void | show (TAnimationTime ellapsedTime) |
Show the zone (edition mode). | |
virtual void | step (TPSProcessPass pass, TAnimationTime ellapsedTime, TAnimationTime realEt) |
virtual bool | supportNonUniformScaling (void) const |
virtual bool | supportUniformScaling (void) const |
virtual void | systemDateChanged () |
Protected Types | |
typedef CPSVector< CPSLocated * >::V | TTargetCont |
Protected Member Functions | |
virtual void | bounceOccured (uint32 index) |
NLMISC::CMatrix | buildBasis (uint32 index) const |
virtual void | deleteElement (uint32 index) |
void | displayIcon2d (const NLMISC::CVector tab[], uint nbSegs, float scale) |
*************************************************************************************** | |
virtual void | newElement (CPSLocated *emitterLocated, uint32 emitterIndex) |
virtual void | notifyTargetRemoved (CPSLocated *ptr) |
*************************************************************************************** | |
virtual void | resize (uint32 size) |
virtual void | setOwner (CPSLocated *psl) |
*************************************************************************************** | |
Protected Attributes | |
bool | _Active |
CPSAttrib< CPlaneBasis > | _Basis |
float | _BounceFactor |
TCollisionBehaviour | _CollisionBehaviour |
TPSAttribVector | _Dim |
uint32 | _ExternID |
TPSLod | _LOD |
tells when this object must be dealt with | |
std::string | _Name |
CPSLocated * | _Owner |
TTargetCont | _Targets |
Friends | |
class | CPSLocated |
|
Definition at line 1122 of file ps_located.h. |
|
behaviour when a collision occurs
Definition at line 62 of file ps_zone.h. Referenced by NL3D::CPSZone::getCollisionBehaviour().
|
|
Definition at line 297 of file ps_zone.h.
00298 { 00299 if (CParticleSystem::getSerializeIdentifierFlag()) _Name = std::string("ZoneCylinder"); 00300 } |
|
Add a new type of located for this zone to apply on. nlassert if already present. Add a new type of located for this zone to apply on. We override this to queery the target to allocate the CollisionInfo attribute Reimplemented from NL3D::CPSTargetLocatedBindable. Definition at line 73 of file ps_zone.cpp. References NL3D::CPSLocated::addNonIntegrableForceRef(), and NL3D::CPSLocated::queryCollisionInfo().
00074 { 00075 00076 CPSTargetLocatedBindable::attachTarget(ptr); 00077 ptr->queryCollisionInfo(); 00078 ptr->addNonIntegrableForceRef(); 00079 } |
|
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 1260 of file ps_zone.cpp. References _Dim, index, NL3D::CPSAttrib< T >::remove(), NL3D::CPSAttrib< CPlaneBasis >::remove(), and uint32.
|
|
remove a target
Definition at line 1076 of file ps_located.h. References NL3D::CPSTargetLocatedBindable::notifyTargetRemoved().
01077 { 01078 notifyTargetRemoved(ptr); 01079 } |
|
*************************************************************************************** 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 {} |
|
***************************************************************************************
Release the collisionInfos we've querried. We can't do it in the dtor, as calls to releaseTargetRsc wouldn't be polymorphics for derived class! And the behaviour of releaseTergetRsc is implemented in derived class Reimplemented from NL3D::CPSLocatedBindable. Definition at line 2238 of file ps_located.cpp. References NL3D::CPSTargetLocatedBindable::_Targets, and NL3D::CPSTargetLocatedBindable::releaseTargetRsc().
02239 { 02243 for (TTargetCont::iterator it = _Targets.begin(); it != _Targets.end(); ++it) 02244 { 02245 releaseTargetRsc(*it); 02246 } 02247 CPSLocatedBindable::finalize(); 02248 } |
|
get the bounce factor. It has meaning only if the behaviour is set to bounce...
Definition at line 111 of file ps_zone.h. References NL3D::CPSZone::_BounceFactor.
00111 { return _BounceFactor; } |
|
Implemented in NLAIAGENT::CNumericIndex, NLAIC::IPointerGestion, NLAIC::CIdentType, and CAutomataDesc. Referenced by NLMISC::CClassRegistry::checkObject(), and NL3D::GetTextureSize(). |
|
Definition at line 116 of file ps_zone.h. References NL3D::CPSZone::_CollisionBehaviour, and NL3D::CPSZone::TCollisionBehaviour.
00116 { return _CollisionBehaviour; } |
|
|
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(), 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(), 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(), show(), NL3D::CPSZoneDisc::show(), NL3D::CPSZonePlane::show(), NL3D::CPSLight::show(), NL3D::CPSGravity::show(), NL3D::CPSEmitterRectangle::showTool(), NL3D::CPSLight::step(), and NL3D::CPSMesh::updatePos().
|
|
get the valid lods for that object
Definition at line 954 of file ps_located.h. References NL3D::CPSLocatedBindable::_LOD, and NL3D::TPSLod.
00954 { return _LOD; } |
|
Implements NL3D::IPSMover. Definition at line 1212 of file ps_zone.cpp. References NL3D::CPSLocated::getPos(), index, NLMISC::CMatrix::setPos(), NLMISC::CMatrix::setRot(), and uint32.
|
|
get the located bindable name (edition purpose)
Definition at line 948 of file ps_located.h.
00948 { return _Name; } |
|
return the number of targets
Definition at line 1091 of file ps_located.h. References NL3D::CPSTargetLocatedBindable::_Targets, and uint32. Referenced by NL3D::CParticleSystem::getTargeters().
01091 { return _Targets.size(); } |
|
if the object only needs a normal, this return the normal. If not, is return (0, 0, 0)
Reimplemented in NL3D::CPSCylindricVortex, NL3D::CPSZonePlane, and NL3D::CPSZoneDisc. Definition at line 89 of file ps_edit.h.
00089 { return NLMISC::CVector::Null ; } |
|
get the located that owns this bindable (const version)
Definition at line 944 of file ps_located.h.
00944 { return _Owner; } |
|
get the located that owns this bindable
Definition at line 942 of file ps_located.h. Referenced by NL3D::CPSLocated::deleteElement(), NL3D::CParticleSystemInstanceUser::emit(), NL3D::CPSFaceLookAt::CSecondSize::getSizeOwner(), NL3D::CPSSound::newElement(), NL3D::CPSLocated::registerIntegrableForce(), NL3D::CParticleSystem::registerLocatedBindableExternID(), NL3D::CParticleSystemInstanceUser::removeByID(), NL3D::CPSSound::resize(), NL3D::CPSLight::resize(), NL3D::CPSSound::step(), NL3D::CPSLocated::unregisterIntegrableForce(), and NL3D::CParticleSystem::unregisterLocatedBindableExternID().
00942 { return _Owner; } |
|
Get the priority of the bindable The more high it is, the earlier it is dealt with Implements NL3D::CPSLocatedBindable. Definition at line 76 of file ps_zone.h. References uint32.
00076 { return 3500; }
|
|
Reimplemented from NL3D::IPSMover. Definition at line 1226 of file ps_zone.cpp.
01227 { 01228 return _Dim[k]; 01229 } |
|
***************************************************************************************
Definition at line 2108 of file ps_located.cpp. References NL3D::CParticleSystemProcess::getOwner(), NL3D::CParticleSystem::getSysMat(), and nlassert.
|
|
Return a const ptr on a target. Invalid range -> nlassert.
Definition at line 1099 of file ps_located.h. References NL3D::CPSTargetLocatedBindable::_Targets, index, nlassert, and uint32.
|
|
Return a ptr on a target. Invalid range -> nlassert.
Definition at line 1093 of file ps_located.h. References NL3D::CPSTargetLocatedBindable::_Targets, index, nlassert, and uint32. Referenced by NL3D::CParticleSystem::getTargeters().
|
|
Gives the type for this bindable. Implements NL3D::CPSLocatedBindable. Definition at line 70 of file ps_zone.h. References NL3D::PSZone, and uint32.
00070 { return PSZone; } |
|
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 1254 of file ps_zone.cpp. References _Dim, NL3D::CPSAttrib< T >::insert(), NL3D::CPSAttrib< CPlaneBasis >::insert(), and uint32.
|
|
|
|
*************************************************************************************** Inherited from CPSLocatedBindable. A target has been remove If not present -> assert This also call releaseTargetRsc for clean up Reimplemented from NL3D::CPSLocatedBindable. Definition at line 2223 of file ps_located.cpp. References NL3D::CPSTargetLocatedBindable::_Targets, nlassert, and NL3D::CPSTargetLocatedBindable::releaseTargetRsc(). Referenced by NL3D::CPSTargetLocatedBindable::detachTarget().
|
|
some object may not store a whole matrix (e.g planes) this return true if only a normal is needed to set the orientation of the object Reimplemented in NL3D::CPSCylindricVortex, NL3D::CPSZonePlane, and NL3D::CPSZoneDisc. Definition at line 86 of file ps_edit.h.
00086 { return false ; } |
|
This is usually called by the step method for the pass dedicated to zone.
Implements NL3D::CPSZone. Definition at line 946 of file ps_zone.cpp. References _Dim, NL3D::CPSAttrib< CPlaneBasis >::begin(), NL3D::CPSAttrib< T >::begin(), NL3D::CPSCollisionInfo::collisionZone, NL3D::CPSCollisionInfo::dist, NL3D::CPSAttrib< T >::end(), NL3D::CPSLocated::getPos(), MINI_TIMER, NLMISC::CMatrix::mulVector(), NL3D::CPSCollisionInfo::newPos, NL3D::CPSCollisionInfo::newSpeed, NLMISC::CVector::norm(), NLMISC::CVector::normalize(), NL3D::PSCollideEpsilon, NL3D::PSStatsZoneCylinder, NL3D::TAnimationTime, NL3D::TPSAttribVector, and uint32.
00947 { 00948 MINI_TIMER(PSStatsZoneCylinder) 00949 TPSAttribVector::const_iterator dimIt; 00950 CPSAttrib<CPlaneBasis>::const_iterator basisIt; 00951 TPSAttribVector::const_iterator cylinderPosIt, cylinderPosEnd, targetPosIt, targetPosEnd; 00952 CVector dest; 00953 CPSCollisionInfo ci; 00954 uint32 k; 00955 const TPSAttribVector *speedAttr; 00956 00957 00958 00959 for (TTargetCont::iterator it = _Targets.begin(); it != _Targets.end(); ++it) 00960 { 00961 00962 speedAttr = &((*it)->getSpeed()); 00963 00964 00965 // cycle through the cylinders 00966 00967 cylinderPosEnd = _Owner->getPos().end(); 00968 for (cylinderPosIt = _Owner->getPos().begin(), basisIt = _Basis.begin(), dimIt = _Dim.begin() 00969 ; cylinderPosIt != cylinderPosEnd 00970 ; ++cylinderPosIt, ++dimIt, ++basisIt) 00971 { 00972 00973 // we must setup the cylinder in the good basis 00974 00975 const CMatrix &m = CPSLocated::getConversionMatrix(*it, this->_Owner); 00976 00977 00978 00979 // compute the new center pos 00980 CVector center = m * *cylinderPosIt; 00981 00982 // compute a basis for the cylinder 00983 CVector I = m.mulVector(basisIt->X); 00984 CVector J = m.mulVector(basisIt->Y); 00985 CVector K = m.mulVector(basisIt->X ^ basisIt->Y); 00986 00987 00988 // the pos projected (and scale) over the plane basis of the cylinder, the pos minus the center 00989 CVector projectedPos, tPos; 00990 00991 // the same, but with the final position 00992 CVector destProjectedPos, destTPos; 00993 00994 00995 // deals with each particle 00996 targetPosEnd = (*it)->getPos().end(); 00997 TPSAttribCollisionInfo::const_iterator ciIt = (*it)->getCollisionInfo().begin(); 00998 for (targetPosIt = (*it)->getPos().begin(), k = 0; targetPosIt != targetPosEnd; ++targetPosIt, ++k, ++ciIt) 00999 { 01000 const CVector &speed = (*speedAttr)[k]; 01001 const CVector &pos = *targetPosIt; 01002 01003 01004 01005 // check wether current pos was outside the cylinder 01006 01007 01008 tPos = pos - center; 01009 projectedPos = (1 / dimIt->x) * (I * tPos) * I + (1 / dimIt->y) * (J * tPos) * J; 01010 01011 if (! 01012 ( 01013 ((tPos * K) < dimIt->z) 01014 && ((tPos * K) > -dimIt->z) 01015 && (projectedPos * projectedPos < 1.f) 01016 ) 01017 ) 01018 { 01019 dest = pos + ellapsedTime * speed * ciIt->TimeSliceRatio; 01020 destTPos = dest - center; 01021 destProjectedPos = (1.f / dimIt->x) * (I * destTPos) * I + (1.f / dimIt->y) * (J * destTPos) * J; 01022 01023 // test wether the new position is inside the cylinder 01024 01025 01026 if ( 01027 ( 01028 ((destTPos * K) < dimIt->z) 01029 && ((destTPos * K) > -dimIt->z) 01030 && (destProjectedPos * destProjectedPos < 1.f) 01031 ) 01032 ) 01033 { 01034 // now, detect the closest hit point (the smallest alpha, with alpha, the percent of the move vector 01035 // to reach the hit point) 01036 01037 const float epsilon = 10E-3f; 01038 01039 float alphaTop, alphaBottom, alphaCyl; 01040 01041 const float denum = (dest - pos) * K; 01042 01043 // top plane 01044 01045 if (fabs(denum) < epsilon) 01046 { 01047 alphaTop = (dimIt->z - (tPos * K)) / denum; 01048 if (alphaTop < 0.f) alphaTop = 1.f; 01049 } 01050 else 01051 { 01052 alphaTop = 1.f; 01053 } 01054 01055 // bottom plane 01056 01057 if (fabs(denum) < epsilon) 01058 { 01059 alphaBottom = (- dimIt->z - (tPos * K)) / denum; 01060 if (alphaBottom < 0.f) alphaBottom = 1.f; 01061 } 01062 else 01063 { 01064 alphaBottom = 1.f; 01065 } 01066 01067 // cylinder 01068 01069 //expressed the src and dest positions in the cylinder basis 01070 01071 const float ox = tPos * I, oy = tPos * J, dx = (destTPos - tPos) * I, dy = (destTPos - tPos) * J; 01072 01073 // coefficients of the equation : a * alpha ^ 2 + b * alpha + c = 0 01074 const float a = (dx * dx) / (dimIt->x * dimIt->x) 01075 + (dy * dy) / (dimIt->y * dimIt->y); 01076 const float b = 2.f * ((ox * dx) / (dimIt->x * dimIt->x) 01077 + (oy * dy) / (dimIt->y * dimIt->y)); 01078 const float c = (ox * ox) / (dimIt->x * dimIt->x) + (oy * oy) / (dimIt->y * dimIt->y) - 1; 01079 01080 // discriminant 01081 const float delta = b * b - 4.f * a * c; 01082 01083 if (delta < epsilon) 01084 { 01085 alphaCyl = 1.f; 01086 } 01087 else 01088 { 01089 const float deltaRoot = sqrtf(delta); 01090 const float r1 = (- b + 2.f * deltaRoot) / (2.f * a); 01091 const float r2 = (- b - 2.f * deltaRoot) / (2.f * a); 01092 01093 if (r1 < 0.f) alphaCyl = r2; 01094 else if (r2 < 0.f) alphaCyl = r1; 01095 else alphaCyl = r1 < r2 ? r1 : r2; 01096 01097 if (alphaCyl < 0.f) alphaCyl = 1.f; 01098 } 01099 01100 01101 // now, choose the minimum positive dist 01102 01103 01104 01105 if (alphaTop < alphaBottom && alphaTop < alphaCyl) 01106 { 01107 // collision with the top plane 01108 CVector startEnd = alphaTop * (dest - pos); 01109 ci.newPos = pos + startEnd + PSCollideEpsilon * K; 01110 ci.dist = startEnd.norm(); 01111 ci.newSpeed = (-2.f * (speed * K)) * K + speed; 01112 ci.collisionZone = this; 01113 01114 (*it)->collisionUpdate(ci, k); 01115 } 01116 else 01117 if (alphaBottom < alphaCyl) 01118 { 01119 // collision with the bottom plane 01120 CVector startEnd = alphaBottom * (dest - pos); 01121 ci.newPos = pos + startEnd - PSCollideEpsilon * K; 01122 ci.dist = startEnd.norm(); 01123 ci.newSpeed = (-2.f * (speed * K)) * K + speed; 01124 ci.collisionZone = this; 01125 01126 01127 (*it)->collisionUpdate(ci, k); 01128 } 01129 else 01130 { 01131 // collision with the cylinder 01132 01133 CVector startEnd = alphaCyl * (dest - pos); 01134 01135 // normal at the hit point. It is the gradient of the implicit equation x^2 / a^2 + y^2 / b^2 - R^ 2= 0 01136 // so we got unormalized n = (2 x / a ^ 2, 2 y / b ^ 2, 0) in the basis of the cylinder 01137 // As we'll normalize it, we don't need the 2 factor 01138 01139 float px = ox + alphaCyl * dx; 01140 float py = oy + alphaCyl * dy; 01141 01142 CVector normal = px / (dimIt->x * dimIt->x) * I + py / (dimIt->y * dimIt->y) * J; 01143 normal.normalize(); 01144 01145 ci.newPos = pos + startEnd + PSCollideEpsilon * normal; 01146 ci.dist = startEnd.norm(); 01147 ci.newSpeed = (-2.f * (speed * normal)) * normal + speed; 01148 ci.collisionZone = this; 01149 01150 (*it)->collisionUpdate(ci, k); 01151 } 01152 01153 } 01154 } 01155 } 01156 } 01157 } 01158 } |
|
*************************************************************************************** From CPSLocatedBindable Release any reference this obj may have to other process of the system For example, this is used when detaching a located bindable from a system. Reimplemented from NL3D::CPSLocatedBindable. Definition at line 2272 of file ps_located.cpp. References NL3D::CPSTargetLocatedBindable::_Targets, and NL3D::CPSTargetLocatedBindable::releaseTargetRsc().
02273 { 02274 for (TTargetCont::iterator it = _Targets.begin(); it != _Targets.end(); ++it) 02275 { 02276 releaseTargetRsc(*it); 02277 (*it)->unregisterDtorObserver(this); 02278 } 02279 _Targets.clear(); 02280 CPSLocatedBindable::releaseAllRef(); 02281 } |
|
*************************************************************************************** From CPSLocatedBindable. Release any reference this obj may have on the given process. For example, this is used when detaching a located of a system. Reimplemented from NL3D::CPSLocatedBindable. Definition at line 2261 of file ps_located.cpp. References NL3D::CPSTargetLocatedBindable::_Targets, nlassert, and NL3D::CPSTargetLocatedBindable::releaseTargetRsc().
02262 { 02263 TTargetCont::iterator it = std::find(_Targets.begin(), _Targets.end(), other); 02264 if (it == _Targets.end()) return; 02265 releaseTargetRsc(*it); 02266 (*it)->unregisterDtorObserver(this); 02267 _Targets.erase(it); 02268 nlassert(std::find(_Targets.begin(), _Targets.end(), other) == _Targets.end()); 02269 } |
|
inherit from CPSTargetLocatedBindable. Its called when one of the targets has been detroyed Inherited from CPSTargetLocatedBindable. It's called when one of the targets has been detroyed or detached The default behaviour, release collision infos from the located Reimplemented from NL3D::CPSTargetLocatedBindable. Definition at line 86 of file ps_zone.cpp. References NL3D::CPSLocated::releaseCollisionInfo(), and NL3D::CPSLocated::releaseNonIntegrableForceRef().
00087 {
00088 // tell the target that we were using collision infos and that we won't use them anymore
00089 target->releaseCollisionInfo();
00090 target->releaseNonIntegrableForceRef();
00091 }
|
|
Resize the bindable attributes containers should not be called directly. Call CPSLocated::resize instead Implements NL3D::CPSLocatedBindable. Definition at line 1247 of file ps_zone.cpp. References _Dim, nlassert, NL3D::CPSAttrib< T >::resize(), NL3D::CPSAttrib< CPlaneBasis >::resize(), size, and uint32.
|
|
serialization, DERIVER must override this, and call the parent version
Reimplemented from NL3D::CPSZone. Definition at line 1237 of file ps_zone.cpp.
01238 { 01239 f.serialVersion(1); 01240 CPSZone::serial(f); 01241 f.serial(_Basis); 01242 f.serial(_Dim); 01243 } |
|
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; } |
|
set the bounce factor. It has meaning only if the behaviour is set to bounce...
Definition at line 108 of file ps_zone.h. References NL3D::CPSZone::_BounceFactor.
00108 { _BounceFactor = bounceFactor; } |
|
Definition at line 114 of file ps_zone.h. References NL3D::CPSZone::_CollisionBehaviour.
00114 { _CollisionBehaviour = behaviour; } |
|
*************************************************************************************** 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; } |
|
Implements NL3D::IPSMover. Definition at line 1198 of file ps_zone.cpp. References NLMISC::CMatrix::getI(), NLMISC::CMatrix::getJ(), NLMISC::CMatrix::getPos(), NL3D::CPSLocated::getPos(), index, and uint32.
|
|
set the located bindable name (edition purpose)
Definition at line 946 of file ps_located.h.
00946 { _Name = name; } |
|
if the object only stores a normal, this set the normal of the object. Otherwise it has no effect
Reimplemented in NL3D::CPSCylindricVortex, NL3D::CPSZonePlane, and NL3D::CPSZoneDisc. Definition at line 92 of file ps_edit.h.
00092 { } |
|
***************************************************************************************
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 from NL3D::IPSMover. Definition at line 1231 of file ps_zone.cpp. References _Dim, index, s, and uint32.
|
|
Reimplemented from NL3D::IPSMover. Definition at line 1221 of file ps_zone.cpp.
01222 { 01223 _Dim[k] = CVector(scale, scale, scale); 01224 } |
|
|
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 zone (edition mode).
Implements NL3D::CPSZone. Definition at line 1160 of file ps_zone.cpp. References _Dim, NL3D::CPSAttrib< CPlaneBasis >::begin(), NL3D::CPSAttrib< T >::begin(), NL3D::CPSAttrib< T >::end(), NL3D::CParticleSystem::getCurrentEditedElement(), NL3D::CPSLocatedBindable::getDriver(), NL3D::CPSLocatedBindable::getFontGenerator(), NL3D::CPSLocatedBindable::getFontManager(), NL3D::CPSLocatedBindable::getLocalToWorldMatrix(), NL3D::CParticleSystemProcess::getOwner(), NL3D::CPSLocated::getPos(), index, NLMISC::CMatrix::setPos(), NLMISC::CMatrix::setRot(), NL3D::CPSLocatedBindable::setupDriverModelMatrix(), NL3D::TAnimationTime, and uint32.
01161 { 01162 TPSAttribVector::const_iterator dimIt = _Dim.begin() 01163 ,posIt = _Owner->getPos().begin() 01164 , endPosIt = _Owner->getPos().end(); 01165 01166 CPSAttrib<CPlaneBasis>::const_iterator basisIt = _Basis.begin(); 01167 01168 setupDriverModelMatrix(); 01169 CMatrix mat; 01170 01171 01172 01173 CPSLocated *loc; 01174 uint32 index; 01175 CPSLocatedBindable *lb; 01176 _Owner->getOwner()->getCurrentEditedElement(loc, index, lb); 01177 01178 01179 for (uint32 k = 0; posIt != endPosIt; ++posIt, ++dimIt, ++basisIt, ++k) 01180 { 01181 mat.setRot(basisIt->X, basisIt->Y, basisIt->X ^ basisIt->Y); 01182 mat.setPos(CVector::Null); 01183 01184 const CRGBA col = ((lb == NULL || this == lb) && loc == _Owner && index == k ? CRGBA::Red : CRGBA(127, 127, 127)); 01185 01186 01187 CPSUtil::displayCylinder(*getDriver(), *posIt, mat, *dimIt, 32, col); 01188 01189 mat.setPos(*posIt); 01190 CPSUtil::displayBasis(getDriver() ,getLocalToWorldMatrix(), mat, 1.f, *getFontGenerator(), *getFontManager()); 01191 setupDriverModelMatrix(); 01192 01193 } 01194 } |
|
Process one pass for the zone The default behaviour call performMotion or show depending on the pass being processed Implements NL3D::CPSLocatedBindable. Definition at line 95 of file ps_zone.cpp. References NL3D::CPSZone::performMotion(), NL3D::PSCollision, NL3D::PSToolRender, NL3D::CPSZone::show(), and NL3D::TAnimationTime.
00096 { 00097 // for zone, the PSCollision pass and the PSToolRenderPass are processed 00098 switch(pass) 00099 { 00100 case PSCollision: 00101 performMotion(ellapsedTime); 00102 break; 00103 case PSToolRender: 00104 show(ellapsedTime); 00105 break; 00106 default: break; 00107 } 00108 } |
|
Send back true if non-uniform scaling can be applied If it sends false, non-uniform scaling leads to undefine results (default has no effect) Reimplemented from NL3D::IPSMover. Definition at line 306 of file ps_zone.h.
00306 { return true; } |
|
Send back true if uniform scaling can be applied If it sends false, uniform scaling leads to undefine results Reimplemented from NL3D::IPSMover. Definition at line 305 of file ps_zone.h.
00305 { return true; } |
|
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 123 of file ps_zone.h. Referenced by NL3D::CPSZone::getBounceFactor(), and NL3D::CPSZone::setBounceFactor(). |
|
Definition at line 126 of file ps_zone.h. Referenced by NL3D::CPSZone::getCollisionBehaviour(), and NL3D::CPSZone::setCollisionBehaviour(). |
|
Definition at line 326 of file ps_zone.h. Referenced by deleteElement(), getScale(), newElement(), performMotion(), resize(), setScale(), and show(). |
|
Definition at line 1027 of file ps_located.h. Referenced by NL3D::CPSLocatedBindable::getExternID(), NL3D::CPSLocatedBindable::setExternID(), and NL3D::CPSLocatedBindable::~CPSLocatedBindable(). |
|
tells when this object must be dealt with
Definition at line 1029 of file ps_located.h. Referenced by NL3D::CPSLocatedBindable::getLOD(), and NL3D::CPSLocatedBindable::setLOD(). |
|
Definition at line 1031 of file ps_located.h. |
|
|