ScummVM API documentation
ParticleEmitter3D_UserData.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_3D_USER_DATA_H
29 #define HPL_PARTICLE_EMITTER_3D_USER_DATA_H
30 
31 #include "hpl1/engine/graphics/ParticleEmitter3D.h"
32 #include "hpl1/engine/graphics/Renderable.h"
33 #include "hpl1/engine/physics/PhysicsWorld.h"
34 #include "hpl1/engine/scene/Entity3D.h"
35 
36 class TiXmlElement;
37 
38 namespace hpl {
39 
40 enum ePEStartPosType {
41  ePEStartPosType_Box,
42  ePEStartPosType_Sphere,
43  ePEStartPosType_LastEnum,
44 };
45 
46 enum ePEDeathType {
47  ePEDeathType_Age,
48  ePEDeathType_Color,
49  ePEDeathType_LastEnum,
50 };
51 
52 enum ePEGravityType {
53  ePEGravityType_None, // No gravity added
54  ePEGravityType_Vector, // Vector is used.
55  ePEGravityType_Center, // Y axis used. heading equals center.
56  ePEGravityType_LastEnum,
57 };
58 
59 enum ePESubDivType {
60  ePESubDivType_Random,
61  ePESubDivType_Animation,
62  ePESubDivType_LastEnum,
63 };
64 
65 enum ePEPartSpinType {
66  ePEPartSpinType_Constant,
67  ePEPartSpinType_Movement,
68  ePEPartSpinType_LastEnum,
69 };
70 
71 //------------------------------------
72 
73 //------------------------------------
74 
76  friend class cParticleEmitter3D_UserData;
77 
78 public:
79  cParticleEmitterData3D_UserData(const tString &asName, cResources *apResources, cGraphics *apGraphics);
80 
81  iParticleEmitter *Create(tString asName, cVector3f avSize);
82 
83  void LoadFromElement(TiXmlElement *apElement);
84 
85  bool CheckCollision(const cVector3f &avStart, const cVector3f &avEnd,
86  iPhysicsWorld *apPhysicsWorld,
87  cVector3f *apNormalVec,
88  cVector3f *apPosVec);
89 
90 private:
91  bool OnIntersect(iPhysicsBody *pBody, cPhysicsRayParams *apParams);
92  float mfShortestDist;
93  bool mbIntersected;
94  cVector3f *mpIntersectNormal;
95  cVector3f *mpIntersectPos;
96 
98 
99  // NEW
100  ePEType mPEType;
101  // ---
102 
103  int mlMaxParticleNum;
104 
105  bool mbRespawn;
106 
107  float mfParticlesPerSecond;
108  float mfStartTimeOffset;
109 
110  float mfMinPauseLength;
111  float mfMaxPauseLength;
112 
113  float mfMinPauseInterval;
114  float mfMaxPauseInterval;
115 
116  cVector3f mvPosOffset;
117  cVector3f mvAngleOffset;
118 
119  float mfFrameStep;
120  float mfMaxFrameTime;
121 
123 
124  cVector2l mvSubDiv;
125  ePESubDivType mSubDivType;
126 
128  ePEStartPosType mStartPosType;
129 
130  cVector3f mvMinStartPos;
131  cVector3f mvMaxStartPos;
132 
133  cVector2f mvMinStartAngles;
134  cVector2f mvMaxStartAngles;
135 
136  float mfMinStartRadius;
137  float mfMaxStartRadius;
138 
140  ePEStartPosType mStartVelType;
141 
142  cVector3f mvMinStartVel;
143  cVector3f mvMaxStartVel;
144 
145  cVector2f mvMinStartVelAngles;
146  cVector2f mvMaxStartVelAngles;
147 
148  float mfMinStartVelSpeed;
149  float mfMaxStartVelSpeed;
150 
151  float mfMinSpeedMultiply;
152  float mfMaxSpeedMultiply;
153 
154  cVector3f mvMinStartAcc;
155  cVector3f mvMaxStartAcc;
156 
157  float mfMinVelMaximum;
158  float mfMaxVelMaximum;
159 
160  bool mbUsesDirection;
161  ePEGravityType mGravityType;
162 
163  cVector3f mvGravityAcc;
164 
165  eParticleEmitter3DCoordSystem mCoordSystem;
166 
167  // NEW
168 
169  bool mbUsePartSpin;
170  ePEPartSpinType mPartSpinType;
171  float mfMinSpinRange;
172  float mfMaxSpinRange;
173 
174  bool mbUseRevolution;
175  cVector3f mvMinRevVel;
176  cVector3f mvMaxRevVel;
177 
178  // iVertexBuffer *mVBMeshData;
179  // float *mpfMeshVtxData;
180 
181  // ---
182 
184  float mfMinLifeSpan;
185  float mfMaxLifeSpan;
186 
187  ePEDeathType mDeathType;
188 
189  tString msDeathPS;
190 
192  eParticleEmitter3DType mDrawType;
193 
194  cVector2f mvMinStartSize;
195  cVector2f mvMaxStartSize;
196 
197  float mfStartRelSize;
198  float mfMiddleRelSize;
199  float mfMiddleRelSizeTime;
200  float mfMiddleRelSizeLength;
201  float mfEndRelSize;
202 
203  bool mbMultiplyRGBWithAlpha;
204 
206 
207  cColor mMinStartColor;
208  cColor mMaxStartColor;
209 
210  cColor mStartRelColor;
211  cColor mMiddleRelColor;
212  float mfMiddleRelColorTime;
213  float mfMiddleRelColorLength;
214  cColor mEndRelColor;
215 
217  bool mbCollides;
218 
219  float mfMinBounceAmount;
220  float mfMaxBounceAmount;
221 
222  int mlMinCollisionMax;
223  int mlMaxCollisionMax;
224 
225  int mlCollisionUpdateRate;
226 
227  // NEW
229 
230  bool mbUseBeamNoise;
231 
232  int mlLowFreqPoints;
233  Common::Array<unsigned int> mvLFIndices;
234  cVector3f mvMinLowFreqNoise;
235  cVector3f mvMaxLowFreqNoise;
236 
237  int mlHighFreqPoints;
238  cVector3f mvMinHighFreqNoise;
239  cVector3f mvMaxHighFreqNoise;
240 
241  Common::Array<tBeamNoisePoint> mvBeamNoisePoints;
242 
243  // ---
244 };
245 
246 //----------------------------------------------------------
247 
249 public:
250  cParticleEmitter3D_UserData(tString asName, tMaterialVec *avMaterials,
251  cVector3f avSize, cGraphics *apGraphics, cResources *apResources,
254 
255  void Kill();
256 
257  bool IsDying();
258 
259 private:
260  void UpdateMotion(float afTimeStep);
261  void SetParticleDefaults(cParticle *apParticle);
262 
264 
265  float mfTime;
266  float mfCreateCount;
267 
268  float mfCollideCount;
269 
270  float mfPauseCount;
271  float mfPauseWaitCount;
272  bool mbPaused;
273 
274  bool mbRespawn;
275 };
276 
277 } // namespace hpl
278 
279 #endif // HPL_PARTICLE_EMITTER_3D_USER_DATA_H
Definition: AI.h:36
Definition: ParticleEmitter3D.h:94
Definition: str.h:59
Definition: ParticleEmitter.h:203
Definition: PhysicsWorld.h:92
Definition: PhysicsWorld.h:100
Definition: PhysicsWorld.h:115
Definition: PhysicsBody.h:117
Definition: ParticleEmitter3D_UserData.h:248
Definition: ParticleEmitter3D_UserData.h:75
Definition: ParticleEmitter.h:133
Definition: ParticleEmitter.h:72
Definition: Resources.h:160
Definition: Color.h:37
Definition: tinyxml.h:864
Definition: Graphics.h:46