source: OGRE/trunk/ogrenew/PlugIns/ParticleFX/src/OgreParticleFX.cpp @ 692

Revision 692, 6.4 KB checked in by mattausch, 18 years ago (diff)

adding ogre 1.2 and dependencies

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-2005 The OGRE Team
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-----------------------------------------------------------------------------
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#include "OgreDirectionRandomiserAffectorFactory.h"
45#include "OgreDeflectorPlaneAffectorFactory.h"
46
47namespace Ogre {
48
49    std::vector<ParticleEmitterFactory*> emitterFactories;
50    std::vector<ParticleAffectorFactory*> affectorFactories;
51
52    //-----------------------------------------------------------------------
53    void registerParticleFactories(void)
54    {
55        // -- Create all new particle emitter factories --
56        ParticleEmitterFactory* pEmitFact;
57
58        // PointEmitter
59        pEmitFact = new PointEmitterFactory();
60        ParticleSystemManager::getSingleton().addEmitterFactory(pEmitFact);
61        emitterFactories.push_back(pEmitFact);
62
63        // BoxEmitter
64        pEmitFact = new BoxEmitterFactory();
65        ParticleSystemManager::getSingleton().addEmitterFactory(pEmitFact);
66        emitterFactories.push_back(pEmitFact);
67
68        // EllipsoidEmitter
69        pEmitFact = new EllipsoidEmitterFactory();
70        ParticleSystemManager::getSingleton().addEmitterFactory(pEmitFact);
71        emitterFactories.push_back(pEmitFact);
72       
73            // CylinderEmitter
74        pEmitFact = new CylinderEmitterFactory();
75        ParticleSystemManager::getSingleton().addEmitterFactory(pEmitFact);
76        emitterFactories.push_back(pEmitFact);
77       
78        // RingEmitter
79        pEmitFact = new RingEmitterFactory();
80        ParticleSystemManager::getSingleton().addEmitterFactory(pEmitFact);
81        emitterFactories.push_back(pEmitFact);
82
83        // HollowEllipsoidEmitter
84        pEmitFact = new HollowEllipsoidEmitterFactory();
85        ParticleSystemManager::getSingleton().addEmitterFactory(pEmitFact);
86        emitterFactories.push_back(pEmitFact);
87
88        // -- Create all new particle affector factories --
89        ParticleAffectorFactory* pAffFact;
90
91        // LinearForceAffector
92        pAffFact = new LinearForceAffectorFactory();
93        ParticleSystemManager::getSingleton().addAffectorFactory(pAffFact);
94        affectorFactories.push_back(pAffFact);
95
96        // ColourFaderAffector
97        pAffFact = new ColourFaderAffectorFactory();
98        ParticleSystemManager::getSingleton().addAffectorFactory(pAffFact);
99        affectorFactories.push_back(pAffFact);
100
101        // ColourFaderAffector2
102        pAffFact = new ColourFaderAffectorFactory2();
103        ParticleSystemManager::getSingleton().addAffectorFactory(pAffFact);
104        affectorFactories.push_back(pAffFact);
105
106        // ColourImageAffector
107        pAffFact = new ColourImageAffectorFactory();
108        ParticleSystemManager::getSingleton().addAffectorFactory(pAffFact);
109        affectorFactories.push_back(pAffFact);
110
111        // ColourInterpolatorAffector
112        pAffFact = new ColourInterpolatorAffectorFactory();
113        ParticleSystemManager::getSingleton().addAffectorFactory(pAffFact);
114        affectorFactories.push_back(pAffFact);
115
116        // ScaleAffector
117        pAffFact = new ScaleAffectorFactory();
118        ParticleSystemManager::getSingleton().addAffectorFactory(pAffFact);
119        affectorFactories.push_back(pAffFact);
120
121        // RotationAffector
122        pAffFact = new RotationAffectorFactory();
123        ParticleSystemManager::getSingleton().addAffectorFactory(pAffFact);
124        affectorFactories.push_back(pAffFact);
125
126
127                // DirectionRandomiserAffector
128                pAffFact = new DirectionRandomiserAffectorFactory();
129                ParticleSystemManager::getSingleton().addAffectorFactory(pAffFact);
130                affectorFactories.push_back(pAffFact);
131
132                // DeflectorPlaneAffector
133                pAffFact = new DeflectorPlaneAffectorFactory();
134                ParticleSystemManager::getSingleton().addAffectorFactory(pAffFact);
135                affectorFactories.push_back(pAffFact);
136
137        }
138    //-----------------------------------------------------------------------
139    void destroyParticleFactories(void)
140    {
141        std::vector<ParticleEmitterFactory*>::iterator ei;
142        std::vector<ParticleAffectorFactory*>::iterator ai;
143
144        for (ei = emitterFactories.begin(); ei != emitterFactories.end(); ++ei)
145        {
146            delete (*ei);
147        }
148
149        for (ai = affectorFactories.begin(); ai != affectorFactories.end(); ++ai)
150        {
151            delete (*ai);
152        }
153
154
155    }
156    //-----------------------------------------------------------------------
157    extern "C" void _OgreParticleFXExport dllStartPlugin(void) throw()
158    {
159        // Particle SFX
160        registerParticleFactories();
161    }
162
163    //-----------------------------------------------------------------------
164    extern "C" void _OgreParticleFXExport dllStopPlugin(void)
165    {
166        // Particle SFX
167        destroyParticleFactories();
168
169    }
170
171
172}
173
Note: See TracBrowser for help on using the repository browser.