NL3D::CParticleSystemShape Class Reference

#include <particle_system_shape.h>

Inheritance diagram for NL3D::CParticleSystemShape:

NL3D::IShape NLMISC::CRefCount NLMISC::IStreamable NLMISC::IClassable

Detailed Description

This class helps to instanciate a particle system (the shape contains a particle system prototype stored as a memory stream) Use the createInstance method to insert the system in a scene To load the shape from a file, use a shape stream

Definition at line 64 of file particle_system_shape.h.

Public Member Functions

void buildFromPS (const NL3D::CParticleSystem &ps)
 ===========================================================================

virtual bool clip (const std::vector< CPlane > &pyramid, const CMatrix &worldMatrix)
 CParticleSystemShape ()
 ===========================================================================

virtual CTransformShapecreateInstance (NL3D::CScene &scene)
 ===========================================================================

virtual void flushTextures (IDriver &driver, uint selectedTexture)
 ===========================================================================

virtual void getAABBox (NLMISC::CAABBox &bbox) const
 ===========================================================================

virtual std::string getClassName ()=0
CTrackDefaultBoolgetDefaultTriggerTrack (void)
 get a the trigger default track

float getDistMax () const
virtual float getNumTriangles (float distance)
const sintgetRefCount () const
CTrackDefaultFloatgetUserParamDefaultTrack (uint numTrack)
 get a the user param default tracks

CParticleSysteminstanciatePS (CScene &scene, NLMISC::CContiguousBlockAllocator *blockAllocator=NULL)
 ===========================================================================

bool isShared () const
 NLMISC_DECLARE_CLASS (CParticleSystemShape)
virtual void profileSceneRender (CRenderTrav *rdrTrav, CTransformShape *trans, bool opaquePass)
virtual void serial (NLMISC::IStream &f) throw (NLMISC::EStream)
 ===========================================================================

void setDistMax (float distMax)
virtual ~CParticleSystemShape ()
 Dtor.

access default tracks.
CTrackDefaultVectorgetDefaultPos ()
CTrackDefaultQuatgetDefaultRotQuat ()
CTrackDefaultVectorgetDefaultScale ()
Inherited from IShape.
virtual void render (NL3D::IDriver *drv, CTransformShape *trans, bool passOpaque)
 ===========================================================================


Data Fields

sint crefs
CPtrInfo * pinfo

Static Public Attributes

CPtrInfo NullPtrInfo

Protected Attributes

std::vector< NLMISC::CSmartPtr<
ITexture > > 
_CachedTex
CTrackDefaultVector _DefaultPos
 Transform default tracks.

CTrackDefaultQuat _DefaultRotQuat
CTrackDefaultVector _DefaultScale
CTrackDefaultBool _DefaultTriggerTrack
 Trigger default track.

bool _DestroyModelWhenOutOfRange
bool _DestroyWhenOutOfFrustum
float _DistMax
 Default to -1.

float _MaxViewDist
uint _NumBytesWanted
NLMISC::CMemStream _ParticleSystemProto
NLMISC::CAABBox _PrecomputedBBox
NLMISC::CRefPtr< CParticleSystem_SharedSystem
 For sharing, this tells us if there's a system already instanciated that we could use for sharing.

bool _Sharing
bool _UsePrecomputedBBox
CTrackDefaultFloat _UserParamDefaultTrack [4]
 the default track for animation of user parameters


Friends

class CParticleSystem
class CParticleSystemModel
struct CPtrInfo


Constructor & Destructor Documentation

NL3D::CParticleSystemShape::CParticleSystemShape  ) 
 

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

Definition at line 64 of file particle_system_shape.cpp.

References _DefaultTriggerTrack, _UserParamDefaultTrack, NL3D::CTrackDefaultNotBlendable< bool >::setValue(), NL3D::CTrackDefaultBlendable< CQuat >::setValue(), NL3D::CTrackDefaultBlendable< CVector >::setValue(), NL3D::CTrackDefaultBlendable< float >::setValue(), and uint.

00064                                            : _MaxViewDist(100.f),
00065                                                                                            _DestroyWhenOutOfFrustum(false),
00066                                                                                            _DestroyModelWhenOutOfRange(false),
00067                                                                                            _UsePrecomputedBBox(false),
00068                                                                                            _Sharing(false),
00069                                                                                            _NumBytesWanted(0)
00070 {
00071         for (uint k = 0; k < 4; ++k)
00072         {
00073                 _UserParamDefaultTrack[k].setValue(0);
00074         }
00075         _DefaultPos.setValue(CVector::Null);
00076         _DefaultScale.setValue( CVector(1, 1, 1) );     
00077         _DefaultRotQuat.setValue(CQuat());
00078         _DefaultTriggerTrack.setValue(true); // by default, system start as soon as they are instanciated
00079 
00080 }

virtual NL3D::CParticleSystemShape::~CParticleSystemShape  )  [inline, virtual]
 

Dtor.

Definition at line 78 of file particle_system_shape.h.

00078 {}


Member Function Documentation

void NL3D::CParticleSystemShape::buildFromPS const NL3D::CParticleSystem ps  ) 
 

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

build the shape from a 'raw' particle system. A prototype will be created by copying the system in a memory stream NOTE : For now, prefer the instanciation from a file, which do not need reallocation

Definition at line 136 of file particle_system_shape.cpp.

References _ParticleSystemProto, _PrecomputedBBox, _UsePrecomputedBBox, NL3D::CParticleSystem::computeBBox(), NL3D::CParticleSystem::doesDestroyWhenOutOfFrustum(), NL3D::CParticleSystem::getAutoComputeBBox(), NL3D::CParticleSystem::getDestroyModelWhenOutOfRange(), NL3D::CParticleSystem::getMaxViewDist(), NLMISC::CMemStream::invert(), NLMISC::IStream::isReading(), NL3D::CParticleSystem::isSharingEnabled(), nlassert, and NLMISC::IStream::serialPtr().

00137 {
00138         // must be sure that we are writting in the stream
00139         if (_ParticleSystemProto.isReading())
00140         {
00141                 _ParticleSystemProto.invert();
00142         }
00143         
00144         // to have const correctness in the prototype, we must do this...
00145         CParticleSystem *myPs = const_cast<CParticleSystem *>(&ps);
00146         nlassert(myPs);
00147         // build the prototype  
00148         _ParticleSystemProto.serialPtr(myPs);
00149 
00150         // mirror some system values
00151         _MaxViewDist = myPs->getMaxViewDist();
00152         _DestroyWhenOutOfFrustum = myPs->doesDestroyWhenOutOfFrustum(); 
00153         _DestroyModelWhenOutOfRange = myPs->getDestroyModelWhenOutOfRange();
00154         if (!myPs->getAutoComputeBBox())
00155         {
00156                 _UsePrecomputedBBox = true;
00157                 myPs->computeBBox(_PrecomputedBBox);
00158         }
00159         else
00160         {
00161                 _UsePrecomputedBBox = false;
00162         }
00163         _Sharing = myPs->isSharingEnabled();
00164 }

virtual bool NL3D::IShape::clip const std::vector< CPlane > &  pyramid,
const CMatrix worldMatrix
[inline, virtual, inherited]
 

clip this shape with a pyramid. the pyramid is given in world space.The world matrix of the object is given.

Parameters:
pyramid the clipping polytope, planes are normalized.
worldMatrix the world matrix of the instance.
Returns:
true if the object is visible, false otherwise. The default behavior is to return true (never clipped).

Reimplemented in NL3D::CFlareShape, NL3D::CMesh, NL3D::CMeshMRM, NL3D::CMeshMRMSkinned, NL3D::CMeshMultiLod, NL3D::CSegRemanenceShape, NL3D::CSkeletonShape, NL3D::CWaterShape, and NL3D::CWaveMakerShape.

Definition at line 93 of file shape.h.

00093 {return true;}

CTransformShape * NL3D::CParticleSystemShape::createInstance NL3D::CScene scene  )  [virtual]
 

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

create a particle system instance

Parameters:
scene the scene used to createModel().
Returns:
the specialized instance for this shape.

Reimplemented from NL3D::IShape.

Definition at line 267 of file particle_system_shape.cpp.

References NL3D::CParticleSystemModel::_Scene, NL3D::CAnimatedValueQuat, NL3D::CAnimatedValueVector, NL3D::CScene::createModel(), NL3D::CTrackDefaultBlendable< CQuat >::getValue(), NL3D::CTrackDefaultBlendable< CVector >::getValue(), NL3D::CTransform::setLoadBalancingGroup(), and NL3D::CTransformShape::Shape.

00268 {
00269         CParticleSystemModel *psm = NLMISC::safe_cast<CParticleSystemModel *>(scene.createModel(NL3D::ParticleSystemModelId) );
00270         psm->Shape = this;
00271         psm->_Scene = &scene; // the model needs the scene to recreate the particle system he holds                     
00272         // by default, we don't instanciate the system. It will be instanciated only if visible and triggered
00273         // psm->_ParticleSystem = instanciatePS(scene); 
00274 
00275         // Setup position with the default value
00276         psm->ITransformable::setPos( ((CAnimatedValueVector&)_DefaultPos.getValue()).Value  );
00277         psm->ITransformable::setRotQuat( ((CAnimatedValueQuat&)_DefaultRotQuat.getValue()).Value  );    
00278         psm->ITransformable::setScale( ((CAnimatedValueVector&)_DefaultScale.getValue()).Value  );
00279 
00280         // ParticleSystems are added to the "Fx" Load Balancing Group.
00281         psm->setLoadBalancingGroup("Fx");
00282 
00283         return psm;
00284 }

void NL3D::CParticleSystemShape::flushTextures IDriver driver,
uint  selectedTexture
[virtual]
 

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

Implements NL3D::IShape.

Definition at line 344 of file particle_system_shape.cpp.

References _CachedTex, _NumBytesWanted, _ParticleSystemProto, _SharedSystem, NL3D::CParticleSystem::enumTexs(), NLMISC::CContiguousBlockAllocator::init(), NLMISC::CMemStream::invert(), NLMISC::IStream::isReading(), NLMISC::CMemStream::resetPtrTable(), NLMISC::CMemStream::seek(), NLMISC::IStream::serialPtr(), NL3D::IDriver::setupTexture(), and uint.

00345 {
00346         // if textures are already flushed, no-op
00347         if (!_CachedTex.empty()) return;        
00348         if (_SharedSystem)
00349         {
00350                 _SharedSystem->enumTexs(_CachedTex, driver);
00351         }
00352         else
00353         {
00354                 NLMISC::CMutex mutex;
00355                 mutex.enter();
00356 
00357                 // must create an instance just to flush the textures
00358                 CParticleSystem *myInstance = NULL;
00359 
00360                 #ifdef PS_FAST_ALLOC
00361                         NLMISC::CContiguousBlockAllocator blockAllocator;
00362                         PSBlockAllocator = &blockAllocator;
00363                         blockAllocator.init(300000); // we release memory just after, and we don't want to fragment the memory, so provide large enough mem             
00364                 #endif
00365                 // serialize from the memory stream     
00366                 if (!_ParticleSystemProto.isReading()) // we must be sure that we are reading the stream
00367                 {
00368                         _ParticleSystemProto.invert();
00369                 }                               
00370                 _ParticleSystemProto.resetPtrTable();
00371                 _ParticleSystemProto.seek(0, NLMISC::IStream::begin);
00372                 _ParticleSystemProto.serialPtr(myInstance); // instanciate the system                   
00373                 #ifdef PS_FAST_ALLOC
00374                         _NumBytesWanted = blockAllocator.getNumAllocatedBytes(); // next allocation will be fast because we know how much memory to allocate
00375                 #endif
00376                 myInstance->enumTexs(_CachedTex, driver);
00377                 delete myInstance;              
00378                 #ifdef PS_FAST_ALLOC
00379                         PSBlockAllocator = NULL;
00380                 #endif
00381                 mutex.leave();
00382         }
00383         for(uint k = 0; k < _CachedTex.size(); ++k)
00384         {                               
00385                 //nlinfo(_CachedTex[k]->getShareName().c_str());
00386                 if (_CachedTex[k]) driver.setupTexture(*_CachedTex[k]);         
00387         }
00388 }

void NL3D::CParticleSystemShape::getAABBox NLMISC::CAABBox bbox  )  const [virtual]
 

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

Reimplemented from NL3D::IShape.

Definition at line 167 of file particle_system_shape.cpp.

References _PrecomputedBBox, _UsePrecomputedBBox, NLMISC::CAABBox::setCenter(), and NLMISC::CAABBox::setHalfSize().

00168 {
00169         if (!_UsePrecomputedBBox)
00170         {
00171                 bbox.setCenter(NLMISC::CVector::Null);
00172                 bbox.setHalfSize(NLMISC::CVector(1, 1, 1));
00173         }
00174         else
00175         {
00176                 bbox = _PrecomputedBBox;
00177         }
00178 }

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

CTrackDefaultVector* NL3D::CParticleSystemShape::getDefaultPos  )  [inline]
 

Definition at line 127 of file particle_system_shape.h.

Referenced by NL3D::CParticleSystemModel::getDefaultTrack().

00127 {return &_DefaultPos;}

CTrackDefaultQuat* NL3D::CParticleSystemShape::getDefaultRotQuat  )  [inline]
 

Definition at line 129 of file particle_system_shape.h.

Referenced by NL3D::CParticleSystemModel::getDefaultTrack().

00129 {return &_DefaultRotQuat;}

CTrackDefaultVector* NL3D::CParticleSystemShape::getDefaultScale  )  [inline]
 

Definition at line 128 of file particle_system_shape.h.

Referenced by NL3D::CParticleSystemModel::getDefaultTrack().

00128 {return &_DefaultScale;}

CTrackDefaultBool* NL3D::CParticleSystemShape::getDefaultTriggerTrack void   )  [inline]
 

get a the trigger default track

Definition at line 108 of file particle_system_shape.h.

References _DefaultTriggerTrack.

Referenced by NL3D::CParticleSystemModel::getDefaultTrack().

00109         {
00110         
00111                 return &_DefaultTriggerTrack;
00112         }

float NL3D::IShape::getDistMax  )  const [inline, inherited]
 

return the DistMax where the shape is no more displayed. Default is to return -1, meaning DistMax = infinite.

Definition at line 112 of file shape.h.

00112 {return _DistMax;}

virtual float NL3D::CParticleSystemShape::getNumTriangles float  distance  )  [inline, virtual]
 

this method is meaningless here : the traverseLoadBalancing() for particle system compute the number of triangles from the Model, not the shape

Implements NL3D::IShape.

Definition at line 122 of file particle_system_shape.h.

00122 { return 0; }

const sint& NLMISC::CRefCount::getRefCount  )  const [inline, inherited]
 

Definition at line 70 of file smart_ptr.h.

References NLMISC::CRefCount::crefs, and sint.

00071         {
00072                 return  crefs;
00073         }

CTrackDefaultFloat* NL3D::CParticleSystemShape::getUserParamDefaultTrack uint  numTrack  )  [inline]
 

get a the user param default tracks

Definition at line 100 of file particle_system_shape.h.

References _UserParamDefaultTrack, nlassert, and uint.

Referenced by NL3D::CParticleSystemModel::getDefaultTrack().

00101         {
00102                 nlassert(numTrack < 4);
00103                 return &_UserParamDefaultTrack[numTrack];
00104         }

CParticleSystem * NL3D::CParticleSystemShape::instanciatePS CScene scene,
NLMISC::CContiguousBlockAllocator blockAllocator = NULL
 

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

Instanciate a particle system from this shape. A particle system may need to call this when a system is back in the frustum An contiguous block allocator may be provided for fast alloc, init will be called on such allocator with 0 if num bytes is unknown of with the size needed otherwise.

Definition at line 182 of file particle_system_shape.cpp.

References _CachedTex, _NumBytesWanted, _ParticleSystemProto, _SharedSystem, NL3D::CParticleSystem::enumTexs(), NL3D::CScene::getDriver(), NLMISC::CContiguousBlockAllocator::getNumAllocatedBytes(), NLMISC::CContiguousBlockAllocator::init(), NLMISC::CMemStream::invert(), NLMISC::IStream::isReading(), NLMISC::CMemStream::resetPtrTable(), NLMISC::CMemStream::seek(), NLMISC::IStream::serialPtr(), NL3D::CParticleSystem::setScene(), NL3D::IDriver::setupTexture(), and uint.

Referenced by NL3D::CParticleSystem::merge(), and NL3D::CParticleSystemModel::reallocRsc().

00183 {                                       
00184         if (_Sharing && _SharedSystem != NULL) // is sharing enabled, and is a system already instanciated
00185         {
00186                 return _SharedSystem;
00187         }
00188 
00189         // avoid prb with concurent thread (may append if an instance group containing ps is loaded in background)
00190         NLMISC::CMutex mutex;
00191         mutex.enter();
00192 
00193 
00194         #ifdef PS_FAST_ALLOC
00195                 if (blockAllocator)
00196                 {
00197                         // set new allocator for particle system memory
00198                         PSBlockAllocator = blockAllocator;
00199                         blockAllocator->init(_NumBytesWanted); // if size wanted is already known, set it               
00200                 }
00201         #endif
00202 
00203         //NLMISC::TTicks start = NLMISC::CTime::getPerformanceTime();
00204         // copy the datas
00205         CParticleSystem *myInstance = NULL;
00206 
00207         // serialize from the memory stream     
00208         if (!_ParticleSystemProto.isReading()) // we must be sure that we are reading the stream
00209         {
00210                 _ParticleSystemProto.invert();
00211         }
00212 
00213         _ParticleSystemProto.resetPtrTable();
00214         _ParticleSystemProto.seek(0, NLMISC::IStream::begin);
00215         
00216 //      NLMISC::TTicks start = NLMISC::CTime::getPerformanceTime();     
00217         _ParticleSystemProto.serialPtr(myInstance); // instanciate the system   
00218 /*      NLMISC::TTicks end = NLMISC::CTime::getPerformanceTime();
00219         nlinfo("instanciation time = %.2f", (float) (1000 * NLMISC::CTime::ticksToSecond(end - start)));        
00220 */      
00221 
00222         myInstance->setScene(&scene);   
00223 
00224         if (_CachedTex.empty() && scene.getDriver())
00225         {
00226                 //nlinfo("flushing texs");
00227                 // load && cache textures
00228                 myInstance->enumTexs(_CachedTex, *scene.getDriver());           
00229                 for(uint k = 0; k < _CachedTex.size(); ++k)
00230                 {               
00231                         if (_CachedTex[k]) scene.getDriver()->setupTexture (*(ITexture *)_CachedTex[k]);                        
00232                 }
00233         }
00234         else
00235         {
00236                 /*
00237                 for(uint k = 0; k < _CachedTex.size(); ++k)
00238                 {                                                               
00239                         nlinfo(_CachedTex[k]->getShareName().c_str());
00240                 }
00241                 */
00242         }
00243 
00244         // tmp
00245 
00246         if (_Sharing)
00247         {
00248                 _SharedSystem = myInstance; // set this as the first shared instance
00249         }
00250 
00251         #ifdef PS_FAST_ALLOC
00252                 if (blockAllocator)
00253                 {
00254                         _NumBytesWanted = blockAllocator->getNumAllocatedBytes(); // now we know the number of wanted bytes, subsequent alloc can be much faster
00255                         PSBlockAllocator = NULL;
00256                 }
00257         #endif
00258                 
00259         mutex.leave();
00260 
00261         /*NLMISC::TTicks end = NLMISC::CTime::getPerformanceTime();
00262         nlinfo("instanciation time = %.2f", (float) (1000 * NLMISC::CTime::ticksToSecond(end - start)));        */
00263         return myInstance;              
00264 }

bool NL3D::CParticleSystemShape::isShared  )  const [inline]
 

Definition at line 133 of file particle_system_shape.h.

Referenced by NL3D::CParticleSystemModel::reallocRsc(), NL3D::CParticleSystemModel::releasePSPointer(), and NL3D::CParticleSystemModel::releaseRscAndInvalidate().

00133 { return _Sharing; }            

NL3D::CParticleSystemShape::NLMISC_DECLARE_CLASS CParticleSystemShape   ) 
 

virtual void NL3D::IShape::profileSceneRender CRenderTrav rdrTrav,
CTransformShape trans,
bool  opaquePass
[inline, virtual, inherited]
 

Profiling. Called in RenderPass if Current Frame profiled. No-Op by default Informations must be added in rdrTrav->Scene

Reimplemented in NL3D::CMesh, NL3D::CMeshMRM, NL3D::CMeshMRMSkinned, and NL3D::CMeshMultiLod.

Definition at line 123 of file shape.h.

00123 {}

void NL3D::CParticleSystemShape::render NL3D::IDriver drv,
CTransformShape trans,
bool  passOpaque
[virtual]
 

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

render() a particle system in a driver, with the specified TransformShape information. CTransfromShape call this method in the render traversal.

Implements NL3D::IShape.

Definition at line 287 of file particle_system_shape.cpp.

References NL3D::CParticleSystemModel::_Invalidated, NL3D::CParticleSystemModel::getEllapsedTime(), NL3D::CParticleSystemModel::getPS(), NL3D::CParticleSystem::getScene(), NL3D::CParticleSystemModel::getUserMatrix(), NL3D::CTransform::getWorldMatrix(), H_AUTO, NL3D::CParticleSystem::isSharingEnabled(), NL3D::CParticleSystemModel::isToolDisplayEnabled(), nlassert, PARTICLES_CHECK_MEM, NL3D::PSLookAtRenderTime, NL3D::CParticleSystem::setDriver(), NL3D::CParticleSystem::setSysMat(), NL3D::CParticleSystem::setUserMatrix(), NL3D::CParticleSystem::step(), and NL3D::TAnimationTime.

00288 {
00289         H_AUTO ( NL3D_Particles_Render );
00290         nlassert(drv);
00291         CParticleSystemModel *psm = NLMISC::safe_cast<CParticleSystemModel *>(trans);
00292         if (psm->_Invalidated) return;
00293         CParticleSystem *ps = psm->getPS();
00295         if (!ps) return;
00296         
00297         TAnimationTime delay = psm->getEllapsedTime();
00298         nlassert(ps->getScene());       
00299 
00301         // render particles  //
00303 
00305         if (ps->isSharingEnabled())
00306         {
00307                 ps->setSysMat(&(psm->getWorldMatrix()));
00308                 ps->setUserMatrix(&(psm->getUserMatrix()));
00309         }
00310         
00311         // Setup the matrix.
00313 
00314         ps->setDriver(drv);
00315         // draw particle
00316         PARTICLES_CHECK_MEM;    
00317         if (passOpaque)
00318         {
00319                 PSLookAtRenderTime = 0;
00320                 //NLMISC::TTicks start = NLMISC::CTime::getPerformanceTime();                                   
00321                 ps->step(CParticleSystem::SolidRender, delay);
00322                 /*NLMISC::TTicks end = NLMISC::CTime::getPerformanceTime();
00323                 nlinfo("Solid render time time = %.2f", (float) (1000 * NLMISC::CTime::ticksToSecond(end - start)));    
00324                 nlinfo("LookAt Render time = %.2f", (float) (1000 * NLMISC::CTime::ticksToSecond(PSLookAtRenderTime))); */
00325         }
00326         else
00327         {
00328                 //PSLookAtRenderTime = 0;
00329                 //NLMISC::TTicks start = NLMISC::CTime::getPerformanceTime();
00330                 ps->step(CParticleSystem::BlendRender, delay);
00331                 /*NLMISC::TTicks end = NLMISC::CTime::getPerformanceTime();
00332                 nlinfo("Blend render time time = %.2f", (float) (1000 * NLMISC::CTime::ticksToSecond(end - start)));
00333                 nlinfo("LookAt Render time = %.2f", (float) (1000 * NLMISC::CTime::ticksToSecond(PSLookAtRenderTime))); */
00334         }
00335         PARTICLES_CHECK_MEM;
00336         if (psm->isToolDisplayEnabled())
00337         {
00338                 ps->step(CParticleSystem::ToolRender, delay);
00339                 PARTICLES_CHECK_MEM;
00340         }       
00341 }

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

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

version 6 : added sharing flag

Implements NLMISC::IStreamable.

Definition at line 83 of file particle_system_shape.cpp.

References sint, uint, and uint8.

00084 {
00085         sint ver = f.serialVersion(6);
00087         //NLMISC::CVector8 &buf = _ParticleSystemProto.bufferAsVector();
00088         //f.serialCont(buf);
00089 
00090         if (f.isReading ())
00091         {
00092                 std::vector<uint8> buf;
00093                 f.serialCont(buf);
00094                 _ParticleSystemProto.fill(&buf[0], buf.size());
00095         }
00096         else
00097         {
00098                 f.serialBufferWithSize ((uint8*)_ParticleSystemProto.buffer(), _ParticleSystemProto.length());
00099         }
00100 
00101         if (ver > 1)
00102         {
00103                 // serial default tracks
00104                 for (uint k = 0; k < 4; ++k)
00105                 {
00106                         f.serial(_UserParamDefaultTrack[k]);
00107                 }
00108         }
00109         if ( ver > 2)
00110         {
00111                 f.serial (_DefaultPos);
00112                 f.serial (_DefaultScale);               
00113                 f.serial (_DefaultRotQuat);
00114         }
00115         if ( ver > 3)
00116         {
00117                 f.serial(_MaxViewDist);
00118                 f.serial(_DestroyWhenOutOfFrustum);             
00119                 f.serial(_DestroyModelWhenOutOfRange);
00120         }
00121         if ( ver > 4)
00122         {
00123                 f.serial(_UsePrecomputedBBox);
00124                 if (_UsePrecomputedBBox)
00125                 {
00126                         f.serial(_PrecomputedBBox);
00127                 }
00128         }
00129         if ( ver > 5)
00130         {
00131                 f.serial(_Sharing);
00132         }
00133 }

void NL3D::IShape::setDistMax float  distMax  )  [inherited]
 

setup the DistMax where the shape is no more displayed. Take effect only for the next created instances. setting <0 means -1 and so means DistMax = infinite.

Definition at line 66 of file shape.cpp.

Referenced by NL3D::CFlareShape::CFlareShape().

00067 {
00068         _DistMax= distMax;
00069         // normalize infinite setup.
00070         if(distMax<0)
00071                 _DistMax= -1;
00072 }

virtual IMeshGeom* NL3D::IShape::supportMeshBlockRendering CTransformShape trans,
float &  polygonCount
const [inline, virtual, inherited]
 

return !NULL if this shape can support MeshBlock rendering for a special instance. NB: Mesh Block render cannot occurs if the Mesh is Skinned/MeshMorphed. NB: Mesh Block render can occurs only in Opaque pass NB: Mesh block render can occurs only for CMeshBase meshes.

Parameters:
trans the instance to take into account (meshMultiLod may return NULL in blend transition).
polygonCount the number of polygons to render for the meshGeom returned
Returns:
the meshgeom to render per block if OK, else NULL (default)

Reimplemented in NL3D::CMesh, NL3D::CMeshMRM, NL3D::CMeshMRMSkinned, and NL3D::CMeshMultiLod.

Definition at line 158 of file shape.h.

00158 {return NULL;}

virtual bool NL3D::IShape::useLightingLocalAttenuation  )  const [inline, virtual, inherited]
 

tells if the shape wants LocalAttenuation for RealTime lighting. Default is false

Reimplemented in NL3D::CMeshBase.

Definition at line 142 of file shape.h.

00142 {return false;}


Friends And Related Function Documentation

friend class CParticleSystem [friend]
 

Definition at line 137 of file particle_system_shape.h.

friend class CParticleSystemModel [friend]
 

Definition at line 136 of file particle_system_shape.h.

friend struct CPtrInfo [friend, inherited]
 

Definition at line 67 of file smart_ptr.h.


Field Documentation

std::vector<NLMISC::CSmartPtr<ITexture> > NL3D::CParticleSystemShape::_CachedTex [protected]
 

Definition at line 178 of file particle_system_shape.h.

Referenced by flushTextures(), and instanciatePS().

CTrackDefaultVector NL3D::CParticleSystemShape::_DefaultPos [protected]
 

Transform default tracks.

Definition at line 162 of file particle_system_shape.h.

CTrackDefaultQuat NL3D::CParticleSystemShape::_DefaultRotQuat [protected]
 

Definition at line 164 of file particle_system_shape.h.

CTrackDefaultVector NL3D::CParticleSystemShape::_DefaultScale [protected]
 

Definition at line 163 of file particle_system_shape.h.

CTrackDefaultBool NL3D::CParticleSystemShape::_DefaultTriggerTrack [protected]
 

Trigger default track.

Definition at line 167 of file particle_system_shape.h.

Referenced by CParticleSystemShape(), and getDefaultTriggerTrack().

bool NL3D::CParticleSystemShape::_DestroyModelWhenOutOfRange [protected]
 

Definition at line 173 of file particle_system_shape.h.

Referenced by NL3D::CParticleSystemModel::refreshRscDeletion(), NL3D::CParticleSystemModel::traverseAnimDetail(), and NL3D::CParticleSystemModel::traverseClip().

bool NL3D::CParticleSystemShape::_DestroyWhenOutOfFrustum [protected]
 

Definition at line 172 of file particle_system_shape.h.

Referenced by NL3D::CParticleSystemModel::refreshRscDeletion(), and NL3D::CParticleSystemModel::traverseAnimDetail().

float NL3D::IShape::_DistMax [protected, inherited]
 

Default to -1.

Definition at line 165 of file shape.h.

float NL3D::CParticleSystemShape::_MaxViewDist [protected]
 

Definition at line 155 of file particle_system_shape.h.

Referenced by NL3D::CParticleSystemModel::refreshRscDeletion(), and NL3D::CParticleSystemModel::traverseClip().

uint NL3D::CParticleSystemShape::_NumBytesWanted [protected]
 

Definition at line 183 of file particle_system_shape.h.

Referenced by flushTextures(), and instanciatePS().

NLMISC::CMemStream NL3D::CParticleSystemShape::_ParticleSystemProto [protected]
 

A memory stream containing a particle system. Each system is instanciated from this prototype Nevertheless, we store some more system infos which are needed for its lifecycle mgt.

Definition at line 154 of file particle_system_shape.h.

Referenced by buildFromPS(), flushTextures(), and instanciatePS().

NLMISC::CAABBox NL3D::CParticleSystemShape::_PrecomputedBBox [protected]
 

Definition at line 156 of file particle_system_shape.h.

Referenced by buildFromPS(), getAABBox(), and NL3D::CParticleSystemModel::traverseClip().

NLMISC::CRefPtr<CParticleSystem> NL3D::CParticleSystemShape::_SharedSystem [protected]
 

For sharing, this tells us if there's a system already instanciated that we could use for sharing.

Definition at line 170 of file particle_system_shape.h.

Referenced by flushTextures(), and instanciatePS().

bool NL3D::CParticleSystemShape::_Sharing [protected]
 

Definition at line 175 of file particle_system_shape.h.

bool NL3D::CParticleSystemShape::_UsePrecomputedBBox [protected]
 

Definition at line 174 of file particle_system_shape.h.

Referenced by buildFromPS(), getAABBox(), and NL3D::CParticleSystemModel::traverseClip().

CTrackDefaultFloat NL3D::CParticleSystemShape::_UserParamDefaultTrack[4] [protected]
 

the default track for animation of user parameters

Definition at line 159 of file particle_system_shape.h.

Referenced by CParticleSystemShape(), and getUserParamDefaultTrack().

sint NLMISC::CRefCount::crefs [mutable, inherited]
 

Definition at line 79 of file smart_ptr.h.

Referenced by NLMISC::CRefCount::CRefCount(), NLMISC::CRefCount::getRefCount(), and NLMISC::CRefCount::~CRefCount().

CRefCount::CPtrInfo NLMISC::CRefCount::NullPtrInfo [static, inherited]
 

Referenced by NLMISC::CRefCount::CRefCount().

CPtrInfo* NLMISC::CRefCount::pinfo [mutable, inherited]
 

Definition at line 80 of file smart_ptr.h.

Referenced by NLMISC::CRefCount::CRefCount(), and NLMISC::CRefCount::~CRefCount().


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