1 ////////////////////////////////////////////////////////////////////////////////
2 //    Scorched3D (c) 2000-2011
3 //
4 //    This file is part of Scorched3D.
5 //
6 //    Scorched3D 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 of the License, or
9 //    (at your option) any later version.
10 //
11 //    Scorched3D is distributed in the hope that it will be useful,
12 //    but WITHOUT ANY WARRANTY; without even the implied warranty of
13 //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 //    GNU General Public License for more details.
15 //
16 //    You should have received a copy of the GNU General Public License along
17 //    with this program; if not, write to the Free Software Foundation, Inc.,
18 //    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 ////////////////////////////////////////////////////////////////////////////////
20 
21 #if !defined(__INCLUDE_ParticleEmitterh_INCLUDE__)
22 #define __INCLUDE_ParticleEmitterh_INCLUDE__
23 
24 #include <graph/ParticleEngine.h>
25 #include <GLEXT/GLTextureSet.h>
26 #include <common/OptionsTransient.h>
27 
28 class ParticleEmitter
29 {
30 public:
31 	ParticleEmitter();
32 	virtual ~ParticleEmitter();
33 
34 	float life1_, life2_;
35 	float mass1_, mass2_;
36 	float friction1_, friction2_;
37 
38 	float startAlpha1_, startAlpha2_;
39 	float endAlpha1_, endAlpha2_;
40 	Vector velocity1_, velocity2_;
41 	Vector startColor1_, startColor2_;
42 	Vector endColor1_, endColor2_;
43 	Vector startSize1_, startSize2_;
44 	Vector endSize1_, endSize2_;
45 	Vector gravity_;
46 	bool additiveTexture_;
47 	bool windAffect_;
48 
49 	void createDefaultParticle(Particle &particle);
50 
51 	void setAttributes(
52 		float life1, float life2,
53 		float mass1, float mass2,
54 		float friction1, float friction2,
55 		Vector velocity1, Vector velocity2,
56 		Vector startColor1, float startAlpha1,
57 		Vector startColor2, float startAlpha2,
58 		Vector endColor1, float endAlpha1,
59 		Vector endColor2, float endAlpha2,
60 		float startX1, float startY1,
61 		float startX2, float startY2,
62 		float endX1, float endY1,
63 		float endX2, float endY2,
64 		Vector gravity,
65 		bool additiveTexture,
66 		bool windAffect);
67 
68 	void setLife(float life1, float life2);
69 	void setMass(float mass1, float mass2);
70 	void setFriction(float friction1, float friction2);
71 	void setVelocity(Vector velocity1, Vector velocity2);
72 	void setStartColor(
73 		Vector startColor1, float startAlpha1,
74 		Vector startColor2, float startAlpha2);
75 	void setEndColor(
76 		Vector endColor1, float endAlpha1,
77 		Vector endColor2, float endAlpha2);
78 	void setStartSize(
79 		float startX1, float startY1,
80 		float startX2, float startY2);
81 	void setEndSize(
82 		float endX1, float endY1,
83 		float endX2, float endY2);
84 	void setGravity(Vector gravity);
85 	void setAdditiveTexture(bool additiveTexture);
86 	void setWindAffect(bool windAffect);
87 
88 	void emitLinear(int number,
89 		Vector &position1, Vector &position2,
90 		ParticleEngine &engine,
91 		ParticleRenderer *renderer,
92 		GLTextureSet *set,
93 		bool animate);
94 	void emitExplosionRing(int number,
95 		Vector &position,
96 		Vector &axis,
97 		ParticleEngine &engine,
98 		float width,
99 		GLTextureSet *set,
100 		bool animate);
101 	void emitDebris(int number,
102 		Vector &position,
103 		ParticleEngine &engine);
104 	void emitSmoke(int number,
105 		Vector &position,
106 		ParticleEngine &engine);
107 	void emitNapalm(
108 		Vector &position,
109 		ParticleEngine &engine,
110 		GLTextureSet *set);
111 	void emitSpray(
112 		Vector &position,
113 		ParticleEngine &engine,
114 		float width,
115 		GLTexture *texture);
116 	void emitTalk(
117 		Vector &position,
118 		ParticleEngine &engine);
119 	void emitWallHit(
120 		Vector &position,
121 		ParticleEngine &engine,
122 		OptionsTransient::WallSide type);
123 	void emitTransport(
124 		Vector &position,
125 		ParticleEngine &engine,
126 		GLTextureSet *set);
127 	void emitExplosion(
128 		Vector &position,
129 		ParticleEngine &engine,
130 		float width,
131 		GLTextureSet *set,
132 		bool animate);
133 	void emitMushroom(
134 		Vector &position,
135 		ParticleEngine &engine,
136 		int number,
137 		float width,
138 		GLTextureSet *set,
139 		bool animate);
140 	void emitPrecipitation(
141 		Vector &position,
142 		ParticleEngine &engine,
143 		int number,
144 		bool rain);
145 };
146 
147 #endif // __INCLUDE_ParticleEmitterh_INCLUDE__
148 
149