Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/PlugIns/ParticleFX/src/OgreParticleFXPlugin.cpp @ 3

Last change on this file since 3 was 3, checked in by anonymous, 17 years ago

=update

File size: 6.0 KB
Line 
1/*
2-----------------------------------------------------------------------------
3This source file is part of OGRE
4(Object-oriented Graphics Rendering Engine)
5For the latest info, see http://www.ogre3d.org/
6
7Copyright (c) 2000-2006 Torus Knot Software Ltd
8Also see acknowledgements in Readme.html
9
10This program is free software; you can redistribute it and/or modify it under
11the terms of the GNU Lesser General Public License as published by the Free Software
12Foundation; either version 2 of the License, or (at your option) any later
13version.
14
15This program is distributed in the hope that it will be useful, but WITHOUT
16ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
18
19You should have received a copy of the GNU Lesser General Public License along with
20this program; if not, write to the Free Software Foundation, Inc., 59 Temple
21Place - Suite 330, Boston, MA 02111-1307, USA, or go to
22http://www.gnu.org/copyleft/lesser.txt.
23
24You may alternatively use this source under the terms of a specific version of
25the OGRE Unrestricted License provided you have obtained such a license from
26Torus Knot Software Ltd.
27-----------------------------------------------------------------------------
28*/
29
30#include "OgreParticleFXPlugin.h"
31#include "OgreRoot.h"
32#include "OgreParticleSystemManager.h"
33
34#include "OgrePointEmitterFactory.h"
35#include "OgreBoxEmitterFactory.h"
36#include "OgreEllipsoidEmitterFactory.h"
37#include "OgreHollowEllipsoidEmitterFactory.h"
38#include "OgreRingEmitterFactory.h"
39#include "OgreCylinderEmitterFactory.h"
40#include "OgreLinearForceAffectorFactory.h"
41#include "OgreColourFaderAffectorFactory.h"
42#include "OgreColourFaderAffectorFactory2.h"
43#include "OgreColourImageAffectorFactory.h"
44#include "OgreColourInterpolatorAffectorFactory.h"
45#include "OgreScaleAffectorFactory.h"
46#include "OgreRotationAffectorFactory.h"
47#include "OgreDirectionRandomiserAffectorFactory.h"
48#include "OgreDeflectorPlaneAffectorFactory.h"
49
50namespace Ogre
51{
52        const String sPluginName = "ParticleFX";
53        //---------------------------------------------------------------------
54        ParticleFXPlugin::ParticleFXPlugin()
55        {
56
57        }
58        //---------------------------------------------------------------------
59        const String& ParticleFXPlugin::getName() const
60        {
61                return sPluginName;
62        }
63        //---------------------------------------------------------------------
64        void ParticleFXPlugin::install()
65        {
66                // -- Create all new particle emitter factories --
67                ParticleEmitterFactory* pEmitFact;
68
69                // PointEmitter
70                pEmitFact = new PointEmitterFactory();
71                ParticleSystemManager::getSingleton().addEmitterFactory(pEmitFact);
72                mEmitterFactories.push_back(pEmitFact);
73
74                // BoxEmitter
75                pEmitFact = new BoxEmitterFactory();
76                ParticleSystemManager::getSingleton().addEmitterFactory(pEmitFact);
77                mEmitterFactories.push_back(pEmitFact);
78
79                // EllipsoidEmitter
80                pEmitFact = new EllipsoidEmitterFactory();
81                ParticleSystemManager::getSingleton().addEmitterFactory(pEmitFact);
82                mEmitterFactories.push_back(pEmitFact);
83
84                // CylinderEmitter
85                pEmitFact = new CylinderEmitterFactory();
86                ParticleSystemManager::getSingleton().addEmitterFactory(pEmitFact);
87                mEmitterFactories.push_back(pEmitFact);
88
89                // RingEmitter
90                pEmitFact = new RingEmitterFactory();
91                ParticleSystemManager::getSingleton().addEmitterFactory(pEmitFact);
92                mEmitterFactories.push_back(pEmitFact);
93
94                // HollowEllipsoidEmitter
95                pEmitFact = new HollowEllipsoidEmitterFactory();
96                ParticleSystemManager::getSingleton().addEmitterFactory(pEmitFact);
97                mEmitterFactories.push_back(pEmitFact);
98
99                // -- Create all new particle affector factories --
100                ParticleAffectorFactory* pAffFact;
101
102                // LinearForceAffector
103                pAffFact = new LinearForceAffectorFactory();
104                ParticleSystemManager::getSingleton().addAffectorFactory(pAffFact);
105                mAffectorFactories.push_back(pAffFact);
106
107                // ColourFaderAffector
108                pAffFact = new ColourFaderAffectorFactory();
109                ParticleSystemManager::getSingleton().addAffectorFactory(pAffFact);
110                mAffectorFactories.push_back(pAffFact);
111
112                // ColourFaderAffector2
113                pAffFact = new ColourFaderAffectorFactory2();
114                ParticleSystemManager::getSingleton().addAffectorFactory(pAffFact);
115                mAffectorFactories.push_back(pAffFact);
116
117                // ColourImageAffector
118                pAffFact = new ColourImageAffectorFactory();
119                ParticleSystemManager::getSingleton().addAffectorFactory(pAffFact);
120                mAffectorFactories.push_back(pAffFact);
121
122                // ColourInterpolatorAffector
123                pAffFact = new ColourInterpolatorAffectorFactory();
124                ParticleSystemManager::getSingleton().addAffectorFactory(pAffFact);
125                mAffectorFactories.push_back(pAffFact);
126
127                // ScaleAffector
128                pAffFact = new ScaleAffectorFactory();
129                ParticleSystemManager::getSingleton().addAffectorFactory(pAffFact);
130                mAffectorFactories.push_back(pAffFact);
131
132                // RotationAffector
133                pAffFact = new RotationAffectorFactory();
134                ParticleSystemManager::getSingleton().addAffectorFactory(pAffFact);
135                mAffectorFactories.push_back(pAffFact);
136
137
138                // DirectionRandomiserAffector
139                pAffFact = new DirectionRandomiserAffectorFactory();
140                ParticleSystemManager::getSingleton().addAffectorFactory(pAffFact);
141                mAffectorFactories.push_back(pAffFact);
142
143                // DeflectorPlaneAffector
144                pAffFact = new DeflectorPlaneAffectorFactory();
145                ParticleSystemManager::getSingleton().addAffectorFactory(pAffFact);
146                mAffectorFactories.push_back(pAffFact);
147        }
148        //---------------------------------------------------------------------
149        void ParticleFXPlugin::initialise()
150        {
151                // nothing to do
152        }
153        //---------------------------------------------------------------------
154        void ParticleFXPlugin::shutdown()
155        {
156                // nothing to do
157        }
158        //---------------------------------------------------------------------
159        void ParticleFXPlugin::uninstall()
160        {
161                // destroy
162                std::vector<ParticleEmitterFactory*>::iterator ei;
163                std::vector<ParticleAffectorFactory*>::iterator ai;
164
165                for (ei = mEmitterFactories.begin(); ei != mEmitterFactories.end(); ++ei)
166                {
167                        delete (*ei);
168                }
169
170                for (ai = mAffectorFactories.begin(); ai != mAffectorFactories.end(); ++ai)
171                {
172                        delete (*ai);
173                }
174
175
176        }
177
178
179}
Note: See TracBrowser for help on using the repository browser.