Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

OgreParticleFX.cpp

Go to the documentation of this file.
00001 /*
00002 -----------------------------------------------------------------------------
00003 This source file is part of OGRE
00004     (Object-oriented Graphics Rendering Engine)
00005 For the latest info, see http://www.ogre3d.org/
00006 
00007 Copyright © 2000-2002 The OGRE Team
00008 Also see acknowledgements in Readme.html
00009 
00010 This program is free software; you can redistribute it and/or modify it under
00011 the terms of the GNU Lesser General Public License as published by the Free Software
00012 Foundation; either version 2 of the License, or (at your option) any later
00013 version.
00014 
00015 This program is distributed in the hope that it will be useful, but WITHOUT
00016 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00017 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
00018 
00019 You should have received a copy of the GNU Lesser General Public License along with
00020 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
00021 Place - Suite 330, Boston, MA 02111-1307, USA, or go to
00022 http://www.gnu.org/copyleft/lesser.txt.
00023 -----------------------------------------------------------------------------
00024 */
00025 
00026 #include "OgreRoot.h"
00027 #include "OgreParticleSystemManager.h"
00028 #include "OgreParticleAffectorFactory.h"
00029 #include "OgreParticleEmitterFactory.h"
00030 
00031 #include "OgrePointEmitterFactory.h"
00032 #include "OgreBoxEmitterFactory.h"
00033 #include "OgreEllipsoidEmitterFactory.h"
00034 #include "OgreHollowEllipsoidEmitterFactory.h"
00035 #include "OgreRingEmitterFactory.h"
00036 #include "OgreCylinderEmitterFactory.h"
00037 #include "OgreLinearForceAffectorFactory.h"
00038 #include "OgreColourFaderAffectorFactory.h"
00039 #include "OgreColourFaderAffectorFactory2.h"
00040 #include "OgreColourImageAffectorFactory.h"
00041 #include "OgreColourInterpolatorAffectorFactory.h"
00042 #include "OgreScaleAffectorFactory.h"
00043 #include "OgreRotationAffectorFactory.h"
00044 
00045 namespace Ogre {
00046 
00047     std::vector<ParticleEmitterFactory*> emitterFactories;
00048     std::vector<ParticleAffectorFactory*> affectorFactories;
00049 
00050     //-----------------------------------------------------------------------
00051     void registerParticleFactories(void)
00052     {
00053         // -- Create all new particle emitter factories --
00054         ParticleEmitterFactory* pEmitFact;
00055 
00056         // PointEmitter
00057         pEmitFact = new PointEmitterFactory();
00058         ParticleSystemManager::getSingleton().addEmitterFactory(pEmitFact);
00059         emitterFactories.push_back(pEmitFact);
00060 
00061         // BoxEmitter
00062         pEmitFact = new BoxEmitterFactory();
00063         ParticleSystemManager::getSingleton().addEmitterFactory(pEmitFact);
00064         emitterFactories.push_back(pEmitFact);
00065 
00066         // EllipsoidEmitter
00067         pEmitFact = new EllipsoidEmitterFactory();
00068         ParticleSystemManager::getSingleton().addEmitterFactory(pEmitFact);
00069         emitterFactories.push_back(pEmitFact);
00070         
00071         // CylinderEmitter
00072         pEmitFact = new CylinderEmitterFactory();
00073         ParticleSystemManager::getSingleton().addEmitterFactory(pEmitFact);
00074         emitterFactories.push_back(pEmitFact);
00075     
00076         // RingEmitter
00077         pEmitFact = new RingEmitterFactory();
00078         ParticleSystemManager::getSingleton().addEmitterFactory(pEmitFact);
00079         emitterFactories.push_back(pEmitFact);
00080 
00081         // HollowEllipsoidEmitter
00082         pEmitFact = new HollowEllipsoidEmitterFactory();
00083         ParticleSystemManager::getSingleton().addEmitterFactory(pEmitFact);
00084         emitterFactories.push_back(pEmitFact);
00085 
00086         // -- Create all new particle affector factories --
00087         ParticleAffectorFactory* pAffFact;
00088 
00089         // LinearForceAffector
00090         pAffFact = new LinearForceAffectorFactory();
00091         ParticleSystemManager::getSingleton().addAffectorFactory(pAffFact);
00092         affectorFactories.push_back(pAffFact);
00093 
00094         // ColourFaderAffector
00095         pAffFact = new ColourFaderAffectorFactory();
00096         ParticleSystemManager::getSingleton().addAffectorFactory(pAffFact);
00097         affectorFactories.push_back(pAffFact);
00098 
00099         // ColourFaderAffector2
00100         pAffFact = new ColourFaderAffectorFactory2();
00101         ParticleSystemManager::getSingleton().addAffectorFactory(pAffFact);
00102         affectorFactories.push_back(pAffFact);
00103 
00104         // ColourImageAffector
00105         pAffFact = new ColourImageAffectorFactory();
00106         ParticleSystemManager::getSingleton().addAffectorFactory(pAffFact);
00107         affectorFactories.push_back(pAffFact);
00108 
00109         // ColourInterpolatorAffector
00110         pAffFact = new ColourInterpolatorAffectorFactory();
00111         ParticleSystemManager::getSingleton().addAffectorFactory(pAffFact);
00112         affectorFactories.push_back(pAffFact);
00113 
00114         // ScaleAffector
00115         pAffFact = new ScaleAffectorFactory();
00116         ParticleSystemManager::getSingleton().addAffectorFactory(pAffFact);
00117         affectorFactories.push_back(pAffFact);
00118 
00119         // RotationAffector
00120         pAffFact = new RotationAffectorFactory();
00121         ParticleSystemManager::getSingleton().addAffectorFactory(pAffFact);
00122         affectorFactories.push_back(pAffFact);
00123 
00124     }
00125     //-----------------------------------------------------------------------
00126     void destroyParticleFactories(void)
00127     {
00128         std::vector<ParticleEmitterFactory*>::iterator ei;
00129         std::vector<ParticleAffectorFactory*>::iterator ai;
00130 
00131         for (ei = emitterFactories.begin(); ei != emitterFactories.end(); ++ei)
00132         {
00133             delete (*ei);
00134         }
00135 
00136         for (ai = affectorFactories.begin(); ai != affectorFactories.end(); ++ai)
00137         {
00138             delete (*ai);
00139         }
00140 
00141 
00142     }
00143     //-----------------------------------------------------------------------
00144     extern "C" void dllStartPlugin(void) throw()
00145     {
00146         // Particle SFX
00147         registerParticleFactories();
00148     }
00149 
00150     //-----------------------------------------------------------------------
00151     extern "C" void dllStopPlugin(void)
00152     {
00153         // Particle SFX
00154         destroyParticleFactories();
00155 
00156     }
00157 
00158 
00159 }
00160 

Copyright © 2002-2003 by The OGRE Team
Last modified Sun Nov 28 19:48:37 2004