ScummVM API documentation
ParticleSystem3D.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 /*
23  * Copyright (C) 2006-2010 - Frictional Games
24  *
25  * This file is part of HPL1 Engine.
26  */
27 
28 #ifndef HPL_PARTICLE_SYSTEM_3D_H
29 #define HPL_PARTICLE_SYSTEM_3D_H
30 
31 #include "hpl1/engine/graphics/RenderList.h"
32 #include "hpl1/engine/resources/ResourceBase.h"
33 #include "hpl1/engine/scene/Entity3D.h"
34 
35 namespace hpl {
36 
37 class iParticleEmitter3D;
38 class iParticleEmitterData;
39 class cParticleManager;
40 
41 //----------------------------------------------------
42 
43 class cParticleSystem3D;
44 
46 public:
47  cParticleSystemData3D(const tString &asName, cResources *apResources, cGraphics *apGraphics);
48  virtual ~cParticleSystemData3D();
49 
50  cParticleSystem3D *Create(tString asName, cVector3f avSize, const cMatrixf &a_mtxTransform);
51 
52  bool LoadFromFile(const tString &asFile);
53 
54  void AddEmitterData(iParticleEmitterData *apData);
55 
56  bool reload() { return false; }
57  void unload() {}
58  void destroy() {}
59 
60  iParticleEmitterData *GetEmitterData(int alIdx) const { return mvEmitterData[alIdx]; }
61 
62 private:
63  cResources *mpResources;
64  cGraphics *mpGraphics;
65 
67 };
68 
69 //----------------------------------------------------
70 
72  kSerializableClassInit(cSaveData_ParticleEmitter3D) public : bool mbActive;
73  bool mbDying;
74 };
75 
76 kSaveData_ChildClass(iEntity3D, cParticleSystem3D) {
77  kSaveData_ClassInit(cParticleSystem3D) public :
78 
79  tString msDataName;
80  cVector3f mvDataSize;
81 
83 
84  iSaveObject *CreateSaveObject(cSaveObjectHandler * apSaveObjectHandler, cGame * apGame);
85  int GetSaveCreatePrio();
86 };
87 
88 //----------------------------------------------------
89 
90 class cParticleSystem3D : public iEntity3D {
91  typedef iEntity3D super;
92 
93 public:
94  cParticleSystem3D(const tString asName, cParticleSystemData3D *apData,
95  cResources *apResources, cGraphics *apGraphics);
97 
98  void SetVisible(bool abVisible);
99 
100  void UpdateLogic(float afTimeStep);
101 
102  bool IsDead();
103  bool IsDying();
104 
105  void Kill();
106  void KillInstantly();
107 
108  void AddEmitter(iParticleEmitter3D *apEmitter);
109  iParticleEmitter3D *GetEmitter(int alIdx);
110  int GetEmitterNum();
111 
112  tString GetEntityType() { return "ParticleSystem3D"; }
113 
114  void SetDataName(const tString &asName) { msDataName = asName; }
115  void SetDataSize(const cVector3f &avSize) { mvDataSize = avSize; }
116 
117  const tString &GetDataName() { return msDataName; }
118  const cVector3f &GetDataSize() { return mvDataSize; }
119 
120  void SetParticleManager(cParticleManager *apParticleManager) {
121  mpParticleManager = apParticleManager;
122  }
123 
124  cParticleSystemData3D *GetData() { return mpData; }
125 
126  // SaveObject implementation
127  iSaveData *CreateSaveData();
128  void SaveToSaveData(iSaveData *apSaveData);
129  void LoadFromSaveData(iSaveData *apSaveData);
130  void SaveDataSetup(cSaveObjectHandler *apSaveObjectHandler, cGame *apGame);
131 
132 private:
133  cResources *mpResources;
134  cGraphics *mpGraphics;
135  cParticleManager *mpParticleManager;
136  cParticleSystemData3D *mpData;
137 
139 
140  tString msDataName;
141  cVector3f mvDataSize;
142 
143  bool mbFirstUpdate;
144 };
145 
146 } // namespace hpl
147 
148 #endif // HPL_PARTICLE_SYSTEM_3D_H
Definition: AI.h:36
Definition: Game.h:91
Definition: ParticleEmitter3D.h:94
Definition: str.h:59
Definition: ParticleEmitter.h:203
Definition: ResourceBase.h:36
Definition: array.h:52
Definition: ParticleSystem3D.h:71
void unload()
Definition: ParticleSystem3D.h:57
Definition: SerializeClass.h:230
Definition: SaveGame.h:130
Definition: ParticleManager.h:50
bool reload()
Definition: ParticleSystem3D.h:56
void destroy()
Definition: ParticleSystem3D.h:58
Definition: Container.h:121
Definition: SaveGame.h:111
Definition: ParticleSystem3D.h:90
Definition: Resources.h:160
Definition: Entity3D.h:81
Definition: SaveGame.h:183
Definition: Graphics.h:46
Definition: ParticleSystem3D.h:45