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