From 0ea5fc66924303d1bf73ba283a383e2aadee02f2 Mon Sep 17 00:00:00 2001 From: neodarz Date: Sat, 11 Aug 2018 20:21:34 +0200 Subject: Initial commit --- docs/doxygen/nel/ps__emitter_8h-source.html | 543 ++++++++++++++++++++++++++++ 1 file changed, 543 insertions(+) create mode 100644 docs/doxygen/nel/ps__emitter_8h-source.html (limited to 'docs/doxygen/nel/ps__emitter_8h-source.html') diff --git a/docs/doxygen/nel/ps__emitter_8h-source.html b/docs/doxygen/nel/ps__emitter_8h-source.html new file mode 100644 index 00000000..fb55afee --- /dev/null +++ b/docs/doxygen/nel/ps__emitter_8h-source.html @@ -0,0 +1,543 @@ + + + + nevrax.org : docs + + + + + + + + + + + + + + +
# Home   # nevrax.com   
+ + + + +
Nevrax
+ + + + + + + + + + +
+ + +
+ Nevrax.org
+ + + + + + + +
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
+
+ + +
+ + +
+Docs + +
+  + + + + + +
Documentation 
+ +
+Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  
+

ps_emitter.h

Go to the documentation of this file.
00001 
+00007 /* Copyright, 2001 Nevrax Ltd.
+00008  *
+00009  * This file is part of NEVRAX NEL.
+00010  * NEVRAX NEL is free software; you can redistribute it and/or modify
+00011  * it under the terms of the GNU General Public License as published by
+00012  * the Free Software Foundation; either version 2, or (at your option)
+00013  * any later version.
+00014 
+00015  * NEVRAX NEL is distributed in the hope that it will be useful, but
+00016  * WITHOUT ANY WARRANTY; without even the implied warranty of
+00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+00018  * General Public License for more details.
+00019 
+00020  * You should have received a copy of the GNU General Public License
+00021  * along with NEVRAX NEL; see the file COPYING. If not, write to the
+00022  * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+00023  * MA 02111-1307, USA.
+00024  */
+00025 
+00026 #ifndef NL_PS_EMITTER_H
+00027 #define NL_PS_EMITTER_H
+00028 
+00029 #include "nel/misc/types_nl.h"
+00030 #include "3d/ps_located.h"
+00031 #include "3d/ps_attrib_maker.h"
+00032 #include "3d/ps_edit.h"
+00033 #include "3d/ps_plane_basis.h"
+00034 #include "3d/ps_direction.h"
+00035 
+00036 
+00037 namespace NL3D {
+00038 
+00039 
+00049 class CPSEmitter : public CPSLocatedBindable
+00050 {
+00051 public:
+00052 
+00054 
+00055 
+00056                 CPSEmitter();
+00057 
+00058                 // dtor
+00059                 virtual ~CPSEmitter();
+00061 
+00063         uint32                                                  getType(void) const { return PSEmitter; }
+00064 
+00065 
+00067         virtual uint32                                  getPriority(void) const { return 500; }
+00068 
+00070         virtual bool                                    hasEmitters(void) { nlassert(_Owner); return _Owner->getSize() != 0; }
+00071                 
+00078         virtual void                                    step(TPSProcessPass pass, TAnimationTime ellapsedTime, TAnimationTime realEllapsedTime);
+00079         
+00080 
+00082         virtual void                                    showTool(void);
+00083 
+00085         void                                                    setEmittedType(CPSLocated *et);
+00086 
+00090         virtual void                                    notifyTargetRemoved(CPSLocated *ptr);
+00091 
+00093         CPSLocated                                              *getEmittedType(void) { return _EmittedType; }
+00095         const CPSLocated                                *getEmittedType(void) const { return _EmittedType; }
+00096 
+00097 
+00106         enum TEmissionType { regular = 0, onDeath = 1,  once = 2, onBounce = 3, externEmit = 4 };
+00107 
+00110         void                                                    setEmissionType(TEmissionType freqType);
+00111 
+00113         TEmissionType                                   getEmissionType(void) const { return _EmissionType; }
+00114 
+00118         void                                                    setPeriod(float period);
+00119 
+00121         float                                                   getPeriod(void) const { return _Period; }
+00122 
+00124         bool                                                    usePeriodScheme(void) { return _PeriodScheme != NULL; }
+00125 
+00127         void                                                    setPeriodScheme(CPSAttribMaker<float> *scheme);
+00128 
+00129         // Retrieve the period scheme, or null, if there'isnt
+00130         CPSAttribMaker<float>                   *getPeriodScheme(void) { return _PeriodScheme; }
+00131 
+00132         // Retrieve the period scheme, or null, if there'isnt (const version)
+00133         const CPSAttribMaker<float>             *getPeriodScheme(void) const  { return _PeriodScheme; }
+00134 
+00136         void                                                    setEmitDelay(float delay) { _EmitDelay = delay; }
+00137 
+00139         float                                                   getEmitDelay() const { return _EmitDelay; }
+00140 
+00142         void                                                    setMaxEmissionCount(uint8 count);
+00143 
+00145         uint8                                                   getMaxEmissionCount() const { return _MaxEmissionCount; }
+00146 
+00150         void                                                    setGenNb(uint32 GenNb);
+00151 
+00153         uint                                                    getGenNb(void) const { return _GenNb; }
+00154 
+00156         bool                                                    useGenNbScheme(void) { return _GenNbScheme != NULL; }
+00157 
+00159         void                                                    setGenNbScheme(CPSAttribMaker<uint32> *scheme);
+00160 
+00162         CPSAttribMaker<uint32>                  *getGenNbScheme(void) { return _GenNbScheme; }
+00163 
+00165         const CPSAttribMaker<uint32>    *getGenNbScheme(void) const  { return _GenNbScheme; }
+00166 
+00168         void serial(NLMISC::IStream &f) throw(NLMISC::EStream);
+00169 
+00171 
+00172 
+00175                 void                                                    setSpeedInheritanceFactor(float fact)
+00176                 {
+00177                         _SpeedInheritanceFactor = fact;
+00178                 }
+00179 
+00181                 float                                                   getSpeedInheritanceFactor(void) const
+00182                 {
+00183                         return _SpeedInheritanceFactor;
+00184                 }
+00185 
+00187                 void                                                    enableSpeedBasisEmission(bool enabled = true)
+00188                 {
+00189                         _SpeedBasisEmission  = enabled;
+00190                 }
+00191 
+00195                 bool                                                    isSpeedBasisEmissionEnabled(void) const { return _SpeedBasisEmission; }
+00196 
+00197 
+00204                 void                                                    setSpeedVectorInEmitterBasis(bool enable) { _EmitDirBasis = enable;}
+00205 
+00207                 bool                                                    isSpeedVectorInEmitterBasis(void) const   { return _EmitDirBasis;}
+00209         
+00211         void                                                    singleEmit(uint32 index, uint quantity);
+00212 
+00221         void                                                    enableConsistenEmission(bool enable) { _ConsistentEmission = enable; }
+00222 
+00223         bool                                                isConsistentEmissionEnabled() const { return _ConsistentEmission; }
+00224 
+00228         virtual void                     releaseRefTo(const CParticleSystemProcess *other);
+00229          
+00233         virtual void                     releaseAllRef();
+00234 
+00235 protected:      
+00236 
+00238         void                                            processEmit(uint32 index, sint nbToGenerate);
+00239 
+00241         void                                            processEmitConsistent(const NLMISC::CVector &emitterPos,
+00242                                                                                                           uint32 emitterIndex,
+00243                                                                                                           sint nbToGenerate,
+00244                                                                                                           TAnimationTime deltaT,
+00245                                                                                                           TAnimationTime ellapsedTime,
+00246                                                                                                           float realEllapsedTimeRatio
+00247                                                                                                          );
+00248 
+00250         void                                                    processRegularEmission(TAnimationTime ellapsedTime);
+00251 
+00254         void                                                    processRegularEmissionConsistent(TAnimationTime ellapsedTime, float realEllapsedTimeRatio);
+00255 
+00256 
+00257 
+00258 
+00266         virtual void                                    emit(const NLMISC::CVector &srcPos, uint32 index, NLMISC::CVector &pos, NLMISC::CVector &speed) = 0;
+00267 
+00270         virtual void                                    newElement(CPSLocated *emitterLocated, uint32 emitterIndex);
+00271         
+00276         virtual void                                    deleteElement(uint32 index);
+00277 
+00281         virtual void                                    resize(uint32 size);
+00282         virtual void                                    bounceOccured(uint32 index);    
+00283         void                                                    updateMaxCountVect();
+00284 
+00285 
+00286 
+00288         CPSLocated                                              *_EmittedType;
+00289 
+00292         TPSAttribFloat                                  _Phase;
+00293         TPSAttribUInt8                                  _NumEmission; // used only if MaxEmissionCount is != 0
+00294 
+00295         float                                                   _SpeedInheritanceFactor;        
+00296         TEmissionType                                   _EmissionType;
+00297         float _Period;
+00298         CPSAttribMaker<float>                   *_PeriodScheme;                 
+00299         uint32 _GenNb;
+00300         CPSAttribMaker<uint32>                  *_GenNbScheme;
+00301         float                                                   _EmitDelay;
+00302         uint8                                                   _MaxEmissionCount;
+00303         bool                                                    _SpeedBasisEmission;
+00304         bool                                                    _EmitDirBasis; // true when emission direction is in the emitter basis
+00305         bool                                                    _ConsistentEmission; 
+00306 };
+00307 
+00310 
+00315 class CPSModulatedEmitter
+00316 {
+00317         public:
+00318 
+00320                 CPSModulatedEmitter() : _EmitteeSpeed(1.f), _EmitteeSpeedScheme(NULL)
+00321                 {
+00322                 }
+00323 
+00325                 virtual ~CPSModulatedEmitter()
+00326                 {
+00327                         delete _EmitteeSpeedScheme;
+00328                 }
+00329 
+00333                 void setEmitteeSpeedScheme(CPSAttribMaker<float> *scheme)
+00334                 {
+00335                         delete _EmitteeSpeedScheme;
+00336                         _EmitteeSpeedScheme = scheme;
+00337                         if (getModulatedEmitterOwner() && scheme->hasMemory()) 
+00338                                 scheme->resize(getModulatedEmitterOwner()->getMaxSize(), getModulatedEmitterOwner()->getSize());
+00339                 }
+00340 
+00342                 void setEmitteeSpeed(float speed)
+00343                 {
+00344                         delete _EmitteeSpeedScheme;
+00345                         _EmitteeSpeedScheme = NULL;
+00346                         _EmitteeSpeed = speed;
+00347                 
+00348                 }
+00349 
+00351                 float getEmitteeSpeed(void) const { return _EmitteeSpeed; }
+00352 
+00354                 CPSAttribMaker<float> *getEmitteeSpeedScheme(void) { return _EmitteeSpeedScheme; }
+00355 
+00357                 const CPSAttribMaker<float> *getEmitteeSpeedScheme(void) const { return _EmitteeSpeedScheme; }
+00358 
+00360                 bool useEmitteeSpeedScheme(void) const { return _EmitteeSpeedScheme != NULL; }
+00361 
+00363                 void serialEmitteeSpeedScheme(NLMISC::IStream &f) throw(NLMISC::EStream);
+00364                 
+00365         protected:
+00366 
+00367                 // emitter must define this in order to allow this class to access the located owner
+00368                 virtual CPSLocated *getModulatedEmitterOwner(void) = 0;
+00369 
+00370                 void newEmitteeSpeedElement(CPSLocated *emitter, uint32 emitterIndex)
+00371                 {
+00372                         if (_EmitteeSpeedScheme && _EmitteeSpeedScheme->hasMemory()) _EmitteeSpeedScheme->newElement(emitter, emitterIndex);
+00373                 }
+00374 
+00375                 void deleteEmitteeSpeedElement(uint32 index)
+00376                 {
+00377                         if (_EmitteeSpeedScheme && _EmitteeSpeedScheme->hasMemory()) _EmitteeSpeedScheme->deleteElement(index);
+00378                 }
+00379 
+00380                 void resizeEmitteeSpeed(uint32 capacity)
+00381                 {
+00382                         if (_EmitteeSpeedScheme && _EmitteeSpeedScheme->hasMemory()) _EmitteeSpeedScheme->resize(capacity, getModulatedEmitterOwner()->getSize());
+00383                 }
+00384         
+00385 
+00386                 float _EmitteeSpeed;
+00387                 CPSAttribMaker<float> *_EmitteeSpeedScheme;
+00388 }; 
+00389 
+00390 
+00391 
+00394 
+00396 class CPSEmitterDirectionnal : public CPSEmitter, public CPSModulatedEmitter
+00397                                                            ,public CPSDirection
+00398 {
+00399         
+00400 public:
+00401 
+00402 
+00403         CPSEmitterDirectionnal() : _Dir(NLMISC::CVector::K)
+00404         { _Name = std::string("DirectionnalEmitter"); }
+00405 
+00407         virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream);
+00408 
+00409         
+00410         NLMISC_DECLARE_CLASS(CPSEmitterDirectionnal);
+00411         
+00412         virtual void emit(const NLMISC::CVector &srcPos, uint32 index, NLMISC::CVector &pos, NLMISC::CVector &speed);
+00413 
+00414         void setDir(const NLMISC::CVector &v) { _Dir = v; }
+00415 
+00416         NLMISC::CVector getDir(void) const { return _Dir; }
+00417 
+00418 
+00419 protected:
+00420 
+00421         NLMISC::CVector _Dir;
+00422 
+00423         virtual CPSLocated *getModulatedEmitterOwner(void) { return _Owner; }
+00424         virtual void newElement(CPSLocated *emitter, uint32 emitterIndex);
+00425         virtual void deleteElement(uint32 index);
+00426         virtual void resize(uint32 capacity);
+00427 }; 
+00428 
+00431 
+00433 class CPSRadialEmitter : public CPSEmitterDirectionnal
+00434 {
+00435         public:
+00436         CPSRadialEmitter()
+00437         { _Name = std::string("RadialEmitter"); }
+00439         virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream); 
+00440         NLMISC_DECLARE_CLASS(CPSRadialEmitter);
+00441         virtual void emit(const NLMISC::CVector &srcPos, uint32 index, NLMISC::CVector &pos, NLMISC::CVector &speed);
+00442 };
+00443 
+00444 
+00447 
+00449 class CPSEmitterOmni : public CPSEmitter, public CPSModulatedEmitter
+00450 {
+00451         
+00452 public:
+00453 
+00454         CPSEmitterOmni()
+00455         {
+00456                 _Name = std::string("EmitterOmni");
+00457         }
+00458 
+00460         virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream);
+00461         
+00462         NLMISC_DECLARE_CLASS(CPSEmitterOmni);
+00463 
+00464 
+00466         virtual void emit(const NLMISC::CVector &srcPos, uint32 index, NLMISC::CVector &pos, NLMISC::CVector &speed);
+00467 protected:
+00468         virtual CPSLocated *getModulatedEmitterOwner(void) { return _Owner; }
+00469         virtual void newElement(CPSLocated *emitter, uint32 emitterIndex);
+00470         virtual void deleteElement(uint32 index);
+00471         virtual void resize(uint32 capacity);
+00472 
+00473 
+00474 }; 
+00475 
+00478 
+00480 class CPSEmitterRectangle : public CPSEmitter, public CPSModulatedEmitter, public IPSMover
+00481                                                         , public CPSDirection
+00482 {
+00483         public:
+00484 
+00485                 // Ctor
+00486 
+00487                 CPSEmitterRectangle() : _Dir(-NLMISC::CVector::K)
+00488                 {
+00489                         _Name = std::string("EmitterRectangle");
+00490                 }
+00491 
+00493                 virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream);
+00494         
+00495                 NLMISC_DECLARE_CLASS(CPSEmitterRectangle);
+00496 
+00497 
+00499 
+00500                 virtual void emit(const NLMISC::CVector &srcPos, uint32 index, NLMISC::CVector &pos, NLMISC::CVector &speed);
+00501 
+00502                 virtual void setDir(const NLMISC::CVector &v) { _Dir = v; }
+00503 
+00504                 NLMISC::CVector getDir(void) const { return _Dir; }
+00505 
+00506         
+00507                 void showTool(void);
+00508 
+00509         
+00510 
+00511                 // Inherited from IPSMover
+00512                 virtual bool supportUniformScaling(void) const { return true; }
+00513                 virtual bool supportNonUniformScaling(void) const { return true; }                      
+00514                 virtual void setMatrix(uint32 index, const NLMISC::CMatrix &m); 
+00515                 virtual NLMISC::CMatrix getMatrix(uint32 index) const;                  
+00516                 virtual void setScale(uint32 index, float scale);       
+00517                 virtual void setScale(uint32 index, const NLMISC::CVector &s);
+00518                 NLMISC::CVector getScale(uint32 index) const;
+00519 
+00520         protected:
+00521 
+00522                 virtual CPSLocated *getModulatedEmitterOwner(void) { return _Owner; }
+00523                 
+00524                 CPSAttrib<CPlaneBasis> _Basis;                          
+00525 
+00526                 //  Width
+00527                 TPSAttribFloat _Width;
+00528 
+00529                 //  Height
+00530                 TPSAttribFloat _Height;
+00531 
+00532                 // Direction of emission (in each plane basis)
+00533                 NLMISC::CVector _Dir;
+00534 
+00537                 virtual void newElement(CPSLocated *emitterLocated, uint32 emitterIndex);
+00538         
+00543                 virtual void deleteElement(uint32 index);
+00544 
+00548                 virtual void resize(uint32 size);
+00549 }; 
+00550 
+00551 
+00554 
+00556 class CPSEmitterConic : public CPSEmitterDirectionnal                                   
+00557 {       
+00558 public:
+00559 
+00560         CPSEmitterConic() : _Radius(1.f)
+00561         {
+00562                 _Name = std::string("EmitterConic");
+00563         }
+00564 
+00566         virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream);
+00567         
+00568         NLMISC_DECLARE_CLASS(CPSEmitterConic);
+00569 
+00570 
+00572         virtual void emit(const NLMISC::CVector &srcPos, uint32 index, NLMISC::CVector &pos, NLMISC::CVector &speed);
+00573 
+00575         void setRadius(float r) { _Radius = r; }
+00576 
+00578         float getRadius(void) const { return _Radius; }
+00579 
+00581         virtual void setDir(const NLMISC::CVector &v);
+00582 
+00583 protected:      
+00584 
+00585         // The radius for emission
+00586         float _Radius;
+00587  
+00588 };
+00589 
+00592 
+00593 // A spherical emitter
+00594 class CPSSphericalEmitter : public CPSEmitter, public CPSModulatedEmitter, public IPSMover
+00595 {
+00596 public:
+00597         // Ctor
+00598 
+00599         CPSSphericalEmitter()
+00600         {
+00601                 _Name = std::string("spherical emitter");
+00602         }
+00603 
+00605         virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream);
+00606 
+00607         NLMISC_DECLARE_CLASS(CPSSphericalEmitter);
+00608 
+00609 
+00611 
+00612         virtual void emit(const NLMISC::CVector &srcPos, uint32 index, NLMISC::CVector &pos, NLMISC::CVector &speed);
+00613 
+00614         
+00615 
+00616         void showTool(void);
+00617 
+00618 
+00619 
+00620         // Inherited from IPSMover
+00621         virtual bool supportUniformScaling(void) const { return true; }
+00622         virtual bool supportNonUniformScaling(void) const { return false; }                     
+00623         virtual void setMatrix(uint32 index, const NLMISC::CMatrix &m); 
+00624         virtual NLMISC::CMatrix getMatrix(uint32 index) const;                  
+00625         virtual void setScale(uint32 index, float scale) { _Radius[index] = scale; }            
+00626         NLMISC::CVector getScale(uint32 index) const { return NLMISC::CVector(_Radius[index], _Radius[index], _Radius[index]); }
+00627 
+00628 protected:
+00629         virtual CPSLocated *getModulatedEmitterOwner(void) { return _Owner; }   
+00630         TPSAttribFloat _Radius; 
+00631         virtual void newElement(CPSLocated *emitterLocated, uint32 emitterIndex);       
+00632         virtual void deleteElement(uint32 index);
+00633         virtual void resize(uint32 size);
+00634 };
+00635 
+00636 
+00637 } // NL3D
+00638 
+00639 
+00640 #endif // NL_PS_EMITTER_H
+00641 
+00642 /* End of ps_emitter.h */
+
+ + +
                                                                                                                                                                    +
+ + -- cgit v1.2.1