AaronCameron.net
Because you all make me very, very tired.
Not a Member? - Login or Create an Account
Wednesday the 23rd of May 2012 @ 04:42pm
Front Page Journal Projects Your Profile About
[]

LibN2L-4 Library Code Reference

Classes
Compounds
Files
Members
Method Index
Full Reference

cPEmitter.h

Go to the documentation of this file.
00001 /************************************************************************
00002 Nova-2 Library (libN2L, or simply n2l) Game development C++ Library
00003 Copyright (C) 2003  Aaron Cameron
00004 
00005 This library is free software; you can redistribute it and/or
00006 modify it under the terms of the GNU Lesser General Public
00007 License as published by the Free Software Foundation; either
00008 version 2.1 of the License, or (at your option) any later version.
00009 
00010 This library is distributed in the hope that it will be useful,
00011 but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013 Lesser General Public License for more details.
00014 
00015 You should have received a copy of the GNU Lesser General Public
00016 License along with this library; if not, write to the Free Software
00017 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00018 
00019 A copy of the GNU Lesser General Public License has been provided with
00020 this library in the file 'COPYING'.
00021 
00022 Contact information for the author of this library has been provided
00023 with this library in the file 'AUTHOR'.
00024 ************************************************************************/
00025 #ifndef _n2l4_cPEmitter_H
00026 #define _n2l4_cPEmitter_H
00027 
00028 #include "n2l/n2l.h"
00029 #include "n2l/geometry.h"
00030 
00031 /******************************************************************************/
00032 namespace n2l
00033 {
00034 
00035     class cDynVar;
00036     class cVfsNodeInterface;
00037     class cParticleSystem;
00038     class cPParticleSpec;
00039 
00044     class cPEmitter
00045     {
00046     public:
00047         cPEmitter();
00048         cPEmitter( const cVfsNodeInterface &iNode );
00049         cPEmitter( const cDynVar &iDef );
00050         ~cPEmitter();
00051 
00052         void load( const cVfsNodeInterface &iNode );
00053         void load( const cDynVar &iDef );
00054 
00058         void updateInto( const tUint &iTimePassed,
00059             cParticleSystem &ioSystem, const tFloat &iThrottle = 1.0f );
00060 
00061         void updateInto( const tUint &iTimePassed,
00062             cParticleSystem &ioSystem, const tMatrix44f &iTransMatrix,
00063             const tFloat &iThrottle = 1.0f );
00064 
00065         void frequency( const tFloat &iMax,
00066             const tFloat &iMin = 0.0f );
00067 
00068         const tFloat &frequencyMin() const { return mMinFreq; }
00069         const tFloat &frequencyMax() const { return mMaxFreq; }
00070 
00071         void vel( const tVector3f &iVel ) { mVel = iVel; }
00072 
00078         void positionJitter( const tVector3f &iJitter );
00079         void disableJitter();
00080 
00083         void position( const tVector3f &iPos );
00084 
00085         inline void addPosition( const tVector3f &iPos ) {
00086             mPositions.push_back( iPos );
00087         }
00088 
00098         void addFacePositions( const tTriangle3f &iTri,
00099             const tFloat &iMaxSurfaceArea,
00100             const tFloat &iMinSurfaceArea = 0.0f );
00101 
00102         const tUint numPositions() const { return mPositions.size(); }
00103 
00104         void particleSpec( const cAutoPtr<const cPParticleSpec> &iSpec );
00105         const cAutoPtr<const cPParticleSpec> &particleSpec() const {
00106             return mPSpec;
00107         }
00108 
00109     private:
00110         typedef std::vector<tVector3f> tPosList;
00111 
00116         tFloat mMinFreq, mMaxFreq;
00117         tSint mRemainder;
00118 
00122         tVector3f mVel;
00123 
00129         tPosList mPositions;
00130 
00131         tBool mPositionJitter;
00132         tVector3f mHalfMaxJitter;
00133 
00136         cAutoPtr<const cPParticleSpec> mPSpec;
00137 
00138         tUint mLastEmissionFrom;
00139 
00140         void init();
00141 
00142     }; // class
00143 
00144 
00145 } // namespace
00146 
00147 #endif
©2012 Aaron Cameron