ScummVM API documentation
ParticleEmitter.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_EMITTER_H
29
#define HPL_PARTICLE_EMITTER_H
30
31
#include "common/array.h"
32
#include "common/list.h"
33
#include "hpl1/engine/graphics/GraphicsTypes.h"
34
#include "hpl1/engine/graphics/Material.h"
35
#include "hpl1/engine/math/MathTypes.h"
36
#include "hpl1/engine/system/SystemTypes.h"
37
#include "common/stablemap.h"
38
39
namespace
hpl
{
40
41
enum
eParticleEmitterType {
42
eParticleEmitterType_2D,
43
eParticleEmitterType_3D,
44
eParticleEmitterType_LastEnum,
45
};
46
47
// NEW
48
49
enum
ePENoiseType {
50
ePENoiseType_LowFreq,
51
ePENoiseType_HighFreq,
52
ePENoiseType_Both,
53
ePENoiseType_None,
54
ePENoiseType_LastEnum,
55
};
56
57
typedef
struct
58
{
59
float
fRelToBeamPos;
60
float
fRelToBendPos;
61
int
lLowFreqNoiseIdx;
62
int
lHighFreqNoiseIdx;
63
ePENoiseType noiseType;
64
}
tBeamNoisePoint
;
65
66
// ---
67
71
72
class
cParticle
{
73
public
:
74
cParticle
() {}
75
76
cVector3f
mvPos;
77
cVector3f
mvLastPos;
78
cVector3f
mvLastCollidePos;
79
cVector3f
mvAcc;
80
cVector3f
mvVel;
81
82
float
mfSpeedMul;
83
float
mfMaxSpeed;
84
85
cColor
mStartColor;
86
cColor
mColor;
87
88
cVector2f
mvStartSize;
89
cVector2f
mvSize;
90
91
float
mfStartLife;
92
float
mfLife;
93
float
mfLifeSize_MiddleStart;
94
float
mfLifeSize_MiddleEnd;
95
96
float
mfLifeColor_MiddleStart;
97
float
mfLifeColor_MiddleEnd;
98
99
int
mlSubDivNum;
100
101
float
mfBounceAmount;
102
int
mlBounceCount;
103
104
cVector3f
mvExtra;
105
106
// NEW
107
108
float
mfSpin;
109
float
mfSpinVel;
110
float
mfSpinFactor;
111
112
cVector3f
mvRevolutionVel;
113
114
// Beam Specific
115
116
int
mlLowFreqPoints;
117
int
mlHighFreqPoints;
118
Common::Array<cVector3f>
mvBeamPoints;
119
120
// ---
121
};
122
123
typedef
Common::Array<cParticle *>
tParticleVec
;
124
typedef
tParticleVec::iterator
tParticleVecIt;
125
129
130
class
cGraphics
;
131
class
cResources
;
132
133
class
iParticleEmitter
{
134
public
:
135
iParticleEmitter
(
tMaterialVec
*avMaterials,
unsigned
int
alMaxParticles,
136
cVector3f
avSize,
cGraphics
*apGraphics,
cResources
*apResources);
137
virtual
~
iParticleEmitter
();
138
139
void
Update(
float
afTimeStep);
140
141
virtual
void
Render() = 0;
142
143
virtual
eParticleEmitterType GetType() = 0;
144
145
tString
GetEntityType() {
return
"ParticleEmitter"
; }
146
147
virtual
bool
IsDead() {
return
mlNumOfParticles == 0 && mbDying; }
148
virtual
void
Kill() { mbDying =
true
; }
149
150
void
KillInstantly();
151
152
virtual
bool
IsDying() {
return
mbDying; }
153
154
void
SetDataName(
const
tString
&asName) { msDataName = asName; }
155
void
SetDataSize(
const
cVector3f
&avSize) { mvDataSize = avSize; }
156
157
int
GetParticleNum() {
return
mlNumOfParticles; }
158
159
protected
:
160
cGraphics
*mpGraphics;
161
cResources
*mpResources;
162
163
tString
msDataName;
164
cVector3f
mvDataSize;
165
166
tParticleVec mvParticles;
167
unsigned
int
mlNumOfParticles;
168
unsigned
int
mlMaxParticles;
169
170
cMatrixf
m_mtxTemp;
171
172
tMaterialVec
*mvMaterials;
173
174
// Vars for easier updating.
175
float
mfTime;
176
bool
mbDying;
177
float
mfFrame;
178
179
bool
mbUpdateGfx;
180
bool
mbUpdateBV;
181
182
virtual
void
UpdateMotion(
float
afTimeStep) = 0;
183
184
virtual
void
SetParticleDefaults(
cParticle
*apParticle) = 0;
185
190
void
SwapRemove(
unsigned
int
alIndex);
191
cParticle
*CreateParticle();
192
};
193
194
typedef
Common::List<iParticleEmitter *>
tParticleEmitterList
;
195
typedef
tParticleEmitterList::iterator
tParticleEmitterListIt
;
196
200
201
class
cResources
;
202
203
class
iParticleEmitterData
{
204
friend
class
cParticleSystemData3D
;
205
206
public
:
213
iParticleEmitterData
(
const
tString
&asName,
cResources
*apResources,
cGraphics
*apGraphics);
214
virtual
~
iParticleEmitterData
();
215
216
void
AddMaterial(
iMaterial
*apMaterial);
217
218
const
tString
&GetName() {
return
msName; }
219
220
virtual
iParticleEmitter
*Create(
tString
asName,
cVector3f
avSize) = 0;
221
222
float
GetWarmUpTime()
const
{
return
mfWarmUpTime; }
223
float
GetWarmUpStepsPerSec()
const
{
return
mfWarmUpStepsPerSec; }
224
225
protected
:
226
cResources
*mpResources;
227
cGraphics
*mpGraphics;
228
229
tString
msName;
230
tMaterialVec
mvMaterials;
231
232
float
mfWarmUpTime;
233
float
mfWarmUpStepsPerSec;
234
};
235
236
typedef
Common::StableMap<tString, iParticleEmitterData *>
tParticleEmitterDataMap
;
237
typedef
tParticleEmitterDataMap::iterator
tParticleEmitterDataMapIt;
238
239
}
// namespace hpl
240
241
#endif // HPL_PARTICLE_EMITTER_H
hpl
Definition:
AI.h:36
Common::String
Definition:
str.h:59
hpl::iParticleEmitterData
Definition:
ParticleEmitter.h:203
Common::Array< cVector3f >
hpl::cVector2< float >
Common::List
Definition:
list.h:44
Common::Array::iterator
T * iterator
Definition:
array.h:54
Common::StableMap::iterator
typename TreeT::BasicIterator iterator
Definition:
stablemap.h:48
Common::StableMap
Definition:
stablemap.h:43
hpl::cVector3< float >
hpl::tBeamNoisePoint
Definition:
ParticleEmitter.h:57
hpl::iParticleEmitter
Definition:
ParticleEmitter.h:133
hpl::cParticle
Definition:
ParticleEmitter.h:72
hpl::cResources
Definition:
Resources.h:160
hpl::cColor
Definition:
Color.h:37
hpl::cMatrix< float >
Common::ListInternal::Iterator
Definition:
list_intern.h:51
hpl::iMaterial
Definition:
Material.h:203
hpl::cGraphics
Definition:
Graphics.h:46
hpl::cParticleSystemData3D
Definition:
ParticleSystem3D.h:45
engines
hpl1
engine
graphics
ParticleEmitter.h
Generated on Sat Aug 31 2024 09:11:49 for ScummVM API documentation by
1.8.13