1 | /* |
---|
2 | orxonox - the future of 3D-vertical-scrollers |
---|
3 | |
---|
4 | Copyright (C) 2004 orx |
---|
5 | |
---|
6 | This program is free software; you can redistribute it and/or modify |
---|
7 | it under the terms of the GNU General Public License as published by |
---|
8 | the Free Software Foundation; either version 2, or (at your option) |
---|
9 | any later version. |
---|
10 | |
---|
11 | ### File Specific: |
---|
12 | main-programmer: ... |
---|
13 | co-programmer: ... |
---|
14 | */ |
---|
15 | |
---|
16 | //#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY |
---|
17 | |
---|
18 | #include "particle_engine.h" |
---|
19 | |
---|
20 | #include "particle_system.h" |
---|
21 | #include "particle_emitter.h" |
---|
22 | |
---|
23 | #include "list.h" |
---|
24 | |
---|
25 | using namespace std; |
---|
26 | |
---|
27 | /** |
---|
28 | \brief standard constructor |
---|
29 | */ |
---|
30 | ParticleEngine::ParticleEngine () |
---|
31 | { |
---|
32 | this->setClassName ("ParticleEngine"); |
---|
33 | |
---|
34 | this->systemList = new tList<ParticleSystem>; |
---|
35 | } |
---|
36 | |
---|
37 | /** |
---|
38 | \brief the singleton reference to this class |
---|
39 | */ |
---|
40 | ParticleEngine* ParticleEngine::singletonRef = NULL; |
---|
41 | |
---|
42 | /** |
---|
43 | \returns a Pointer to this Class |
---|
44 | */ |
---|
45 | ParticleEngine* ParticleEngine::getInstance(void) |
---|
46 | { |
---|
47 | if (!ParticleEngine::singletonRef) |
---|
48 | ParticleEngine::singletonRef = new ParticleEngine(); |
---|
49 | return ParticleEngine::singletonRef; |
---|
50 | } |
---|
51 | |
---|
52 | /** |
---|
53 | \brief standard destructor |
---|
54 | |
---|
55 | */ |
---|
56 | ParticleEngine::~ParticleEngine () |
---|
57 | { |
---|
58 | delete this->systemList; |
---|
59 | |
---|
60 | |
---|
61 | ParticleEngine::singletonRef = NULL; |
---|
62 | } |
---|
63 | |
---|
64 | /** |
---|
65 | \brief this function ticks all the ParticleSystems, so an animation will flow |
---|
66 | \param dt passed since last tick |
---|
67 | */ |
---|
68 | void ParticleEngine::tick(float dt) |
---|
69 | { |
---|
70 | tIterator<ParticleSystem>* tmpIt = systemList->getIterator(); |
---|
71 | ParticleSystem* tmpSys = tmpIt->nextElement(); |
---|
72 | while(tmpSys) |
---|
73 | { |
---|
74 | tmpSys->tick(dt); |
---|
75 | tmpSys = tmpIt->nextElement(); |
---|
76 | } |
---|
77 | delete tmpIt; |
---|
78 | |
---|
79 | } |
---|