Merge lp:~mc-return/compiz/compiz.merge-plugin-trip into lp:compiz/0.9.8

Proposed by MC Return
Status: Merged
Approved by: Daniel van Vugt
Approved revision: 3279
Merged at revision: 3281
Proposed branch: lp:~mc-return/compiz/compiz.merge-plugin-trip
Merge into: lp:compiz/0.9.8
Diff against target: 905 lines (+879/-0)
5 files modified
plugins/trip/CMakeLists.txt (+5/-0)
plugins/trip/VERSION (+1/-0)
plugins/trip/src/trip.cpp (+578/-0)
plugins/trip/src/trip.h (+192/-0)
plugins/trip/trip.xml.in (+103/-0)
To merge this branch: bzr merge lp:~mc-return/compiz/compiz.merge-plugin-trip
Reviewer Review Type Date Requested Status
Daniel van Vugt Approve
Didier Roche-Tolomelli Pending
Review via email: mp+113449@code.launchpad.net

Commit message

Added the plug-in "Trip" converted from git to bzr (including full history) to Compiz.

Description of the change

Adds the plug-in "Trip" converted from git to bzr (including full history) to Compiz.

UNBLOCK

To post a comment you must log in.
Revision history for this message
MC Return (mc-return) wrote :

This one *should* work, at least it does here (Ubuntu 12.10, latest Compiz 0.9.8).
It is quite useless, just like the water plug-in, but still is very nice to show off Compiz, just like the water plug-in :)
Seems something went wrong with my commit message (r3279), sorry about that.

Revision history for this message
Daniel van Vugt (vanvugt) :
review: Approve
Revision history for this message
Unity Merger (unity-merger) wrote :

The Jenkins job https://jenkins.qa.ubuntu.com/job/automerge-compiz-core/17/console reported an error when processing this lp:~mc-return/compiz/compiz.merge-plugin-trip branch.
Not merging it.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Needs downstream packaging to get Jenkins approval...

dh_install: usr/share/compiz/trip.xml exists in debian/tmp but is not installed to anywhere
dh_install: usr/lib/compiz/libtrip.so exists in debian/tmp but is not installed to anywhere
dh_install: missing files, aborting

Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

@Daniel: package change done, BUT:
not sure why this has an unblock as gsettings/tests was supposively the only code entering to trunk before next snapshot.

Btw, I think now all plugins/new code entering the code will need tests. I won't accept anymore code without test to enter ubuntu.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Sorry; I had no idea if or why lp:compiz was frozen. So tried UNBLOCK on everything.

Yes, tests are important. But not for "unsupported" plugins like this one.

Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

@Daniel: it is important, it's in ubuntu, can be installed by people and affect the overall experience

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added directory 'plugins/trip'
=== added file 'plugins/trip/CMakeLists.txt'
--- plugins/trip/CMakeLists.txt 1970-01-01 00:00:00 +0000
+++ plugins/trip/CMakeLists.txt 2012-07-04 19:03:18 +0000
@@ -0,0 +1,5 @@
1find_package (Compiz REQUIRED)
2
3include (CompizPlugin)
4
5compiz_plugin (trip PLUGINDEPS composite opengl)
06
=== added file 'plugins/trip/VERSION'
--- plugins/trip/VERSION 1970-01-01 00:00:00 +0000
+++ plugins/trip/VERSION 2012-07-04 19:03:18 +0000
@@ -0,0 +1,1 @@
10.9.5.0
02
=== added directory 'plugins/trip/src'
=== added file 'plugins/trip/src/trip.cpp'
--- plugins/trip/src/trip.cpp 1970-01-01 00:00:00 +0000
+++ plugins/trip/src/trip.cpp 2012-07-04 19:03:18 +0000
@@ -0,0 +1,578 @@
1/*
2 *
3 * Compiz trip plugin
4 *
5 * trip.c
6 *
7 * Copyright : (C) 2010 by Scott Moreau
8 * E-mail : oreaus@gmail.com
9 *
10 * Based off the mag plugin by :
11 * Copyright : (C) 2008 by Dennis Kasprzyk
12 * E-mail : onestone@opencompositing.org
13 *
14 *
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License
17 * as published by the Free Software Foundation; either version 2
18 * of the License, or (at your option) any later version.
19 *
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 */
26
27#include "trip.h"
28
29COMPIZ_PLUGIN_20090315 (trip, TripPluginVTable);
30
31void
32TripScreen::cleanup ()
33{
34 if (program)
35 {
36 GL::deletePrograms (1, &program);
37 program = 0;
38 }
39}
40
41bool
42TripScreen::loadFragmentProgram ()
43{
44 char buffer[1024];
45 GLsizei bufSize;
46 GLint errorPos;
47
48 if (!GL::fragmentProgram)
49 return false;
50
51 if (target == GL_TEXTURE_2D)
52 sprintf (buffer, rippleFpString, "2D");
53 else
54 sprintf (buffer, rippleFpString, "RECT");
55
56 /* clear errors */
57 glGetError ();
58
59 if (!program)
60 GL::genPrograms (1, &program);
61
62 bufSize = (GLsizei) strlen (buffer);
63
64 GL::bindProgram (GL_FRAGMENT_PROGRAM_ARB, program);
65 GL::programString (GL_FRAGMENT_PROGRAM_ARB,
66 GL_PROGRAM_FORMAT_ASCII_ARB,
67 bufSize, buffer);
68
69 glGetIntegerv (GL_PROGRAM_ERROR_POSITION_ARB, &errorPos);
70 if (glGetError () != GL_NO_ERROR || errorPos != -1)
71 {
72 compLogMessage ("trip", CompLogLevelError,
73 "failed to load fragment program");
74
75 GL::deletePrograms (1, &program);
76 program = 0;
77
78 return false;
79 }
80 GL::bindProgram (GL_FRAGMENT_PROGRAM_ARB, 0);
81
82 return true;
83}
84
85void
86TripScreen::optionChanged (CompOption *opt,
87 Options num)
88{
89 cleanup ();
90 loadFragmentProgram ();
91
92 quiet = true;
93
94 cScreen->damageScreen ();
95}
96
97int
98TripScreen::adjustZoom (float chunk, Ripple &r)
99{
100 float dx, adjust, amount;
101 float change;
102
103 dx = r.zTarget - r.zoom;
104
105 adjust = dx * 0.15f;
106 amount = fabs(dx) * 1.5f;
107 if (amount < 0.2f)
108 amount = 0.2f;
109 else if (amount > 2.0f)
110 amount = 2.0f;
111
112 r.zVelocity = (amount * r.zVelocity + adjust) / (amount + 1.0f);
113
114 if (fabs (dx) < 0.002f && fabs (r.zVelocity) < 0.004f)
115 {
116 r.zVelocity = 0.0f;
117 r.zoom = r.zTarget;
118 return false;
119 }
120
121 change = r.zVelocity * chunk;
122 if (!change)
123 {
124 if (r.zVelocity)
125 change = (dx > 0) ? 0.01 : -0.01;
126 }
127
128 r.zoom += change;
129
130 return true;
131}
132
133void
134TripScreen::preparePaint (int time)
135{
136 /* Be careful not to allow too much intensity.
137 * Otherwise, we might have a bad trip ;-) */
138 if (intensity > 70)
139 intensity = 70;
140
141 for (unsigned int i = 0; i < ripples.size (); i++)
142 {
143 int steps;
144 float amount, chunk;
145
146 amount = time * 0.35f * optionGetSpeed ();
147 steps = amount / (0.5f * optionGetTimestep ());
148
149 if (!steps)
150 steps = 1;
151
152 chunk = amount / (float) steps;
153
154 while (steps--)
155 {
156 ripples.at (i).adjust = adjustZoom (chunk, ripples.at (i));
157 if (ripples.at (i).adjust)
158 break;
159 }
160
161 TRIP_SCREEN (screen);
162
163 /* Compute a 0.0 - 1.0 representation of the animation timeline */
164 float progress = (float) (ripples.at (i).duration -
165 ripples.at (i).timer) /
166 (float) ripples.at (i).duration;
167 if (progress <= 0.5f)
168 {
169 ripples.at (i).timer -= (ts->quiet ? (time * 2) : (time / 4));
170 ripples.at (i).zTarget = (MIN (10.0, (progress * 2) * 10.0)) + 1.0;
171 }
172 else
173 { ripples.at (i).timer -= (ts->quiet ? (time * 3) : (time / 5));
174 ripples.at (i).zTarget = (MIN (10.0, (2.0 - (progress * 2)) * 10.0)) + 1.0;
175 }
176
177 if (ts->quiet)
178 {
179 intensity *= 0.8;
180
181 if (ripples.at (i).timer > 8000)
182 ripples.at (i).timer *= 0.8;
183 }
184
185 ripples.at (i).zTarget *= (intensity * 0.01);
186 ripples.at (i).radius += ripples.at (i).rMod;
187 }
188 cScreen->preparePaint (time);
189 cScreen->damageScreen ();
190}
191
192void
193TripScreen::donePaint ()
194{
195 glEnable (target);
196
197 glBindTexture (target, texture);
198
199 glTexImage2D (target, 0, GL_RGB, 0, 0, 0,
200 GL_RGB, GL_UNSIGNED_BYTE, NULL);
201
202 glBindTexture (target, 0);
203
204 glDisable (target);
205
206 for (unsigned int i = 0; i < ripples.size (); i++)
207 {
208 ripples.at (i).width = 0;
209 ripples.at (i).height = 0;
210
211 if (ripples.at (i).zoom <= 1.0)
212 {
213 if (!quiet)
214 ripples.at (i). spawnRandom ();
215 else
216 ripples.erase (ripples.begin () + i);
217 }
218 }
219
220 if (ripples.empty ())
221 {
222 ripples.clear ();
223 cScreen->preparePaintSetEnabled (this, false);
224 cScreen->donePaintSetEnabled (this, false);
225 gScreen->glPaintOutputSetEnabled (this, false);
226 }
227
228 cScreen->damageScreen ();
229
230 cScreen->donePaint ();
231}
232
233void
234Ripple::paint ()
235{
236
237 TRIP_SCREEN (screen);
238
239 float pw, ph;
240 float fZoom, base;
241 int x1, x2, y1, y2;
242 float vc[4];
243 int size;
244
245 width = height = 0;
246
247 base = 0.5 + (0.0015 * radius);
248 fZoom = (zoom * base) + 1.0 - base;
249
250 size = radius + 1;
251
252 x1 = MAX (0.0, coord.x () - size);
253 x2 = MIN (screen->width (), coord.x () + size);
254 y1 = MAX (0.0, coord.y () - size);
255 y2 = MIN (screen->height (), coord.y () + size);
256
257 glEnable (ts->target);
258
259 glBindTexture (ts->target, ts->texture);
260
261 if (width != 2 * size || height != 2 * size)
262 {
263 glCopyTexImage2D(ts->target, 0, GL_RGB, x1, screen->height () - y2,
264 size * 2, size * 2, 0);
265 width = height = 2 * size;
266 }
267 else
268 glCopyTexSubImage2D (ts->target, 0, 0, 0,
269 x1, screen->height () - y2, x2 - x1, y2 - y1);
270
271 if (ts->target == GL_TEXTURE_2D)
272 {
273 pw = 1.0 / width;
274 ph = 1.0 / height;
275 }
276 else
277 {
278 pw = 1.0;
279 ph = 1.0;
280 }
281
282 glMatrixMode (GL_PROJECTION);
283 glPushMatrix ();
284 glLoadIdentity ();
285 glMatrixMode (GL_MODELVIEW);
286 glPushMatrix ();
287 glLoadIdentity ();
288
289 glColor4usv (defaultColor);
290
291 glEnable (GL_FRAGMENT_PROGRAM_ARB);
292 GL::bindProgram (GL_FRAGMENT_PROGRAM_ARB, ts->program);
293
294 GL::programEnvParameter4f (GL_FRAGMENT_PROGRAM_ARB, 0,
295 coord.x (), screen->height () - coord.y (),
296 1.0 / radius, 0.0f);
297 GL::programEnvParameter4f (GL_FRAGMENT_PROGRAM_ARB, 1,
298 pw, ph, M_PI / radius,
299 (fZoom - 1.0) * fZoom);
300 GL::programEnvParameter4f (GL_FRAGMENT_PROGRAM_ARB, 2,
301 -x1 * pw, -(screen->height () - y2) * ph,
302 -M_PI / 2.0, 0.0);
303
304 x1 = MAX (0.0, coord.x () - radius);
305 x2 = MIN (screen->width (), coord.x () + radius);
306 y1 = MAX (0.0, coord.y () - radius);
307 y2 = MIN (screen->height (), coord.y () + radius);
308
309 vc[0] = ((x1 * 2.0) / screen->width ()) - 1.0;
310 vc[1] = ((x2 * 2.0) / screen->width ()) - 1.0;
311 vc[2] = ((y1 * -2.0) / screen->height ()) + 1.0;
312 vc[3] = ((y2 * -2.0) / screen->height ()) + 1.0;
313
314 y1 = screen->height () - y1;
315 y2 = screen->height () - y2;
316
317 glBegin (GL_QUADS);
318 glTexCoord2f (x1, y1);
319 glVertex2f (vc[0], vc[2]);
320 glTexCoord2f (x1, y2);
321 glVertex2f (vc[0], vc[3]);
322 glTexCoord2f (x2, y2);
323 glVertex2f (vc[1], vc[3]);
324 glTexCoord2f (x2, y1);
325 glVertex2f (vc[1], vc[2]);
326 glEnd ();
327
328 glDisable (GL_FRAGMENT_PROGRAM_ARB);
329
330 glColor4usv (defaultColor);
331
332 glPopMatrix();
333 glMatrixMode (GL_PROJECTION);
334 glPopMatrix ();
335 glMatrixMode (GL_MODELVIEW);
336
337 glBindTexture (ts->target, 0);
338
339 glDisable (ts->target);
340}
341
342
343bool
344TripScreen::glPaintOutput (const GLScreenPaintAttrib &attrib,
345 const GLMatrix &transform,
346 const CompRegion &region,
347 CompOutput *output,
348 unsigned int mask)
349{
350 bool status = gScreen->glPaintOutput (attrib, transform, region, output, mask);
351
352 if (ripples.empty ())
353 return status;
354
355 /* Temporarily set the viewport to fullscreen */
356 glViewport (0, 0, screen->width (), screen->height ());
357
358 for (unsigned int i = 0; i < ripples.size (); i++)
359 ripples.at (i).paint ();
360
361 gScreen->setDefaultViewport ();
362
363 return status;
364}
365
366void
367Ripple::spawnRandom ()
368{
369 TRIP_SCREEN (screen);
370
371 ts->cleanup ();
372 ts->loadFragmentProgram ();
373
374 radius = MAX (100, (rand () % ts->optionGetMaxRadius ()));
375 zoom = 1.0f;
376
377 rMod = (rand () % 3);
378
379 coord.setX (rand () % screen->width ());
380 coord.setY (rand () % screen->height ());
381
382
383 width = 0;
384 height = 0;
385
386 int x, y, w, h;
387
388 x = MAX (0.0, coord.x () - radius);
389 y = MAX (0.0, coord.y () - radius);
390 w = MIN (screen->width (), coord.x () + radius) - x;
391 h = MIN (screen->height (), coord.y () + radius) - y;
392
393 damageRect.setGeometry (x, y, w, h);
394
395 zTarget = MAX (1.0, MIN (10.0, (rand () % 10)));
396
397 duration = MAX(3000, (rand () % (ts->optionGetMaxDuration () * 1000)));
398 timer = duration;
399 adjust = true;
400
401}
402
403void
404TripScreen::populateRippleSet ()
405{
406
407 ripples.clear ();
408 intensity = 30;
409 for (int i = 0; i < optionGetMaxRipples (); i++)
410 {
411 ripples.push_back (Ripple ());
412 ripples.at (i). spawnRandom ();
413 }
414}
415
416bool
417TripScreen::takeHit (CompAction *action,
418 CompAction::State state,
419 CompOption::Vector options)
420{
421 intensity += 5;
422
423 if (quiet)
424 populateRippleSet ();
425
426 quiet = false;
427
428 /* Trip mode starting */
429 cScreen->preparePaintSetEnabled (this, true);
430 cScreen->donePaintSetEnabled (this, true);
431 gScreen->glPaintOutputSetEnabled (this, true);
432 return true;
433}
434
435bool
436TripScreen::untensify (CompAction *action,
437 CompAction::State state,
438 CompOption::Vector options)
439{
440 intensity -= 5;
441
442 if (intensity < 15)
443 quiet = true;
444
445 return true;
446}
447
448bool
449TripScreen::intensify (CompAction *action,
450 CompAction::State state,
451 CompOption::Vector options)
452{
453 intensity += 2;
454 cScreen->damageScreen ();
455
456 if (quiet)
457 populateRippleSet ();
458
459 quiet = false;
460
461 /* Trip mode starting */
462 cScreen->preparePaintSetEnabled (this, true);
463 cScreen->donePaintSetEnabled (this, true);
464 gScreen->glPaintOutputSetEnabled (this, true);
465 return true;
466}
467
468bool
469TripScreen::soberUp (CompAction *action,
470 CompAction::State state,
471 CompOption::Vector options)
472{
473 /* Time to end ripples quickly */
474 quiet = true;
475
476 intensity -= 5;
477
478 cScreen->damageScreen ();
479
480 return true;
481}
482
483TripScreen::TripScreen (CompScreen *screen) :
484 PluginClassHandler <TripScreen, CompScreen> (screen),
485 cScreen (CompositeScreen::get (screen)),
486 gScreen (GLScreen::get (screen)),
487 program (0),
488 quiet (false),
489 intensity (25)
490{
491 ScreenInterface::setHandler (screen, false);
492 CompositeScreenInterface::setHandler (cScreen, false);
493 GLScreenInterface::setHandler (gScreen, false);
494
495
496 glGenTextures (1, &texture);
497
498 if (GL::textureNonPowerOfTwo)
499 target = GL_TEXTURE_2D;
500 else
501 target = GL_TEXTURE_RECTANGLE_ARB;
502
503 glEnable (target);
504
505 /* Bind the texture */
506 glBindTexture (target, texture);
507
508 /* Load the parameters */
509 glTexParameteri (target, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
510 glTexParameteri (target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
511 glTexParameteri (target, GL_TEXTURE_WRAP_S, GL_CLAMP);
512 glTexParameteri (target, GL_TEXTURE_WRAP_T, GL_CLAMP);
513
514 glTexImage2D (target, 0, GL_RGB, 0, 0, 0,
515 GL_RGB, GL_UNSIGNED_BYTE, NULL);
516
517 glBindTexture (target, 0);
518
519 glDisable (target);
520
521 optionSetMaxRadiusNotify (boost::bind (&TripScreen::optionChanged, this, _1, _2));
522 optionSetMaxRipplesNotify (boost::bind (&TripScreen::optionChanged, this, _1, _2));
523 optionSetMaxDurationNotify (boost::bind (&TripScreen::optionChanged, this, _1, _2));
524 optionSetZoomFactorNotify (boost::bind (&TripScreen::optionChanged, this, _1, _2));
525 optionSetSpeedNotify (boost::bind (&TripScreen::optionChanged, this, _1, _2));
526 optionSetTimestepNotify (boost::bind (&TripScreen::optionChanged, this, _1, _2));
527
528 optionSetTakeHitInitiate (boost::bind (&TripScreen::takeHit, this, _1, _2,
529 _3));
530
531 optionSetDecreaseIntensityInitiate (boost::bind (&TripScreen::untensify, this, _1, _2,
532 _3));
533
534 optionSetIncreaseIntensityInitiate (boost::bind (&TripScreen::intensify, this, _1, _2,
535 _3));
536
537 optionSetSoberKeyInitiate (boost::bind (&TripScreen::soberUp, this, _1, _2,
538 _3));
539
540 optionSetSoberButtonInitiate (boost::bind (&TripScreen::soberUp, this, _1, _2,
541 _3));
542
543 populateRippleSet ();
544
545 if (!GL::fragmentProgram || !loadFragmentProgram ())
546 compLogMessage ("trip", CompLogLevelWarn,
547 "GL_ARB_fragment_program not supported. "
548 "This plugin will not work.");
549}
550
551TripScreen::~TripScreen ()
552{
553 cScreen->damageScreen ();
554
555 glDeleteTextures (1, &target);
556
557 ripples.clear ();
558}
559
560Ripple::Ripple () :
561 dScreen (TripScreen::get (screen))
562{
563}
564
565Ripple::~Ripple ()
566{
567}
568
569bool
570TripPluginVTable::init ()
571{
572 if (!CompPlugin::checkPluginABI ("core", CORE_ABIVERSION) ||
573 !CompPlugin::checkPluginABI ("composite", COMPIZ_COMPOSITE_ABI) ||
574 !CompPlugin::checkPluginABI ("opengl", COMPIZ_OPENGL_ABI))
575 return false;
576
577 return true;
578}
0579
=== added file 'plugins/trip/src/trip.h'
--- plugins/trip/src/trip.h 1970-01-01 00:00:00 +0000
+++ plugins/trip/src/trip.h 2012-07-04 19:03:18 +0000
@@ -0,0 +1,192 @@
1/*
2 *
3 * Compiz trip plugin
4 *
5 * trip.h
6 *
7 * Copyright : (C) 2010 by Scott Moreau
8 * E-mail : oreaus@gmail.com
9 *
10 * Based off the mag plugin by :
11 * Copyright : (C) 2008 by Dennis Kasprzyk
12 * E-mail : onestone@opencompositing.org
13 *
14 *
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License
17 * as published by the Free Software Foundation; either version 2
18 * of the License, or (at your option) any later version.
19 *
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 */
26
27#include <cmath>
28
29#include <core/core.h>
30#include <composite/composite.h>
31#include <opengl/opengl.h>
32
33#include "trip_options.h"
34
35#define TRIP_SCREEN(s) \
36 TripScreen *ts = TripScreen::get (s)
37
38class Ripple;
39
40class TripScreen :
41 public PluginClassHandler <TripScreen, CompScreen>,
42 public TripOptions,
43 public ScreenInterface,
44 public CompositeScreenInterface,
45 public GLScreenInterface
46{
47 public:
48 TripScreen (CompScreen *screen);
49 ~TripScreen ();
50
51 CompositeScreen *cScreen;
52 GLScreen *gScreen;
53
54 std::vector <Ripple> ripples;
55
56 GLuint texture;
57 GLenum target;
58
59 GLuint program;
60
61 bool quiet;
62
63 unsigned int intensity;
64
65 bool
66 checkStateTimeout ();
67
68 void
69 preparePaint (int ms);
70
71 bool
72 glPaintOutput (const GLScreenPaintAttrib &attrib,
73 const GLMatrix &transform,
74 const CompRegion &region,
75 CompOutput *output,
76 unsigned int mask);
77
78 void
79 donePaint ();
80
81 void
82 cleanup ();
83
84 bool
85 loadFragmentProgram ();
86
87 void
88 optionChanged (CompOption *opt,
89 Options num);
90
91 void
92 positionUpdate (const CompPoint &pos);
93
94 int
95 adjustZoom (float chunk, Ripple &r);
96
97 bool
98 terminate (CompAction *action,
99 CompAction::State state,
100 CompOption::Vector options);
101
102 bool
103 takeHit (CompAction *action,
104 CompAction::State state,
105 CompOption::Vector options);
106
107 bool
108 untensify (CompAction *action,
109 CompAction::State state,
110 CompOption::Vector options);
111
112 bool
113 intensify (CompAction *action,
114 CompAction::State state,
115 CompOption::Vector options);
116
117 bool
118 soberUp (CompAction *action,
119 CompAction::State state,
120 CompOption::Vector options);
121
122 void populateRippleSet ();
123
124};
125
126class Ripple
127{
128 public:
129 Ripple ();
130 ~Ripple ();
131
132 TripScreen *dScreen;
133
134 int radius;
135 int rMod;
136
137 CompPoint coord;
138
139 int duration;
140 int timer;
141
142 int width;
143 int height;
144
145 GLfloat zVelocity;
146 GLfloat zTarget;
147 GLfloat zoom;
148
149 bool adjust;
150
151 CompRect damageRect;
152
153 void paint ();
154 void spawnRandom ();
155};
156
157class TripPluginVTable :
158 public CompPlugin::VTableForScreen <TripScreen>
159{
160 public:
161 bool init ();
162};
163
164static const char *rippleFpString =
165 "!!ARBfp1.0"
166
167 "PARAM p0 = program.env[0];"
168 "PARAM p1 = program.env[1];"
169 "PARAM p2 = program.env[2];"
170
171 "TEMP t0, t1, t2, t3;"
172
173 "SUB t1, p0.xyww, fragment.texcoord[0];"
174 "DP3 t2, t1, t1;"
175 "RSQ t2, t2.x;"
176 "SUB t0, t2, p0;"
177
178 "RCP t3, t2.x;"
179 "MAD t3, t3, p1.z, p2.z;"
180 "COS t3, t3.x;"
181
182 "MUL t3, t3, p1.w;"
183
184 "MUL t1, t2, t1;"
185 "MAD t1, t1, t3, fragment.texcoord[0];"
186
187 "CMP t1, t0.z, fragment.texcoord[0], t1;"
188
189 "MAD t1, t1, p1, p2;"
190 "TEX result.color, t1, texture[0], %s;"
191
192 "END";
0193
=== added file 'plugins/trip/trip.xml.in'
--- plugins/trip/trip.xml.in 1970-01-01 00:00:00 +0000
+++ plugins/trip/trip.xml.in 2012-07-04 19:03:18 +0000
@@ -0,0 +1,103 @@
1<?xml version="1.0"?>
2<compiz>
3 <plugin name="trip" useBcop="true">
4 <_short>Trip</_short>
5 <_long>Trips out desktops</_long>
6 <category>Effects</category>
7 <deps>
8 <relation type="after">
9 <plugin>composite</plugin>
10 <plugin>opengl</plugin>
11 <plugin>cube</plugin>
12 <plugin>decor</plugin>
13 </relation>
14 <requirement>
15 <plugin>opengl</plugin>
16 </requirement>
17 </deps>
18 <options>
19 <group>
20 <_short>Bindings</_short>
21 <option name="take_hit" type="key">
22 <_short>Take Hit</_short>
23 <_long>Take another hit</_long>
24 <default>&lt;Super&gt;&lt;Alt&gt;h</default>
25 </option>
26 <option name="decrease_intensity" type="key">
27 <_short>Decrease intensity</_short>
28 <_long>Come down some</_long>
29 <default>&lt;Super&gt;&lt;Alt&gt;d</default>
30 </option>
31 <option name="increase_intensity" type="button">
32 <_short>Increase effect</_short>
33 <_long>Increase intensity of effect</_long>
34 <default>&lt;Super&gt;&lt;Alt&gt;Button4</default>
35 </option>
36 <option name="sober_key" type="key">
37 <_short>Stop effect</_short>
38 <_long>Stops tripping</_long>
39 <default>&lt;Super&gt;&lt;Alt&gt;s</default>
40 </option>
41 <option name="sober_button" type="button">
42 <_short>Stop effect</_short>
43 <_long>Stops tripping</_long>
44 <default>&lt;Super&gt;&lt;Alt&gt;Button5</default>
45 </option>
46 </group>
47 <group>
48 <_short>General</_short>
49 <subgroup>
50 <_short>Effect Settings</_short>
51 <option name="max_radius" type="int">
52 <_short>Radius</_short>
53 <_long>Radius of the magnification area.</_long>
54 <default>225</default>
55 <min>100</min>
56 <max>1000</max>
57 </option>
58 <option name="max_ripples" type="int">
59 <_short>Ripples</_short>
60 <_long>Maximum number of ripples on screen at any given time.</_long>
61 <default>40</default>
62 <min>1</min>
63 <max>100</max>
64 </option>
65 <option name="max_duration" type="int">
66 <_short>Duration</_short>
67 <_long>Maximum length of time in seconds for a given ripple.</_long>
68 <default>8</default>
69 <min>3</min>
70 <max>30</max>
71 </option>
72 </subgroup>
73 <subgroup>
74 <_short>Internal Settings</_short>
75 <option name="zoom_factor" type="float">
76 <_short>Zoom</_short>
77 <_long>Zoom factor for keyboard initiated magnifier.</_long>
78 <default>2.0</default>
79 <min>1.1</min>
80 <max>32.0</max>
81 <precision>0.1</precision>
82 </option>
83 <option name="speed" type="float">
84 <_short>Speed</_short>
85 <_long>Zoom Speed</_long>
86 <default>1.5</default>
87 <min>0.1</min>
88 <max>50</max>
89 <precision>0.1</precision>
90 </option>
91 <option name="timestep" type="float">
92 <_short>Timestep</_short>
93 <_long>Zoom Timestep</_long>
94 <default>1.2</default>
95 <min>0.1</min>
96 <max>50</max>
97 <precision>0.1</precision>
98 </option>
99 </subgroup>
100 </group>
101 </options>
102 </plugin>
103</compiz>

Subscribers

People subscribed via source and target branches