Merge lp:~mc-return/compiz/compiz.merge-wizard-improvements into lp:compiz/0.9.10
- compiz.merge-wizard-improvements
- Merge into 0.9.10
Proposed by
MC Return
Status: | Work in progress |
---|---|
Proposed branch: | lp:~mc-return/compiz/compiz.merge-wizard-improvements |
Merge into: | lp:compiz/0.9.10 |
Diff against target: |
1227 lines (+380/-283) 2 files modified
plugins/wizard/src/wizard.cpp (+308/-214) plugins/wizard/src/wizard.h (+72/-69) |
To merge this branch: | bzr merge lp:~mc-return/compiz/compiz.merge-wizard-improvements |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Compiz Maintainers | Pending | ||
Review via email: mp+166147@code.launchpad.net |
Commit message
Wizard, code cleanup:
Declare local variables outside of loops.
Declaration and assignment of local variables in one line.
Use pre- instead of postfix increments.
Merged if condition checks.
Added and removed newlines.
Added default case to switch (just a style issue).
Removed redundant brackets.
Fixed indentation.
Wizard, speed improvements:
Try to avoid redundant GL_BLEND state changes, check if GL_BLEND
is already enabled, and do nothing if that is the case.
Description of the change
Still WIP.
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'plugins/wizard/src/wizard.cpp' |
2 | --- plugins/wizard/src/wizard.cpp 2013-05-09 13:43:07 +0000 |
3 | +++ plugins/wizard/src/wizard.cpp 2013-05-28 21:58:24 +0000 |
4 | @@ -30,16 +30,19 @@ |
5 | #include "wizard.h" |
6 | |
7 | static void |
8 | -initParticles (int hardLimit, int softLimit, ParticleSystem * ps) |
9 | +initParticles (int hardLimit, |
10 | + int softLimit, |
11 | + ParticleSystem *ps) |
12 | { |
13 | if (ps->particles) |
14 | free (ps->particles); |
15 | - ps->particles = (Particle*) calloc (hardLimit, sizeof (Particle)); |
16 | - ps->tex = 0; |
17 | - ps->hardLimit = hardLimit; |
18 | - ps->softLimit = softLimit; |
19 | - ps->active = false; |
20 | - ps->lastCount = 0; |
21 | + |
22 | + ps->particles = (Particle*) calloc (hardLimit, sizeof (Particle)); |
23 | + ps->tex = 0; |
24 | + ps->hardLimit = hardLimit; |
25 | + ps->softLimit = softLimit; |
26 | + ps->active = false; |
27 | + ps->lastCount = 0; |
28 | |
29 | // Initialize cache |
30 | ps->vertices_cache = NULL; |
31 | @@ -52,8 +55,8 @@ |
32 | ps->dcolors_cache_count = 0; |
33 | |
34 | Particle *part = ps->particles; |
35 | - int i; |
36 | - for (i = 0; i < hardLimit; i++, part++) |
37 | + |
38 | + for (int i = 0; i < hardLimit; ++i, ++part) |
39 | part->t = 0.0f; |
40 | } |
41 | |
42 | @@ -63,39 +66,45 @@ |
43 | if (ps->g) |
44 | free (ps->g); |
45 | |
46 | - int i; |
47 | - GPoint *gi; |
48 | + int i; |
49 | CompOption::Value::Vector cvv = optionGetGStrength (); |
50 | + |
51 | ps->ng = cvv.size (); |
52 | - ps->g = (GPoint*) calloc (ps->ng, sizeof (GPoint)); |
53 | - |
54 | - gi = ps->g; |
55 | - for (i = 0; i < ps->ng; i++, gi++) |
56 | - gi->strength = (float)cvv.at (i).i ()/ 1000.; |
57 | + ps->g = (GPoint*) calloc (ps->ng, sizeof (GPoint)); |
58 | + |
59 | + GPoint *gi = ps->g; |
60 | + |
61 | + for (i = 0; i < ps->ng; ++i, ++gi) |
62 | + gi->strength = (float)cvv.at (i).i () / 1000.; |
63 | |
64 | cvv = optionGetGPosx (); |
65 | - gi = ps->g; |
66 | - for (i = 0; i < ps->ng; i++, gi++) |
67 | + gi = ps->g; |
68 | + |
69 | + for (i = 0; i < ps->ng; ++i, ++gi) |
70 | gi->x = (float)cvv.at (i).i (); |
71 | |
72 | cvv = optionGetGPosy (); |
73 | - gi = ps->g; |
74 | - for (i = 0; i < ps->ng; i++, gi++) |
75 | + gi = ps->g; |
76 | + |
77 | + for (i = 0; i < ps->ng; ++i, ++gi) |
78 | gi->y = (float)cvv.at (i).i (); |
79 | |
80 | cvv = optionGetGSpeed (); |
81 | - gi = ps->g; |
82 | - for (i = 0; i < ps->ng; i++, gi++) |
83 | - gi->espeed = (float)cvv.at (i).i () / 100.; |
84 | + gi = ps->g; |
85 | + |
86 | + for (i = 0; i < ps->ng; ++i, ++gi) |
87 | + gi->espeed = (float)cvv.at (i).i () / 100.0; |
88 | |
89 | cvv = optionGetGAngle (); |
90 | - gi = ps->g; |
91 | - for (i = 0; i < ps->ng; i++, gi++) |
92 | - gi->eangle = (float)cvv.at (i).i () / 180.*M_PI; |
93 | + gi = ps->g; |
94 | + |
95 | + for (i = 0; i < ps->ng; ++i, ++gi) |
96 | + gi->eangle = (float)cvv.at (i).i () / 180.0 * M_PI; |
97 | |
98 | cvv = optionGetGMovement (); |
99 | - gi = ps->g; |
100 | - for (i = 0; i < ps->ng; i++, gi++) |
101 | + gi = ps->g; |
102 | + |
103 | + for (i = 0; i < ps->ng; ++i, ++gi) |
104 | gi->movement = cvv.at (i).i (); |
105 | } |
106 | |
107 | @@ -106,173 +115,204 @@ |
108 | free (ps->e); |
109 | |
110 | int i; |
111 | - Emitter *ei; |
112 | CompOption::Value::Vector cvv = optionGetEActive (); |
113 | - ps->ne = cvv.size (); |
114 | - ps->e = (Emitter*) calloc (ps->ne, sizeof (Emitter)); |
115 | + ps->ne = cvv.size (); |
116 | + ps->e = (Emitter*) calloc (ps->ne, sizeof (Emitter)); |
117 | + Emitter *ei = ps->e; |
118 | |
119 | - ei = ps->e; |
120 | - for (i = 0; i < ps->ne; i++, ei++) |
121 | + for (i = 0; i < ps->ne; ++i, ++ei) |
122 | ei->set_active = ei->active = cvv.at (i).b (); |
123 | |
124 | cvv = optionGetETrigger (); |
125 | - ei = ps->e; |
126 | - for (i = 0; i < ps->ne; i++, ei++) |
127 | + ei = ps->e; |
128 | + |
129 | + for (i = 0; i < ps->ne; ++i, ++ei) |
130 | ei->trigger = cvv.at (i).i (); |
131 | |
132 | cvv = optionGetEPosx (); |
133 | - ei = ps->e; |
134 | - for (i = 0; i < ps->ne; i++, ei++) |
135 | + ei = ps->e; |
136 | + |
137 | + for (i = 0; i < ps->ne; ++i, ++ei) |
138 | ei->x = (float)cvv.at (i).i (); |
139 | |
140 | cvv = optionGetEPosy (); |
141 | - ei = ps->e; |
142 | - for (i = 0; i < ps->ne; i++, ei++) |
143 | + ei = ps->e; |
144 | + |
145 | + for (i = 0; i < ps->ne; ++i, ++ei) |
146 | ei->y = (float)cvv.at (i).i (); |
147 | |
148 | cvv = optionGetESpeed (); |
149 | - ei = ps->e; |
150 | - for (i = 0; i < ps->ne; i++, ei++) |
151 | + ei = ps->e; |
152 | + |
153 | + for (i = 0; i < ps->ne; ++i, ++ei) |
154 | ei->espeed = (float)cvv.at (i).i () / 100.; |
155 | |
156 | cvv = optionGetEAngle (); |
157 | - ei = ps->e; |
158 | - for (i = 0; i < ps->ne; i++, ei++) |
159 | + ei = ps->e; |
160 | + |
161 | + for (i = 0; i < ps->ne; ++i, ++ei) |
162 | ei->eangle = (float)cvv.at (i).i () / 180.*M_PI; |
163 | |
164 | cvv = optionGetEMovement (); |
165 | - ei = ps->e; |
166 | - for (i = 0; i < ps->ne; i++, ei++) |
167 | + ei = ps->e; |
168 | + |
169 | + for (i = 0; i < ps->ne; ++i, ++ei) |
170 | ei->movement = cvv.at (i).i (); |
171 | |
172 | cvv = optionGetECount (); |
173 | - ei = ps->e; |
174 | - for (i = 0; i < ps->ne; i++, ei++) |
175 | + ei = ps->e; |
176 | + |
177 | + for (i = 0; i < ps->ne; ++i, ++ei) |
178 | ei->count = (float)cvv.at (i).i (); |
179 | |
180 | cvv = optionGetEH (); |
181 | - ei = ps->e; |
182 | - for (i = 0; i < ps->ne; i++, ei++) |
183 | + ei = ps->e; |
184 | + |
185 | + for (i = 0; i < ps->ne; ++i, ++ei) |
186 | ei->h = (float)cvv.at (i).i () / 1000.; |
187 | |
188 | cvv = optionGetEDh (); |
189 | - ei = ps->e; |
190 | - for (i = 0; i < ps->ne; i++, ei++) |
191 | + ei = ps->e; |
192 | + |
193 | + for (i = 0; i < ps->ne; ++i, ++ei) |
194 | ei->dh = (float)cvv.at (i).i () / 1000.; |
195 | |
196 | cvv = optionGetEL (); |
197 | - ei = ps->e; |
198 | - for (i = 0; i < ps->ne; i++, ei++) |
199 | + ei = ps->e; |
200 | + |
201 | + for (i = 0; i < ps->ne; ++i, ++ei) |
202 | ei->l = (float)cvv.at (i).i () / 1000.; |
203 | |
204 | cvv = optionGetEDl (); |
205 | - ei = ps->e; |
206 | - for (i = 0; i < ps->ne; i++, ei++) |
207 | + ei = ps->e; |
208 | + |
209 | + for (i = 0; i < ps->ne; ++i, ++ei) |
210 | ei->dl = (float)cvv.at (i).i () / 1000.; |
211 | |
212 | cvv = optionGetEA (); |
213 | - ei = ps->e; |
214 | - for (i = 0; i < ps->ne; i++, ei++) |
215 | + ei = ps->e; |
216 | + |
217 | + for (i = 0; i < ps->ne; ++i, ++ei) |
218 | ei->a = (float)cvv.at (i).i () / 1000.; |
219 | |
220 | cvv = optionGetEDa (); |
221 | - ei = ps->e; |
222 | - for (i = 0; i < ps->ne; i++, ei++) |
223 | + ei = ps->e; |
224 | + |
225 | + for (i = 0; i < ps->ne; ++i, ++ei) |
226 | ei->da = (float)cvv.at (i).i () / 1000.; |
227 | |
228 | cvv = optionGetEDx (); |
229 | - ei = ps->e; |
230 | - for (i = 0; i < ps->ne; i++, ei++) |
231 | + ei = ps->e; |
232 | + |
233 | + for (i = 0; i < ps->ne; ++i, ++ei) |
234 | ei->dx = (float)cvv.at (i).i (); |
235 | |
236 | cvv = optionGetEDy (); |
237 | - ei = ps->e; |
238 | - for (i = 0; i < ps->ne; i++, ei++) |
239 | + ei = ps->e; |
240 | + |
241 | + for (i = 0; i < ps->ne; ++i, ++ei) |
242 | ei->dy = (float)cvv.at (i).i (); |
243 | |
244 | cvv = optionGetEDcirc (); |
245 | - ei = ps->e; |
246 | - for (i = 0; i < ps->ne; i++, ei++) |
247 | + ei = ps->e; |
248 | + |
249 | + for (i = 0; i < ps->ne; ++i, ++ei) |
250 | ei->dcirc = (float)cvv.at (i).i (); |
251 | |
252 | cvv = optionGetEVx (); |
253 | - ei = ps->e; |
254 | - for (i = 0; i < ps->ne; i++, ei++) |
255 | + ei = ps->e; |
256 | + |
257 | + for (i = 0; i < ps->ne; ++i, ++ei) |
258 | ei->vx = (float)cvv.at (i).i () / 1000.; |
259 | |
260 | cvv = optionGetEVy (); |
261 | - ei = ps->e; |
262 | - for (i = 0; i < ps->ne; i++, ei++) |
263 | + ei = ps->e; |
264 | + |
265 | + for (i = 0; i < ps->ne; ++i, ++ei) |
266 | ei->vy = (float)cvv.at (i).i () / 1000.; |
267 | |
268 | cvv = optionGetEVt (); |
269 | ei = ps->e; |
270 | - for (i = 0; i < ps->ne; i++, ei++) |
271 | + |
272 | + for (i = 0; i < ps->ne; ++i, ++ei) |
273 | ei->vt = (float)cvv.at (i).i () / 10000.; |
274 | |
275 | cvv = optionGetEVphi (); |
276 | - ei = ps->e; |
277 | - for (i = 0; i < ps->ne; i++, ei++) |
278 | + ei = ps->e; |
279 | + |
280 | + for (i = 0; i < ps->ne; ++i, ++ei) |
281 | ei->vphi = (float)cvv.at (i).i () / 10000.; |
282 | |
283 | cvv = optionGetEDvx (); |
284 | ei = ps->e; |
285 | - for (i = 0; i < ps->ne; i++, ei++) |
286 | + |
287 | + for (i = 0; i < ps->ne; ++i, ++ei) |
288 | ei->dvx = (float)cvv.at (i).i () / 1000.; |
289 | |
290 | cvv = optionGetEDvy (); |
291 | - ei = ps->e; |
292 | - for (i = 0; i < ps->ne; i++, ei++) |
293 | + ei = ps->e; |
294 | + |
295 | + for (i = 0; i < ps->ne; ++i, ++ei) |
296 | ei->dvy = (float)cvv.at (i).i () / 1000.; |
297 | |
298 | cvv = optionGetEDvcirc (); |
299 | - ei = ps->e; |
300 | - for (i = 0; i < ps->ne; i++, ei++) |
301 | + ei = ps->e; |
302 | + |
303 | + for (i = 0; i < ps->ne; ++i, ++ei) |
304 | ei->dvcirc = (float)cvv.at (i).i () / 1000.; |
305 | |
306 | cvv = optionGetEDvt (); |
307 | - ei = ps->e; |
308 | - for (i = 0; i < ps->ne; i++, ei++) |
309 | + ei = ps->e; |
310 | + |
311 | + for (i = 0; i < ps->ne; ++i, ++ei) |
312 | ei->dvt = (float)cvv.at (i).i () / 10000.; |
313 | |
314 | cvv = optionGetEDvphi (); |
315 | - ei = ps->e; |
316 | - for (i = 0; i < ps->ne; i++, ei++) |
317 | + ei = ps->e; |
318 | + |
319 | + for (i = 0; i < ps->ne; ++i, ++ei) |
320 | ei->dvphi = (float)cvv.at (i).i () / 10000.; |
321 | |
322 | cvv = optionGetES (); |
323 | - ei = ps->e; |
324 | - for (i = 0; i < ps->ne; i++, ei++) |
325 | + ei = ps->e; |
326 | + |
327 | + for (i = 0; i < ps->ne; ++i, ++ei) |
328 | ei->s = (float)cvv.at (i).i (); |
329 | |
330 | cvv = optionGetEDs (); |
331 | - ei = ps->e; |
332 | - for (i = 0; i < ps->ne; i++, ei++) |
333 | + ei = ps->e; |
334 | + |
335 | + for (i = 0; i < ps->ne; ++i, ++ei) |
336 | ei->ds = (float)cvv.at (i).i (); |
337 | |
338 | cvv = optionGetESnew (); |
339 | - ei = ps->e; |
340 | - for (i = 0; i < ps->ne; i++, ei++) |
341 | + ei = ps->e; |
342 | + |
343 | + for (i = 0; i < ps->ne; ++i, ++ei) |
344 | ei->snew = (float)cvv.at (i).i (); |
345 | |
346 | cvv = optionGetEDsnew (); |
347 | - ei = ps->e; |
348 | - for (i = 0; i < ps->ne; i++, ei++) |
349 | + ei = ps->e; |
350 | + |
351 | + for (i = 0; i < ps->ne; ++i, ++ei) |
352 | ei->dsnew = (float)cvv.at (i).i (); |
353 | |
354 | cvv = optionGetEG (); |
355 | - ei = ps->e; |
356 | - for (i = 0; i < ps->ne; i++, ei++) |
357 | + ei = ps->e; |
358 | + |
359 | + for (i = 0; i < ps->ne; ++i, ++ei) |
360 | ei->g = (float)cvv.at (i).i () / 1000.; |
361 | |
362 | cvv = optionGetEDg (); |
363 | - ei = ps->e; |
364 | - for (i = 0; i < ps->ne; i++, ei++) |
365 | + ei = ps->e; |
366 | + |
367 | + for (i = 0; i < ps->ne; ++i, ++ei) |
368 | ei->dg = (float)cvv.at (i).i () / 1000.; |
369 | |
370 | cvv = optionGetEGp (); |
371 | - ei = ps->e; |
372 | - for (i = 0; i < ps->ne; i++, ei++) |
373 | + ei = ps->e; |
374 | + |
375 | + for (i = 0; i < ps->ne; ++i, ++ei) |
376 | ei->gp = (float)cvv.at (i).i () / 10000.; |
377 | } |
378 | |
379 | @@ -281,12 +321,17 @@ |
380 | { |
381 | glPushMatrix (); |
382 | |
383 | - glEnable (GL_BLEND); |
384 | + GLboolean glBlendEnabled = glIsEnabled (GL_BLEND); |
385 | + |
386 | + if (!glBlendEnabled) |
387 | + glEnable (GL_BLEND); |
388 | + |
389 | if (ps->tex) |
390 | { |
391 | glBindTexture (GL_TEXTURE_2D, ps->tex); |
392 | glEnable (GL_TEXTURE_2D); |
393 | } |
394 | + |
395 | glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); |
396 | |
397 | /* Check that the cache is big enough */ |
398 | @@ -333,32 +378,35 @@ |
399 | int cornersSize = sizeof (GLfloat) * 8; |
400 | int colorSize = sizeof (GLfloat) * 4; |
401 | |
402 | - GLfloat cornerCoords[8] = {0.0, 0.0, |
403 | - 0.0, 1.0, |
404 | - 1.0, 1.0, |
405 | - 1.0, 0.0}; |
406 | - |
407 | - int numActive = 0; |
408 | - |
409 | - Particle *part = ps->particles; |
410 | - int i; |
411 | - for (i = 0; i < ps->hardLimit; i++, part++) |
412 | + GLfloat cornerCoords[8] = |
413 | + { |
414 | + 0.0, 0.0, |
415 | + 0.0, 1.0, |
416 | + 1.0, 1.0, |
417 | + 1.0, 0.0 |
418 | + }; |
419 | + |
420 | + int numActive = 0; |
421 | + float offA, offB, cOff; |
422 | + Particle *part = ps->particles; |
423 | + |
424 | + for (int i = 0; i < ps->hardLimit; ++i, ++part) |
425 | { |
426 | if (part->t > 0.0f) |
427 | { |
428 | numActive += 4; |
429 | |
430 | - float cOff = part->s / 2.; //Corner offset from center |
431 | + cOff = part->s / 2.0; //Corner offset from center |
432 | |
433 | if (part->t > ps->tnew) //New particles start larger |
434 | cOff += (part->snew - part->s) * (part->t - ps->tnew) |
435 | - / (1. - ps->tnew) / 2.; |
436 | + / (1.0 - ps->tnew) / 2.0; |
437 | else if (part->t < ps->told) //Old particles shrink |
438 | - cOff -= part->s * (ps->told - part->t) / ps->told / 2.; |
439 | + cOff -= part->s * (ps->told - part->t) / ps->told / 2.0; |
440 | |
441 | //Offsets after rotation of Texture |
442 | - float offA = cOff * (cos (part->phi) - sin (part->phi)); |
443 | - float offB = cOff * (cos (part->phi) + sin (part->phi)); |
444 | + offA = cOff * (cos (part->phi) - sin (part->phi)); |
445 | + offB = cOff * (cos (part->phi) + sin (part->phi)); |
446 | |
447 | vertices[0] = part->x - offB; |
448 | vertices[1] = part->y - offA; |
449 | @@ -387,8 +435,8 @@ |
450 | colors[2] = part->c[2]; |
451 | |
452 | if (part->t > ps->tnew) //New particles start at a == 1 |
453 | - colors[3] = part->a + (1. - part->a) * (part->t - ps->tnew) |
454 | - / (1. - ps->tnew); |
455 | + colors[3] = part->a + (1.0 - part->a) * (part->t - ps->tnew) |
456 | + / (1.0 - ps->tnew); |
457 | else if (part->t < ps->told) //Old particles fade to a = 0 |
458 | colors[3] = part->a * part->t / ps->told; |
459 | else //The others have their own a |
460 | @@ -414,6 +462,7 @@ |
461 | } |
462 | } |
463 | } |
464 | + |
465 | glEnableClientState (GL_VERTEX_ARRAY); |
466 | glEnableClientState (GL_TEXTURE_COORD_ARRAY); |
467 | glEnableClientState (GL_COLOR_ARRAY); |
468 | @@ -428,6 +477,7 @@ |
469 | glColorPointer (4, GL_FLOAT, 4 * sizeof (GLfloat), ps->dcolors_cache); |
470 | glDrawArrays (GL_QUADS, 0, numActive); |
471 | } |
472 | + |
473 | // draw particles |
474 | glBlendFunc (GL_SRC_ALPHA, ps->blendMode); |
475 | |
476 | @@ -445,20 +495,30 @@ |
477 | glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA); |
478 | glDisable (GL_TEXTURE_2D); |
479 | glDisable (GL_BLEND); |
480 | + |
481 | + glDisableClientState (GL_COLOR_ARRAY); |
482 | + glDisableClientState (GL_TEXTURE_COORD_ARRAY); |
483 | + glDisableClientState (GL_VERTEX_ARRAY); |
484 | + |
485 | + glPopMatrix (); |
486 | + glColor4usv (defaultColor); |
487 | + gScreen->setTexEnvMode (GL_REPLACE); |
488 | + glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA); |
489 | } |
490 | |
491 | static void |
492 | -updateParticles (ParticleSystem * ps, float time) |
493 | +updateParticles (ParticleSystem *ps, |
494 | + float time) |
495 | { |
496 | - int i, j; |
497 | - int newCount = 0; |
498 | - Particle *part; |
499 | - GPoint *gi; |
500 | - float gdist, gangle; |
501 | + int i, j; |
502 | + int newCount = 0; |
503 | + Particle *part = ps->particles; |
504 | + GPoint *gi; |
505 | + float gdist, gangle; |
506 | + |
507 | ps->active = false; |
508 | |
509 | - part = ps->particles; |
510 | - for (i = 0; i < ps->hardLimit; i++, part++) |
511 | + for (i = 0; i < ps->hardLimit; ++i, ++part) |
512 | { |
513 | if (part->t > 0.0f) |
514 | { |
515 | @@ -482,12 +542,14 @@ |
516 | |
517 | //GPoint gravity |
518 | gi = ps->g; |
519 | - for (j = 0; j < ps->ng; j++, gi++) |
520 | + |
521 | + for (j = 0; j < ps->ng; ++j, ++gi) |
522 | { |
523 | if (gi->strength != 0) |
524 | { |
525 | - gdist = sqrt ((part->x-gi->x)*(part->x-gi->x) |
526 | - + (part->y-gi->y)*(part->y-gi->y)); |
527 | + gdist = sqrt ((part->x - gi->x) * (part->x - gi->x) + |
528 | + (part->y - gi->y) * (part->y - gi->y)); |
529 | + |
530 | if (gdist > 1) |
531 | { |
532 | gangle = atan2 (gi->y-part->y, gi->x-part->x); |
533 | @@ -498,7 +560,7 @@ |
534 | } |
535 | |
536 | ps->active = true; |
537 | - newCount++; |
538 | + ++newCount; |
539 | } |
540 | } |
541 | ps->lastCount = newCount; |
542 | @@ -506,22 +568,25 @@ |
543 | //Particle gravity |
544 | Particle *gpart; |
545 | part = ps->particles; |
546 | - for (i = 0; i < ps->hardLimit; i++, part++) |
547 | + |
548 | + for (i = 0; i < ps->hardLimit; ++i, ++part) |
549 | { |
550 | if (part->t > 0.0f && part->g != 0) |
551 | { |
552 | gpart = ps->particles; |
553 | - for (j = 0; j < ps->hardLimit; j++, gpart++) |
554 | + |
555 | + for (j = 0; j < ps->hardLimit; ++j, ++gpart) |
556 | { |
557 | if (gpart->t > 0.0f) |
558 | { |
559 | - gdist = sqrt ((part->x-gpart->x)*(part->x-gpart->x) |
560 | - + (part->y-gpart->y)*(part->y-gpart->y)); |
561 | + gdist = sqrt ((part->x - gpart->x) * (part->x - gpart->x) + |
562 | + (part->y - gpart->y) * (part->y - gpart->y)); |
563 | + |
564 | if (gdist > 1) |
565 | { |
566 | - gangle = atan2 (part->y-gpart->y, part->x-gpart->x); |
567 | - gpart->vx += part->g/gdist* cos (gangle) * part->t*time; |
568 | - gpart->vy += part->g/gdist* sin (gangle) * part->t*time; |
569 | + gangle = atan2 (part->y - gpart->y, part->x - gpart->x); |
570 | + gpart->vx += part->g / gdist * cos (gangle) * part->t * time; |
571 | + gpart->vy += part->g / gdist * sin (gangle) * part->t * time; |
572 | } |
573 | } |
574 | } |
575 | @@ -530,41 +595,46 @@ |
576 | } |
577 | |
578 | static void |
579 | -finiParticles (ParticleSystem * ps) |
580 | +finiParticles (ParticleSystem *ps) |
581 | { |
582 | free (ps->e); |
583 | free (ps->particles); |
584 | + |
585 | if (ps->tex) |
586 | glDeleteTextures (1, &ps->tex); |
587 | |
588 | if (ps->vertices_cache) |
589 | free (ps->vertices_cache); |
590 | + |
591 | if (ps->colors_cache) |
592 | free (ps->colors_cache); |
593 | + |
594 | if (ps->coords_cache) |
595 | free (ps->coords_cache); |
596 | + |
597 | if (ps->dcolors_cache) |
598 | free (ps->dcolors_cache); |
599 | } |
600 | |
601 | static void |
602 | -genNewParticles (ParticleSystem *ps, Emitter *e) |
603 | +genNewParticles (ParticleSystem *ps, |
604 | + Emitter *e) |
605 | { |
606 | - |
607 | float q, p, t = 0, h, l; |
608 | int count = e->count; |
609 | |
610 | Particle *part = ps->particles; |
611 | - int i, j; |
612 | + int j; |
613 | |
614 | - for (i = 0; i < ps->hardLimit && count > 0; i++, part++) |
615 | + for (int i = 0; i < ps->hardLimit && count > 0; ++i, ++part) |
616 | { |
617 | if (part->t <= 0.0f) |
618 | { |
619 | //Position |
620 | part->x = rRange (e->x, e->dx); // X Position |
621 | part->y = rRange (e->y, e->dy); // Y Position |
622 | - if ((q = rRange (e->dcirc/2.,e->dcirc/2.)) > 0) |
623 | + |
624 | + if ((q = rRange (e->dcirc / 2.0, e->dcirc / 2.0)) > 0) |
625 | { |
626 | p = rRange (0, M_PI); |
627 | part->x += q * cos (p); |
628 | @@ -574,70 +644,84 @@ |
629 | //Speed |
630 | part->vx = rRange (e->vx, e->dvx); // X Speed |
631 | part->vy = rRange (e->vy, e->dvy); // Y Speed |
632 | - if ((q = rRange (e->dvcirc/2.,e->dvcirc/2.)) > 0) |
633 | + |
634 | + if ((q = rRange (e->dvcirc / 2.0, e->dvcirc / 2.0)) > 0) |
635 | { |
636 | p = rRange (0, M_PI); |
637 | part->vx += q * cos (p); |
638 | part->vy += q * sin (p); |
639 | } |
640 | part->vt = rRange (e->vt, e->dvt); // Aging speed |
641 | + |
642 | if (part->vt > -0.0001) |
643 | part->vt = -0.0001; |
644 | |
645 | //Size, Gravity and Rotation |
646 | - part->s = rRange (e->s, e->ds); // Particle size |
647 | + part->s = rRange (e->s, e->ds); // Particle size |
648 | part->snew = rRange (e->snew, e->dsnew); // Particle start size |
649 | - if (e->gp > (float)(random () & 0xffff) / 65535.) |
650 | + |
651 | + if (e->gp > (float)(random () & 0xffff) / 65535.0) |
652 | part->g = rRange (e->g, e->dg); // Particle gravity |
653 | else |
654 | - part->g = 0.; |
655 | - part->phi = rRange (0, M_PI); // Random orientation |
656 | + part->g = 0.0; |
657 | + |
658 | + part->phi = rRange (0, M_PI); // Random orientation |
659 | part->vphi = rRange (e->vphi, e->dvphi); // Rotation speed |
660 | |
661 | //Alpha |
662 | part->a = rRange (e->a, e->da); // Alpha |
663 | + |
664 | if (part->a > 1) |
665 | - part->a = 1.; |
666 | + part->a = 1.0; |
667 | else if (part->a < 0) |
668 | - part->a = 0.; |
669 | + part->a = 0.0; |
670 | |
671 | //HSL to RGB conversion from Wikipedia simplified by S = 1 |
672 | h = rRange (e->h, e->dh); //Random hue within range |
673 | + |
674 | if (h < 0) |
675 | - h += 1.; |
676 | + h += 1.0; |
677 | else if (t > 1) |
678 | - h -= 1.; |
679 | + h -= 1.0; |
680 | + |
681 | l = rRange (e->l, e->dl); //Random lightness ... |
682 | + |
683 | if (l > 1) |
684 | - l = 1.; |
685 | + l = 1.0; |
686 | else if (l < 0) |
687 | - l = 0.; |
688 | + l = 0.0; |
689 | + |
690 | q = e->l * 2; |
691 | + |
692 | if (q > 1) |
693 | - q = 1.; |
694 | + q = 1.0; |
695 | + |
696 | p = 2 * e->l - q; |
697 | + |
698 | for (j = 0; j < 3; j++) |
699 | { |
700 | - t = h + (1-j)/3.; |
701 | + t = h + (1 - j) / 3.0; |
702 | + |
703 | if (t < 0) |
704 | - t += 1.; |
705 | + t += 1.0; |
706 | else if (t > 1) |
707 | - t -= 1.; |
708 | - if (t < 1/6.) |
709 | - part->c[j] = p + ((q-p)*6*t); |
710 | - else if (t < .5) |
711 | + t -= 1.0; |
712 | + |
713 | + if (t < 1 / 6.0) |
714 | + part->c[j] = p + ((q - p) * 6 * t); |
715 | + else if (t < 0.5) |
716 | part->c[j] = q; |
717 | - else if (t < 2/3.) |
718 | - part->c[j] = p + ((q-p)*6*(2/3.-t)); |
719 | + else if (t < 2 / 3.0) |
720 | + part->c[j] = p + ((q - p) * 6 * (2 / 3.0 - t)); |
721 | else |
722 | part->c[j] = p; |
723 | } |
724 | |
725 | // give new life |
726 | - part->t = 1.; |
727 | + part->t = 1.0; |
728 | |
729 | ps->active = true; |
730 | - count -= 1; |
731 | + count -= 1; |
732 | } |
733 | } |
734 | } |
735 | @@ -653,7 +737,8 @@ |
736 | Emitter *ei = ps->e; |
737 | GPoint *gi = ps->g; |
738 | int i; |
739 | - for (i = 0; i < ps->ng; i++, gi++) |
740 | + |
741 | + for (i = 0; i < ps->ng; ++i, ++gi) |
742 | { |
743 | if (gi->movement == MOVEMENT_MOUSEPOSITION) |
744 | { |
745 | @@ -662,13 +747,14 @@ |
746 | } |
747 | } |
748 | |
749 | - for (i = 0; i < ps->ne; i++, ei++) |
750 | + for (i = 0; i < ps->ne; ++i, ++ei) |
751 | { |
752 | if (ei->movement == MOVEMENT_MOUSEPOSITION) |
753 | { |
754 | ei->x = pos.x (); |
755 | ei->y = pos.y (); |
756 | } |
757 | + |
758 | if (ei->active && ei->trigger == TRIGGER_MOUSEMOVEMENT) |
759 | genNewParticles (ps, ei); |
760 | } |
761 | @@ -684,21 +770,23 @@ |
762 | if (active && !ps) |
763 | { |
764 | ps = (ParticleSystem*) calloc(1, sizeof (ParticleSystem)); |
765 | + |
766 | if (!ps) |
767 | { |
768 | cScreen->preparePaint (time); |
769 | return; |
770 | } |
771 | + |
772 | loadGPoints (ps); |
773 | loadEmitters (ps); |
774 | initParticles (optionGetHardLimit (), optionGetSoftLimit (), ps); |
775 | - ps->darken = optionGetDarken (); |
776 | + ps->darken = optionGetDarken (); |
777 | ps->blendMode = (optionGetBlend ()) ? GL_ONE : |
778 | GL_ONE_MINUS_SRC_ALPHA; |
779 | - ps->tnew = optionGetTnew (); |
780 | - ps->told = optionGetTold (); |
781 | - ps->gx = optionGetGx (); |
782 | - ps->gy = optionGetGy (); |
783 | + ps->tnew = optionGetTnew (); |
784 | + ps->told = optionGetTold (); |
785 | + ps->gx = optionGetGx (); |
786 | + ps->gy = optionGetGy (); |
787 | |
788 | glGenTextures (1, &ps->tex); |
789 | glBindTexture (GL_TEXTURE_2D, ps->tex); |
790 | @@ -714,127 +802,133 @@ |
791 | if (ps && active && ps->e) |
792 | { |
793 | Emitter *ei = ps->e; |
794 | - GPoint *gi = ps->g; |
795 | + GPoint *gi = ps->g; |
796 | int i; |
797 | |
798 | - for (i = 0; i < ps->ng; i++, gi++) |
799 | + for (i = 0; i < ps->ng; ++i, ++gi) |
800 | { |
801 | - if (gi->movement==MOVEMENT_BOUNCE || gi->movement==MOVEMENT_WRAP) |
802 | + if (gi->movement == MOVEMENT_BOUNCE || gi->movement == MOVEMENT_WRAP) |
803 | { |
804 | gi->x += gi->espeed * cos (gi->eangle) * time; |
805 | gi->y += gi->espeed * sin (gi->eangle) * time; |
806 | + |
807 | if (gi->x >= screen->width ()) |
808 | { |
809 | - if (gi->movement==MOVEMENT_BOUNCE) |
810 | + if (gi->movement == MOVEMENT_BOUNCE) |
811 | { |
812 | - gi->x = 2*screen->width () - gi->x - 1; |
813 | + gi->x = 2 * screen->width () - gi->x - 1; |
814 | gi->eangle = M_PI - gi->eangle; |
815 | } |
816 | - else if (gi->movement==MOVEMENT_WRAP) |
817 | + else if (gi->movement == MOVEMENT_WRAP) |
818 | gi->x -= screen->width (); |
819 | } |
820 | else if (gi->x < 0) |
821 | { |
822 | - if (gi->movement==MOVEMENT_BOUNCE) |
823 | + if (gi->movement == MOVEMENT_BOUNCE) |
824 | { |
825 | - gi->x *= -1; |
826 | + gi->x *= -1; |
827 | gi->eangle = M_PI - gi->eangle; |
828 | } |
829 | - else if (gi->movement==MOVEMENT_WRAP) |
830 | + else if (gi->movement == MOVEMENT_WRAP) |
831 | gi->x += screen->width (); |
832 | } |
833 | + |
834 | if (gi->y >= screen->height ()) |
835 | { |
836 | - if (gi->movement==MOVEMENT_BOUNCE) |
837 | + if (gi->movement == MOVEMENT_BOUNCE) |
838 | { |
839 | - gi->y = 2*screen->height () - gi->y - 1; |
840 | + gi->y = 2 * screen->height () - gi->y - 1; |
841 | gi->eangle *= -1; |
842 | } |
843 | - else if (gi->movement==MOVEMENT_WRAP) |
844 | + else if (gi->movement == MOVEMENT_WRAP) |
845 | gi->y -= screen->height (); |
846 | } |
847 | else if (gi->y < 0) |
848 | { |
849 | - if (gi->movement==MOVEMENT_BOUNCE) |
850 | + if (gi->movement == MOVEMENT_BOUNCE) |
851 | { |
852 | - gi->y *= -1; |
853 | + gi->y *= -1; |
854 | gi->eangle *= -1; |
855 | } |
856 | - else if (gi->movement==MOVEMENT_WRAP) |
857 | + else if (gi->movement == MOVEMENT_WRAP) |
858 | gi->y += screen->height (); |
859 | } |
860 | } |
861 | - if (gi->movement==MOVEMENT_FOLLOWMOUSE |
862 | + |
863 | + if (gi->movement == MOVEMENT_FOLLOWMOUSE |
864 | && (my!=gi->y||mx!=gi->x)) |
865 | { |
866 | - gi->eangle = atan2(my-gi->y, mx-gi->x); |
867 | + gi->eangle = atan2 (my-gi->y, mx-gi->x); |
868 | gi->x += gi->espeed * cos(gi->eangle) * time; |
869 | gi->y += gi->espeed * sin(gi->eangle) * time; |
870 | } |
871 | } |
872 | |
873 | - for (i = 0; i < ps->ne; i++, ei++) |
874 | + for (i = 0; i < ps->ne; ++i, ++ei) |
875 | { |
876 | - if (ei->movement==MOVEMENT_BOUNCE || ei->movement==MOVEMENT_WRAP) |
877 | + if (ei->movement == MOVEMENT_BOUNCE || ei->movement == MOVEMENT_WRAP) |
878 | { |
879 | ei->x += ei->espeed * cos (ei->eangle) * time; |
880 | ei->y += ei->espeed * sin (ei->eangle) * time; |
881 | + |
882 | if (ei->x >= screen->width ()) |
883 | { |
884 | - if (ei->movement==MOVEMENT_BOUNCE) |
885 | + if (ei->movement == MOVEMENT_BOUNCE) |
886 | { |
887 | - ei->x = 2*screen->width () - ei->x - 1; |
888 | + ei->x = 2 * screen->width () - ei->x - 1; |
889 | ei->eangle = M_PI - ei->eangle; |
890 | } |
891 | - else if (ei->movement==MOVEMENT_WRAP) |
892 | + else if (ei->movement == MOVEMENT_WRAP) |
893 | ei->x -= screen->width (); |
894 | } |
895 | else if (ei->x < 0) |
896 | { |
897 | - if (ei->movement==MOVEMENT_BOUNCE) |
898 | + if (ei->movement == MOVEMENT_BOUNCE) |
899 | { |
900 | ei->x *= -1; |
901 | ei->eangle = M_PI - ei->eangle; |
902 | } |
903 | - else if (ei->movement==MOVEMENT_WRAP) |
904 | + else if (ei->movement == MOVEMENT_WRAP) |
905 | ei->x += screen->width (); |
906 | } |
907 | if (ei->y >= screen->height ()) |
908 | { |
909 | - if (ei->movement==MOVEMENT_BOUNCE) |
910 | + if (ei->movement == MOVEMENT_BOUNCE) |
911 | { |
912 | - ei->y = 2*screen->height () - ei->y - 1; |
913 | + ei->y = 2 * screen->height () - ei->y - 1; |
914 | ei->eangle *= -1; |
915 | } |
916 | - else if (ei->movement==MOVEMENT_WRAP) |
917 | + else if (ei->movement == MOVEMENT_WRAP) |
918 | ei->y -= screen->height (); |
919 | } |
920 | else if (ei->y < 0) |
921 | { |
922 | - if (ei->movement==MOVEMENT_BOUNCE) |
923 | + if (ei->movement == MOVEMENT_BOUNCE) |
924 | { |
925 | ei->y *= -1; |
926 | ei->eangle *= -1; |
927 | } |
928 | - else if (ei->movement==MOVEMENT_WRAP) |
929 | + else if (ei->movement == MOVEMENT_WRAP) |
930 | ei->y += screen->height (); |
931 | } |
932 | } |
933 | - if (ei->movement==MOVEMENT_FOLLOWMOUSE |
934 | + |
935 | + if (ei->movement == MOVEMENT_FOLLOWMOUSE |
936 | && (my!=ei->y||mx!=ei->x)) |
937 | { |
938 | ei->eangle = atan2 (my-ei->y, mx-ei->x); |
939 | ei->x += ei->espeed * cos (ei->eangle) * time; |
940 | ei->y += ei->espeed * sin (ei->eangle) * time; |
941 | } |
942 | - if (ei->trigger == TRIGGER_RANDOMPERIOD |
943 | - && ei->set_active && !((int)random ()&0xff)) |
944 | + |
945 | + if (ei->trigger == TRIGGER_RANDOMPERIOD && |
946 | + ei->set_active && |
947 | + !((int)random ()&0xff)) |
948 | ei->active = !ei->active; |
949 | - if (ei->active && ( |
950 | - (ei->trigger == TRIGGER_PERSISTENT) || |
951 | - (ei->trigger == TRIGGER_RANDOMSHOT && !((int)random()&0xff)) || |
952 | - (ei->trigger == TRIGGER_RANDOMPERIOD) |
953 | - )) |
954 | + |
955 | + if (ei->active && ((ei->trigger == TRIGGER_PERSISTENT) || |
956 | + (ei->trigger == TRIGGER_RANDOMSHOT && !((int)random()&0xff)) || |
957 | + (ei->trigger == TRIGGER_RANDOMPERIOD))) |
958 | genNewParticles (ps, ei); |
959 | } |
960 | } |
961 | @@ -868,16 +962,15 @@ |
962 | } |
963 | |
964 | bool |
965 | -WizardScreen::glPaintOutput (const GLScreenPaintAttrib &sa, |
966 | - const GLMatrix &transform, |
967 | - const CompRegion ®ion, |
968 | - CompOutput *output, |
969 | - unsigned int mask) |
970 | +WizardScreen::glPaintOutput (const GLScreenPaintAttrib &sa, |
971 | + const GLMatrix &transform, |
972 | + const CompRegion ®ion, |
973 | + CompOutput *output, |
974 | + unsigned int mask) |
975 | { |
976 | - bool status; |
977 | - GLMatrix sTransform; |
978 | + GLMatrix sTransform; |
979 | |
980 | - status = gScreen->glPaintOutput (sa, transform, region, output, mask); |
981 | + bool status = gScreen->glPaintOutput (sa, transform, region, output, mask); |
982 | |
983 | if (!ps || !ps->active) |
984 | return status; |
985 | @@ -902,16 +995,17 @@ |
986 | WizardScreen::toggle () |
987 | { |
988 | active = !active; |
989 | + |
990 | cScreen->preparePaintSetEnabled (this, active); |
991 | cScreen->donePaintSetEnabled (this, active); |
992 | gScreen->glPaintOutputSetEnabled (this, active); |
993 | - |
994 | + |
995 | cScreen->damageScreen (); |
996 | return true; |
997 | } |
998 | |
999 | void |
1000 | -WizardScreen::optionChanged (CompOption *opt, |
1001 | +WizardScreen::optionChanged (CompOption *opt, |
1002 | WizardOptions::Options num) |
1003 | { |
1004 | loadGPoints (ps); |
1005 | |
1006 | === renamed file 'plugins/wizard/include/wizard.h' => 'plugins/wizard/src/wizard.h' |
1007 | --- plugins/wizard/include/wizard.h 2010-09-14 01:57:47 +0000 |
1008 | +++ plugins/wizard/src/wizard.h 2013-05-28 21:58:24 +0000 |
1009 | @@ -33,9 +33,10 @@ |
1010 | #include "wizard_tex.h" |
1011 | |
1012 | static float |
1013 | -rRange (float avg, float range) |
1014 | +rRange (float avg, |
1015 | + float range) |
1016 | { |
1017 | - return avg + (float)((random () & 0xff)/127.5-1.)*range; |
1018 | + return avg + (float)((random () & 0xff) / 127.5-1.) * range; |
1019 | } |
1020 | |
1021 | typedef enum |
1022 | @@ -59,8 +60,8 @@ |
1023 | public: |
1024 | |
1025 | float strength; // Strength of this gravity source |
1026 | - float x; // X position |
1027 | - float y; // Y position |
1028 | + float x; // X position |
1029 | + float y; // Y position |
1030 | float espeed; // Speed of the gravity source |
1031 | float eangle; // Angle for the movement of this gravity source |
1032 | int movement; // Type of movement of this gravity source |
1033 | @@ -70,69 +71,69 @@ |
1034 | { |
1035 | public: |
1036 | |
1037 | - float c[3]; // Color |
1038 | - float a; // alpha value |
1039 | - float x; // X position |
1040 | - float y; // Y position |
1041 | - float t; // t position (age, born at 1, dies at 0) |
1042 | - float phi; // Orientation of texture |
1043 | - float vx; // X speed |
1044 | - float vy; // Y speed |
1045 | - float vt; // t speed (aging speed) |
1046 | - float vphi; // Rotation speed |
1047 | - float s; // size (side of the square) |
1048 | - float snew; // Size when born (reduced to s while new) |
1049 | - float g; // Gravity from this particle |
1050 | + float c[3]; // Color |
1051 | + float a; // alpha value |
1052 | + float x; // X position |
1053 | + float y; // Y position |
1054 | + float t; // t position (age, born at 1, dies at 0) |
1055 | + float phi; // Orientation of texture |
1056 | + float vx; // X speed |
1057 | + float vy; // Y speed |
1058 | + float vt; // t speed (aging speed) |
1059 | + float vphi; // Rotation speed |
1060 | + float s; // size (side of the square) |
1061 | + float snew; // Size when born (reduced to s while new) |
1062 | + float g; // Gravity from this particle |
1063 | }; |
1064 | |
1065 | class Emitter |
1066 | { |
1067 | public: |
1068 | |
1069 | - bool set_active; // Set to active in the settings |
1070 | + bool set_active; // Set to active in the settings |
1071 | bool active; // Currently active (differs from set_active for |
1072 | - // the random period trigger) |
1073 | + // the random period trigger) |
1074 | int trigger; // When to generate particles |
1075 | int count; // Amount of particles to be generated |
1076 | - float h; // color hue (0..1) |
1077 | - float dh; // color hue range |
1078 | - float l; // color lightness (0..1) |
1079 | - float dl; // color lightness range |
1080 | - float a; // Alpha |
1081 | - float da; // Alpha range |
1082 | - float x; // X position |
1083 | - float y; // Y position |
1084 | + float h; // color hue (0..1) |
1085 | + float dh; // color hue range |
1086 | + float l; // color lightness (0..1) |
1087 | + float dl; // color lightness range |
1088 | + float a; // Alpha |
1089 | + float da; // Alpha range |
1090 | + float x; // X position |
1091 | + float y; // Y position |
1092 | float espeed; // Speed of the emitter |
1093 | float eangle; // Angle for the movement of this emitter |
1094 | int movement; // Type of movement of this emitter |
1095 | - float dx; // X range |
1096 | - float dy; // Y range |
1097 | + float dx; // X range |
1098 | + float dy; // Y range |
1099 | float dcirc; // Circular range |
1100 | - float vx; // X speed |
1101 | - float vy; // Y speed |
1102 | - float vt; // t speed (aging speed) |
1103 | - float vphi; // Rotation speed |
1104 | - float dvx; // X speed range |
1105 | - float dvy; // Y speed range |
1106 | + float vx; // X speed |
1107 | + float vy; // Y speed |
1108 | + float vt; // t speed (aging speed) |
1109 | + float vphi; // Rotation speed |
1110 | + float dvx; // X speed range |
1111 | + float dvy; // Y speed range |
1112 | float dvcirc; // Circular speed range |
1113 | - float dvt; // t speed (aging speed) range |
1114 | + float dvt; // t speed (aging speed) range |
1115 | float dvphi; // Rotation speed range |
1116 | - float s; // size (side of the square) |
1117 | - float ds; // size (side of the square) range |
1118 | - float snew; // Size when born (reduced to s while new) |
1119 | + float s; // size (side of the square) |
1120 | + float ds; // size (side of the square) range |
1121 | + float snew; // Size when born (reduced to s while new) |
1122 | float dsnew; // Size when born (reduced to s while new) range |
1123 | - float g; // Gravity of particles |
1124 | - float dg; // Gravity range |
1125 | - float gp; // Part of particles that have gravity |
1126 | + float g; // Gravity of particles |
1127 | + float dg; // Gravity range |
1128 | + float gp; // Part of particles that have gravity |
1129 | }; |
1130 | |
1131 | class ParticleSystem |
1132 | { |
1133 | public: |
1134 | |
1135 | - int hardLimit; // Not to be exceeded |
1136 | - int softLimit; // If exceeded, old particles age faster |
1137 | - int lastCount; // Living particle count to evaluate softLimit |
1138 | + int hardLimit; // Not to be exceeded |
1139 | + int softLimit; // If exceeded, old particles age faster |
1140 | + int lastCount; // Living particle count to evaluate softLimit |
1141 | float tnew; // Particle is new if t > tnew |
1142 | float told; // Particle is old if t < told |
1143 | float gx; // Global gravity x |
1144 | @@ -140,21 +141,21 @@ |
1145 | Particle *particles; // The actual particles |
1146 | GLuint tex; // Particle Texture |
1147 | bool active; |
1148 | - float darken; // Darken background |
1149 | + float darken; // Darken background |
1150 | GLuint blendMode; |
1151 | Emitter *e; // All emitters in here |
1152 | GPoint *g; // All gravity point sources in here |
1153 | int ne; // Emitter count |
1154 | int ng; // GPoint count |
1155 | |
1156 | - GLfloat *vertices_cache; |
1157 | - int vertex_cache_count; |
1158 | - GLfloat *coords_cache; |
1159 | - int coords_cache_count; |
1160 | - GLfloat *colors_cache; |
1161 | - int color_cache_count; |
1162 | - GLfloat *dcolors_cache; |
1163 | - int dcolors_cache_count; |
1164 | + GLfloat *vertices_cache; |
1165 | + int vertex_cache_count; |
1166 | + GLfloat *coords_cache; |
1167 | + int coords_cache_count; |
1168 | + GLfloat *colors_cache; |
1169 | + int color_cache_count; |
1170 | + GLfloat *dcolors_cache; |
1171 | + int dcolors_cache_count; |
1172 | }; |
1173 | |
1174 | class WizardScreen : |
1175 | @@ -165,19 +166,21 @@ |
1176 | public GLScreenInterface |
1177 | { |
1178 | public: |
1179 | + |
1180 | WizardScreen (CompScreen *screen); |
1181 | ~WizardScreen (); |
1182 | |
1183 | CompositeScreen *cScreen; |
1184 | - GLScreen *gScreen; |
1185 | - |
1186 | - int mx, my; //Mouse Position from polling |
1187 | - |
1188 | - bool active; |
1189 | - |
1190 | - ParticleSystem *ps; |
1191 | - |
1192 | - MousePoller pollHandle; |
1193 | + GLScreen *gScreen; |
1194 | + |
1195 | + int mx; |
1196 | + int my; //Mouse Position from polling |
1197 | + |
1198 | + bool active; |
1199 | + |
1200 | + ParticleSystem *ps; |
1201 | + |
1202 | + MousePoller pollHandle; |
1203 | |
1204 | void loadGPoints (ParticleSystem *ps); |
1205 | |
1206 | @@ -192,16 +195,16 @@ |
1207 | void donePaint (); |
1208 | |
1209 | bool |
1210 | - glPaintOutput (const GLScreenPaintAttrib &sa, |
1211 | - const GLMatrix &transform, |
1212 | - const CompRegion ®ion, |
1213 | - CompOutput *output, |
1214 | - unsigned int mask); |
1215 | + glPaintOutput (const GLScreenPaintAttrib &sa, |
1216 | + const GLMatrix &transform, |
1217 | + const CompRegion ®ion, |
1218 | + CompOutput *output, |
1219 | + unsigned int mask); |
1220 | |
1221 | bool toggle (); |
1222 | |
1223 | void |
1224 | - optionChanged (CompOption *opt, |
1225 | + optionChanged (CompOption *opt, |
1226 | WizardOptions::Options num); |
1227 | }; |
1228 |