Merge lp:~mc-return/compiz/compiz.merge-plugin-animationjc into lp:compiz/0.9.10

Proposed by MC Return
Status: Work in progress
Proposed branch: lp:~mc-return/compiz/compiz.merge-plugin-animationjc
Merge into: lp:compiz/0.9.10
Diff against target: 1369 lines (+1311/-0)
11 files modified
plugins/animationjc/CMakeLists.txt (+7/-0)
plugins/animationjc/animationjc.xml.in (+154/-0)
plugins/animationjc/compiz-animationjc.pc.in (+12/-0)
plugins/animationjc/include/animationjc/animationjc.h (+343/-0)
plugins/animationjc/src/animationjc.cpp (+145/-0)
plugins/animationjc/src/blackhole.cpp (+79/-0)
plugins/animationjc/src/flicker.cpp (+96/-0)
plugins/animationjc/src/ghost.cpp (+98/-0)
plugins/animationjc/src/popcorn.cpp (+60/-0)
plugins/animationjc/src/private.h (+232/-0)
plugins/animationjc/src/raindrop.cpp (+85/-0)
To merge this branch: bzr merge lp:~mc-return/compiz/compiz.merge-plugin-animationjc
Reviewer Review Type Date Requested Status
Daniel van Vugt Pending
Sam Spilsbury Pending
Review via email: mp+156686@code.launchpad.net

This proposal supersedes a proposal from 2012-06-17.

Commit message

Added the unsupported, but fully working plug-in "animationjc" converted from git to bzr (including history) to lp:compiz.

Description of the change

Adds the unsupported, but fully working plug-in "animationjc" converted from git to bzr (including history) to Compiz 0.9.8.

To post a comment you must log in.
Revision history for this message
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

I feel like animationjc and animationextra should probably be merged into either animation or animationaddon. Two less plugins to maintain. Thoughts?

Revision history for this message
MC Return (mc-return) wrote : Posted in a previous version of this proposal

Black Hole, Flicker, Ghost, Popcorn & Raindrop

Revision history for this message
MC Return (mc-return) wrote : Posted in a previous version of this proposal

Sam, I would fully agree on that.
I have a few other ideas regarding the simplification and optimization of CCSM in general as well: For example hiding plug-ins that depend on other plug-ins and make no sense being shown in CCSM and just confuse the user (like hiding all cube-related plug-ins in CCSM if the cube is disabled for example), but that is offtopic here and requires some other place of discussion I guess ;)

Revision history for this message
MC Return (mc-return) wrote : Posted in a previous version of this proposal

There is another animations-plug-in that is missing, but currently crashes latest Compiz versions (but did already work in 0.9.x series). It is called simple-animations (Animations that are easy on the eyes). What should we do with that one, Sam ?

Revision history for this message
MC Return (mc-return) wrote : Posted in a previous version of this proposal

I guess animations-add-on was just separated to introduce and define a "Animation Time Step For Intense Effects" which can differ from the "Animation Time Step" usually used, but this function could be moved to one plug-in also, so it won't get lost...

Revision history for this message
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

Animationaddon exist so that distributions don't have to ship huge binaries of stuff they don't use ;-)

In any case, I'll get around to looking at the best way to approach this soon. It will take a low priority though over the next few weeks since we really need to ramp up efforts to fix up the OpenGL|ES work before I go on holiday since I won't even have a computer -.- .

Revision history for this message
MC Return (mc-return) wrote : Posted in a previous version of this proposal

Thanks for looking into that issue.
Unfortunately I found out that exactly those plug-ins here, which I merged first, do not seem to work with latest Compiz 0.9.7.8 anymore. :(
I can enable "Animations Experimental" and change settings, but when I select one of those 5 plug-ins (Black Hole, Flicker, Ghost, Popcorn & Raindrop) in "Animations" (for the Open-animation for example) they simply do not work. They do not crash Compiz, but they seem to not be executed either. :(

Revision history for this message
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal

This branch keeps failing to build (when merged with lp:compiz)

In file included from /home/dan/bzr/compiz/tmp.jc/plugins/animationjc/src/popcorn.cpp:1:0:
/home/dan/bzr/compiz/tmp.jc/plugins/animationjc/src/private.h:6:33: fatal error: composite/composite.h: No such file or directory
compilation terminated.

review: Needs Fixing
Revision history for this message
MC Return (mc-return) wrote : Posted in a previous version of this proposal

I tried to investigate what exactly is the problem here, but did not find out yet.
The strange thing about this error is that composite/composite.h should exist and the other animation plug-ins use almost the same code.
Another strangeness here is the fact that it compiles as standalone plug-in (but does not work then), but does not compile when merged with lp:compiz.

Revision history for this message
MC Return (mc-return) wrote : Posted in a previous version of this proposal

The PLUGINDEPS opengl and composite are missing to fix compilation here.

Unfortunately I am having problems to upload to launchpad since a few days, I hope I'll be able to fix this soonish though.

Revision history for this message
Sam Spilsbury (smspillaz) wrote :

Hey just wanted to say thanks for working on this! It seems like a lot of plugins were lost when git.compiz.org went down, so this is the only mirror I've been able to find of them.

Unmerged revisions

3254. By MC Return

Fixed [-Werror=maybe-uninitialized] compiler warning for the float 'displacement'

3253. By MC Return

Removed plugins/animationjc/VERSION

3252. By MC Return

Added missing PLUGINDEPS composite and opengl to CMakeLists.txt to fix compilation

3251. By MC Return

Rebased on latest lp:compiz (r3285)

3250. By MC Return

Added the unsupported, but fully working plug-in "animationjc" converted from git to bzr (including history) to Compiz 0.9.8.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'plugins/animationjc'
2=== added file 'plugins/animationjc/CMakeLists.txt'
3--- plugins/animationjc/CMakeLists.txt 1970-01-01 00:00:00 +0000
4+++ plugins/animationjc/CMakeLists.txt 2013-04-02 20:51:55 +0000
5@@ -0,0 +1,7 @@
6+find_package (Compiz REQUIRED)
7+include (CompizPlugin)
8+include (FindOpenGL)
9+
10+if (OPENGL_GLU_FOUND)
11+ compiz_plugin (animationjc PLUGINDEPS composite opengl animation LIBRARIES ${OPENGL_glu_LIBRARY} INCDIRS ${OPENGL_INCLUDE_DIR})
12+endif (OPENGL_GLU_FOUND)
13
14=== added file 'plugins/animationjc/animationjc.xml.in'
15--- plugins/animationjc/animationjc.xml.in 1970-01-01 00:00:00 +0000
16+++ plugins/animationjc/animationjc.xml.in 2013-04-02 20:51:55 +0000
17@@ -0,0 +1,154 @@
18+<compiz>
19+ <!-- animationaddon metadata -->
20+ <plugin name="animationjc" useBcop="true">
21+ <_short>Animations Experimental</_short>
22+ <_long>Extra window animations</_long>
23+ <category>Effects</category>
24+ <deps>
25+ <requirement>
26+ <plugin>opengl</plugin>
27+ <plugin>animation</plugin>
28+ </requirement>
29+ <relation type="after">
30+ <plugin>opengl</plugin>
31+ <plugin>composite</plugin>
32+ <plugin>animation</plugin>
33+ <plugin>decor</plugin>
34+ </relation>
35+ </deps>
36+
37+ <options>
38+ <group>
39+ <_short>Effect Settings</_short>
40+
41+ <subgroup>
42+ <_short>Black Hole</_short>
43+ <option name="blackhole_delay" type="float">
44+ <_short>Delay</_short>
45+ <default>0.75</default>
46+ <min>0.0</min>
47+ <max>0.99</max>
48+ <precision>0.01</precision>
49+ </option>
50+ </subgroup>
51+
52+ <subgroup>
53+ <_short>Flicker</_short>
54+ <option name="flicker_amplitude" type="int">
55+ <_short>Amplitude</_short>
56+ <default>3</default>
57+ <min>1</min>
58+ <max>10</max>
59+ </option>
60+ </subgroup>
61+
62+ <subgroup>
63+ <_short>Ghost</_short>
64+ <option name="ghost_grid" type="int">
65+ <_short>Grid</_short>
66+ <default>20</default>
67+ <min>2</min>
68+ <max>20</max>
69+ </option>
70+
71+ <option name="ghost_saturation" type="float">
72+ <_short>Saturation</_short>
73+ <default>0.0</default>
74+ <min>0.0</min>
75+ <max>1.0</max>
76+ <precision>0.1</precision>
77+ </option>
78+
79+ <option name="ghost_amplitude" type="float">
80+ <_short>Amplitude</_short>
81+ <default>1.0</default>
82+ <min>0.0</min>
83+ <max>5.0</max>
84+ </option>
85+
86+ <option name="ghost_wave_speed" type="float">
87+ <_short>Wave Speed</_short>
88+ <default>1.0</default>
89+ <min>0.0</min>
90+ <max>5.0</max>
91+ </option>
92+ </subgroup>
93+
94+ <subgroup>
95+ <_short>Popcorn</_short>
96+ <option name="popcorn_kernel_height" type="float">
97+ <_short>Kernel Height</_short>
98+ <default>1.0</default>
99+ <min>0.0</min>
100+ <max>5.0</max>
101+ <precision>0.1</precision>
102+ </option>
103+ </subgroup>
104+
105+ <subgroup>
106+ <_short>Raindrop</_short>
107+
108+ <option name="raindrop_amplitude" type="float">
109+ <_short>Amplitude</_short>
110+ <default>1.0</default>
111+ <min>-5.0</min>
112+ <max>5.0</max>
113+ <precision>0.1</precision>
114+ </option>
115+
116+ <option name="raindrop_wavelength" type="float">
117+ <_short>Wavelength</_short>
118+ <default>0.4</default>
119+ <min>0.0</min>
120+ <max>1.0</max>
121+ <precision>0.05</precision>
122+ </option>
123+
124+ <option name="raindrop_num_waves" type="int">
125+ <_short>Number of Waves</_short>
126+ <default>1</default>
127+ <min>1</min>
128+ <max>5</max>
129+ </option>
130+ </subgroup>
131+ </group>
132+ </options>
133+
134+ <extension base_plugin="animation">
135+ <base_option>open_effects</base_option>
136+ <base_option>open_random_effects</base_option>
137+ <base_option>close_effects</base_option>
138+ <base_option>close_random_effects</base_option>
139+ <base_option>minimize_effects</base_option>
140+ <base_option>minimize_random_effects</base_option>
141+ <restriction>
142+ <value>animationjc:Black Hole</value>
143+ <_name>Black Hole</_name>
144+ </restriction>
145+ <restriction>
146+ <value>animationjc:Ghost</value>
147+ <_name>Ghost</_name>
148+ </restriction>
149+ <restriction>
150+ <value>animationjc:Popcorn</value>
151+ <_name>Popcorn</_name>
152+ </restriction>
153+ </extension>
154+
155+ <extension base_plugin="animation">
156+ <base_option>open_effects</base_option>
157+ <base_option>open_random_effects</base_option>
158+ <base_option>close_effects</base_option>
159+ <base_option>close_random_effects</base_option>
160+ <base_option>focus_effects</base_option>
161+ <restriction>
162+ <value>animationjc:Flicker</value>
163+ <_name>Flicker</_name>
164+ </restriction>
165+ <restriction>
166+ <value>animationjc:Raindrop</value>
167+ <_name>Raindrop</_name>
168+ </restriction>
169+ </extension>
170+ </plugin>
171+</compiz>
172
173=== added file 'plugins/animationjc/compiz-animationjc.pc.in'
174--- plugins/animationjc/compiz-animationjc.pc.in 1970-01-01 00:00:00 +0000
175+++ plugins/animationjc/compiz-animationjc.pc.in 2013-04-02 20:51:55 +0000
176@@ -0,0 +1,12 @@
177+prefix=@prefix@
178+exec_prefix=@prefix@
179+libdir=@libdir@
180+includedir=@includedir@
181+
182+Name: compiz-animationjc
183+Description: Animation JC plugin for compiz
184+Version: @VERSION@
185+
186+Requires: compiz compiz-composite compiz-opengl compiz-animation
187+Libs: -L${libdir} -lanimationjc
188+Cflags: @COMPIZ_CFLAGS@
189
190=== added directory 'plugins/animationjc/include'
191=== added directory 'plugins/animationjc/include/animationjc'
192=== added file 'plugins/animationjc/include/animationjc/animationjc.h'
193--- plugins/animationjc/include/animationjc/animationjc.h 1970-01-01 00:00:00 +0000
194+++ plugins/animationjc/include/animationjc/animationjc.h 2013-04-02 20:51:55 +0000
195@@ -0,0 +1,343 @@
196+#ifndef _COMPIZ_ANIMATIONJC_H
197+#define _COMPIZ_ANIMATIONJC_H
198+
199+#define ANIMATIONADDON_ABI 20091206
200+
201+#include <core/pluginclasshandler.h>
202+
203+#include <vector>
204+#include <boost/ptr_container/ptr_vector.hpp>
205+
206+using namespace::std;
207+
208+class PrivateAnimJCScreen;
209+
210+/*
211+class AnimJCScreen :
212+ public PluginClassHandler<AnimJCScreen, CompScreen, ANIMATIONADDON_ABI>,
213+ public CompOption::Class
214+{
215+public:
216+ AnimJCScreen (CompScreen *);
217+ ~AnimJCScreen ();
218+
219+ CompOption::Vector &getOptions ();
220+ bool setOption (const CompString &name, CompOption::Value &value);
221+
222+ int getIntenseTimeStep ();
223+
224+private:
225+ PrivateAnimJCScreen *priv;
226+};
227+*/
228+
229+/// Base class for all polygon- and particle-based animations
230+class BaseAddonAnim :
231+ virtual public Animation
232+{
233+public:
234+ BaseAddonAnim (CompWindow *w,
235+ WindowEvent curWindowEvent,
236+ float duration,
237+ const AnimEffect info,
238+ const CompRect &icon);
239+ ~BaseAddonAnim () {}
240+
241+ bool needsDepthTest () { return mDoDepthTest; }
242+
243+protected:
244+ /// Gets info about the extension plugin that implements this animation.
245+ ExtensionPluginInfo *getExtensionPluginInfo ();
246+
247+ int mIntenseTimeStep;
248+
249+ CompositeScreen *mCScreen;
250+ GLScreen *mGScreen;
251+
252+ bool mDoDepthTest; ///< Whether depth testing should be used in the effect
253+};
254+
255+// Particle stuff
256+
257+class Particle
258+{
259+public:
260+ Particle () : life (0.0f) {}
261+
262+ float life; ///< particle life
263+ float fade; ///< fade speed
264+ float width; ///< particle width
265+ float height; ///< particle height
266+ float w_mod; ///< particle size modification during life
267+ float h_mod; ///< particle size modification during life
268+ float r; ///< red value
269+ float g; ///< green value
270+ float b; ///< blue value
271+ float a; ///< alpha value
272+ float x; ///< X position
273+ float y; ///< Y position
274+ float z; ///< Z position
275+ float xi; ///< X direction
276+ float yi; ///< Y direction
277+ float zi; ///< Z direction
278+ float xg; ///< X gravity
279+ float yg; ///< Y gravity
280+ float zg; ///< Z gravity
281+ float xo; ///< orginal X position
282+ float yo; ///< orginal Y position
283+ float zo; ///< orginal Z position
284+};
285+
286+class ParticleSystem
287+{
288+ friend class ParticleAnim;
289+
290+public:
291+ ParticleSystem (int numParticles,
292+ float slowdown,
293+ float darkenAmount,
294+ GLuint blendMode);
295+ ~ParticleSystem ();
296+
297+ void draw (int offsetX = 0, int offsetY = 0);
298+ void update (float time);
299+ vector<Particle> &particles () { return mParticles; }
300+ void activate () { mActive = true; }
301+ bool active () { return mActive; }
302+ void setOrigin (int x, int y) { mX = x; mY = y; }
303+
304+protected:
305+ CompWindow *mWindow;
306+
307+ vector<Particle> mParticles;
308+
309+ float mSlowDown;
310+ float mDarkenAmount;
311+ GLuint mBlendMode;
312+ GLuint mTex;
313+ bool mActive;
314+ int mX, mY;
315+
316+ GLScreen *mGScreen;
317+
318+ vector<GLfloat> mVerticesCache;
319+ vector<GLfloat> mCoordsCache;
320+ vector<GLfloat> mColorsCache;
321+ vector<GLfloat> mDColorsCache;
322+};
323+
324+class ParticleAnim :
325+ public BaseAddonAnim,
326+ public PartialWindowAnim
327+{
328+public:
329+ ParticleAnim (CompWindow *w,
330+ WindowEvent curWindowEvent,
331+ float duration,
332+ const AnimEffect info,
333+ const CompRect &icon);
334+ ~ParticleAnim () {}
335+ void postPaintWindow ();
336+ bool postPaintWindowUsed () { return true; }
337+ void updateBB (CompOutput &output);
338+ bool updateBBUsed () { return true; }
339+ bool prePreparePaint (int msSinceLastPaint);
340+ void initLightDarkParticles (int numLightParticles,
341+ int numDarkParticles,
342+ float lightSlowDown,
343+ float darkSlowDown);
344+
345+protected:
346+ boost::ptr_vector<ParticleSystem> mParticleSystems;
347+};
348+
349+// Polygon stuff
350+
351+typedef enum
352+{
353+ CorrectPerspectiveNone = 0,
354+ CorrectPerspectivePolygon,
355+ CorrectPerspectiveWindow
356+} CorrectPerspective;
357+
358+/// Base class for per-PolygonObject effect parameter classes
359+class PolygonEffectParameters
360+{
361+};
362+
363+/// This is intended to be a closed 3D piece of a window with convex polygon
364+/// faces and quad-strip sides. Since decoration texture is separate from
365+/// the window texture, it is more complicated than it would be with a single
366+/// texture: we use glClipPlane with the rectangles (clips) to clip 3D space
367+/// to the region falling within that clip.
368+/// If the polygon is on an edge/corner, it also has 2D shadow quad(s)
369+/// (to be faded out at the beginning of 3D animation if necessary).
370+class PolygonObject
371+{
372+public:
373+ int nVertices; ///< number of total vertices (front + back)
374+ int nSides; ///< number of sides
375+ GLfloat *vertices; ///< Positions of vertices relative to center
376+ GLushort *sideIndices; ///< Indices of quad strip for "sides"
377+ GLfloat *normals; ///< Surface normals for 2+nSides faces
378+
379+ Boxf boundingBox; ///< Bound. box to test intersection with clips
380+
381+ // Animation effect parameters
382+
383+ Point3d centerPosStart; ///< Starting position of center
384+ float rotAngleStart; ///< Starting rotation angle
385+
386+ Point3d centerPos; ///< Position of center
387+ Vector3d rotAxis; ///< Rotation axis vector
388+ float rotAngle; ///< Rotation angle
389+ Point3d rotAxisOffset; ///< Rotation axis translate amount
390+
391+ Point centerRelPos; ///< Relative pos of center within the window
392+
393+ Vector3d finalRelPos; ///< Velocity factor for scripted movement
394+ float finalRotAng; ///< Final rotation angle around rotAxis
395+
396+ float moveStartTime; ///< Movement starts at this time ([0-1] range)
397+ float moveDuration; ///< Movement lasts this long ([0-1] range)
398+
399+ float fadeStartTime; ///< Fade out starts at this time ([0,1] range)
400+ float fadeDuration; ///< Duration of fade out ([0,1] range)
401+
402+ /** Pointer to a struct that can contain
403+ custom parameters for an individual effect */
404+ PolygonEffectParameters *effectParameters;
405+
406+ float boundSphereRadius; ///< Radius of bounding sphere
407+};
408+
409+/// Info about intersection of a polygon and clip
410+class PolygonClipInfo
411+{
412+public:
413+ PolygonClipInfo (const PolygonObject *p);
414+
415+ const PolygonObject *p; ///< the intersecting polygon-object
416+
417+ /// Texture coord.s for each vertex of the polygon-object
418+ /// ordered as: Front v1.x, y, v2.x, y, ...,
419+ /// followed by back vertex texture coordinates.
420+ vector<GLfloat> vertexTexCoords;
421+};
422+
423+class Clip4Polygons ///< Rectangular clips
424+{ ///< (to hold clips passed to AddWindowGeometry)
425+public:
426+ CompRect box; ///< Coords
427+ Boxf boxf; ///< Float coords (for small clipping adjustment)
428+ GLTexture::Matrix texMatrix;///< Corresponding texture coord. matrix
429+
430+ /// True if this clip likely intersects all polygons
431+ /// (for the window-contents clip). Used for optimization purposes.
432+ bool intersectsMostPolygons;
433+
434+ /// For polygons that intersect this clip.
435+ /// Only used when intersectsMostPolygons is false.
436+ list<PolygonClipInfo *> intersectingPolygonInfos;
437+
438+ /// Texture coord.s for each vertex of each polygon-object
439+ /// ordered as: Front p1.v1.x, y, p1.v2.x, .y, p2.v1.x, .y, ...,
440+ /// followed by back vertex texture coordinates.
441+ /// Only used when intersectsMostPolygons is true.
442+ vector<GLfloat> polygonVertexTexCoords;
443+};
444+
445+class PolygonAnim :
446+ virtual public Animation,
447+ public BaseAddonAnim
448+{
449+public:
450+ PolygonAnim (CompWindow *w,
451+ WindowEvent curWindowEvent,
452+ float duration,
453+ const AnimEffect info,
454+ const CompRect &icon);
455+ ~PolygonAnim ();
456+
457+ void step ();
458+ void prePaintWindow ();
459+ void postPaintWindow ();
460+ bool postPaintWindowUsed () { return true; }
461+ void addGeometry (const GLTexture::MatrixList &matrix,
462+ const CompRegion &region,
463+ const CompRegion &clipRegion,
464+ unsigned int maxGridWidth,
465+ unsigned int maxGridHeight);
466+ void drawGeometry ();
467+ virtual void updateBB (CompOutput &output);
468+ bool updateBBUsed () { return true; }
469+ bool prePreparePaint (int msSinceLastPaint);
470+ bool moveUpdate (int dx, int dy);
471+
472+ virtual void stepPolygon (PolygonObject *p,
473+ float forwardProgress);
474+ virtual void transformPolygon (const PolygonObject *p) {}
475+
476+ /// For effects that have decel. motion
477+ virtual bool deceleratingMotion () { return false; }
478+
479+ bool tessellateIntoRectangles (int gridSizeX,
480+ int gridSizeY,
481+ float thickness);
482+ bool tessellateIntoHexagons (int gridSizeX,
483+ int gridSizeY,
484+ float thickness);
485+ bool tessellateIntoGlass (int gridSizeX,
486+ int gridSizeY,
487+ float thickness);
488+
489+ void prePaintOutput (CompOutput *output);
490+ void deceleratingAnimStepPolygon (PolygonObject *p,
491+ float forwardProgress);
492+
493+protected:
494+ void getPerspectiveCorrectionMat (const PolygonObject *p,
495+ GLfloat *mat,
496+ GLMatrix *matf,
497+ const CompOutput &output);
498+ void processIntersectingPolygons ();
499+ virtual void freePolygonObjects ();
500+ void freeClipsPolygons ();
501+ void prepareDrawingForAttrib (GLFragment::Attrib &attrib);
502+
503+ int mNumDrawGeometryCalls;
504+ int mNumClipsPassed; /**< # of clips passed to animAddWindowGeometry so far
505+ in this draw step */
506+ bool mClipsUpdated; ///< whether stored clips are updated in this anim step
507+
508+ vector<Clip4Polygons> mClips;///< Rect. clips collected in addGeometries
509+ int mFirstNondrawnClip;
510+ vector<int> mLastClipInGroup;/**< Index of the last clip in each group of clips
511+ drawn in drawGeometry func. */
512+
513+ bool mDoLighting; ///< Whether lighting should be used in the effect
514+ CorrectPerspective mCorrectPerspective;
515+
516+ vector<PolygonObject *> mPolygons; ///< The polygons in this set
517+ float mThickness; ///< Window thickness (depth along z axis)
518+ int mNumTotalFrontVertices; ///< Total # of polygon vertices on front faces
519+ float mBackAndSidesFadeDur; ///< How long side and back faces should fade in/out
520+ float mAllFadeDuration; /**< Duration of fade out at the end in [0,1] range
521+ when all polygons fade out at the same time.
522+ If >-1, this overrides fadeDuration in PolygonObject */
523+
524+ bool mIncludeShadows; ///< Whether to include shadows in polygon
525+
526+private:
527+ inline void drawPolygonClipIntersection (const PolygonObject *p,
528+ const Clip4Polygons &c,
529+ const GLfloat *vertexTexCoords,
530+ int pass,
531+ float forwardProgress,
532+ GLdouble clipPlane[4][4],
533+ const CompOutput &output,
534+ float newOpacity,
535+ bool decelerates,
536+ GLfloat skewMat[16]);
537+};
538+#endif
539
540=== added directory 'plugins/animationjc/src'
541=== added file 'plugins/animationjc/src/animationjc.cpp'
542--- plugins/animationjc/src/animationjc.cpp 1970-01-01 00:00:00 +0000
543+++ plugins/animationjc/src/animationjc.cpp 2013-04-02 20:51:55 +0000
544@@ -0,0 +1,145 @@
545+#include "private.h"
546+
547+class AnimJCPluginVTable :
548+ public CompPlugin::VTableForScreenAndWindow<AnimJCScreen, AnimJCWindow>
549+{
550+public:
551+ bool init ();
552+};
553+
554+COMPIZ_PLUGIN_20090315 (animationjc, AnimJCPluginVTable);
555+
556+AnimEffect animEffects[NUM_EFFECTS];
557+
558+ExtensionPluginAnimJC animJCExtPluginInfo (CompString ("animationjc"),
559+ NUM_EFFECTS, animEffects, NULL,
560+ NUM_NONEFFECT_OPTIONS);
561+
562+AnimEffect AnimEffectBlackHole;
563+AnimEffect AnimEffectFlicker;
564+AnimEffect AnimEffectGhost;
565+AnimEffect AnimEffectPopcorn;
566+AnimEffect AnimEffectRaindrop;
567+
568+ExtensionPluginInfo *
569+BaseAddonAnim::getExtensionPluginInfo ()
570+{
571+ return &animJCExtPluginInfo;
572+}
573+
574+BaseAddonAnim::BaseAddonAnim (CompWindow *w,
575+ WindowEvent curWindowEvent,
576+ float duration,
577+ const AnimEffect info,
578+ const CompRect &icon) :
579+ Animation::Animation (w, curWindowEvent, duration, info, icon),
580+ mIntenseTimeStep (AnimJCScreen::get (::screen)->getIntenseTimeStep ()),
581+ mCScreen (CompositeScreen::get (::screen)),
582+ mGScreen (GLScreen::get (::screen)),
583+ mDoDepthTest (false)
584+{
585+}
586+
587+void
588+AnimJCScreen::initAnimationList ()
589+{
590+ int i = 0;
591+
592+ animEffects[i++] = AnimEffectBlackHole =
593+ new AnimEffectInfo ("animationjc:Black Hole",
594+ true, true, true, false, false,
595+ &createAnimation<BlackHoleAnim>);
596+
597+ animEffects[i++] = AnimEffectFlicker =
598+ new AnimEffectInfo ("animationjc:Flicker",
599+ true, true, true, false, true,
600+ &createAnimation<FlickerAnim>);
601+
602+ animEffects[i++] = AnimEffectGhost =
603+ new AnimEffectInfo ("animationjc:Ghost",
604+ true, true, true, false, false,
605+ &createAnimation<GhostAnim>);
606+
607+ animEffects[i++] = AnimEffectPopcorn =
608+ new AnimEffectInfo ("animationjc:Popcorn",
609+ true, true, true, false, false,
610+ &createAnimation<PopcornAnim>);
611+
612+ animEffects[i++] = AnimEffectRaindrop =
613+ new AnimEffectInfo ("animationjc:Raindrop",
614+ true, true, true, false, true,
615+ &createAnimation<RaindropAnim>);
616+
617+ animJCExtPluginInfo.effectOptions = &getOptions ();
618+
619+ AnimScreen *as = AnimScreen::get (::screen);
620+
621+ // Extends animation plugin with this set of animation effects.
622+ as->addExtension (&animJCExtPluginInfo);
623+}
624+
625+PrivateAnimJCScreen::PrivateAnimJCScreen (CompScreen *s) :
626+ mOutput (s->fullscreenOutput ())
627+{
628+}
629+
630+PrivateAnimJCScreen::~PrivateAnimJCScreen ()
631+{
632+ AnimScreen *as = AnimScreen::get (::screen);
633+
634+ as->removeExtension (&animJCExtPluginInfo);
635+
636+ for (int i = 0; i < NUM_EFFECTS; i++)
637+ {
638+ delete animEffects[i];
639+ animEffects[i] = NULL;
640+ }
641+}
642+
643+AnimJCScreen::AnimJCScreen (CompScreen *s) :
644+ PluginClassHandler<AnimJCScreen, CompScreen, ANIMATIONADDON_ABI> (s),
645+ priv (new PrivateAnimJCScreen (s))
646+{
647+ initAnimationList ();
648+}
649+
650+AnimJCScreen::~AnimJCScreen ()
651+{
652+ delete priv;
653+}
654+
655+AnimJCWindow::AnimJCWindow (CompWindow *w) :
656+ PluginClassHandler<AnimJCWindow, CompWindow> (w),
657+ mWindow (w),
658+ aWindow (AnimWindow::get (w))
659+{
660+}
661+
662+AnimJCWindow::~AnimJCWindow ()
663+{
664+ Animation *curAnim = aWindow->curAnimation ();
665+
666+ if (!curAnim)
667+ return;
668+
669+ // We need to interrupt and clean up the animation currently being played
670+ // by animationaddon for this window (if any)
671+ if (curAnim->remainingTime () > 0 &&
672+ curAnim->getExtensionPluginInfo ()->name ==
673+ CompString ("animationjc"))
674+ {
675+ aWindow->postAnimationCleanUp ();
676+ }
677+}
678+
679+bool
680+AnimJCPluginVTable::init ()
681+{
682+ if (!CompPlugin::checkPluginABI ("core", CORE_ABIVERSION) |
683+ !CompPlugin::checkPluginABI ("composite", COMPIZ_COMPOSITE_ABI) |
684+ !CompPlugin::checkPluginABI ("opengl", COMPIZ_OPENGL_ABI) |
685+ !CompPlugin::checkPluginABI ("animation", ANIMATION_ABI))
686+ return false;
687+
688+ return true;
689+}
690
691=== added file 'plugins/animationjc/src/blackhole.cpp'
692--- plugins/animationjc/src/blackhole.cpp 1970-01-01 00:00:00 +0000
693+++ plugins/animationjc/src/blackhole.cpp 2013-04-02 20:51:55 +0000
694@@ -0,0 +1,79 @@
695+#include "private.h"
696+
697+#include <algorithm>
698+
699+BlackHoleAnim::BlackHoleAnim (CompWindow *w,
700+ WindowEvent curWindowEvent,
701+ float duration,
702+ const AnimEffect info,
703+ const CompRect &icon) :
704+ Animation::Animation (w, curWindowEvent, duration, info, icon),
705+ TransformAnim::TransformAnim (w, curWindowEvent, duration, info, icon),
706+ GridTransformAnim::GridTransformAnim (w, curWindowEvent, duration, info,
707+ icon)
708+{
709+}
710+
711+void
712+BlackHoleAnim::initGrid ()
713+{
714+ mGridWidth = 20;
715+ mGridHeight = 20;
716+}
717+
718+void
719+BlackHoleAnim::step ()
720+{
721+ CompRect winRect (mAWindow->savedRectsValid () ?
722+ mAWindow->saveWinRect () :
723+ mWindow->geometry ());
724+ CompRect outRect (mAWindow->savedRectsValid () ?
725+ mAWindow->savedOutRect () :
726+ mWindow->outputRect ());
727+ CompWindowExtents outExtents (mAWindow->savedRectsValid () ?
728+ mAWindow->savedOutExtents () :
729+ mWindow->output ());
730+
731+ int wx = winRect.x ();
732+ int wy = winRect.y ();
733+
734+ int owidth = outRect.width ();
735+ int oheight = outRect.height ();
736+
737+ float centerx = wx + mModel->scale ().x () *
738+ (owidth * 0.5 - outExtents.left);
739+ float centery = wy + mModel->scale ().y () *
740+ (oheight * 0.5 - outExtents.top);
741+
742+ float delay = AnimJCScreen::get (screen)->optionGetBlackholeDelay ();
743+ float tau = (1. - delay) / 8.;
744+
745+ GridModel::GridObject *object = mModel->objects ();
746+ unsigned int n = mModel->numObjects ();
747+ for (unsigned int i = 0; i < n; i++, object++)
748+ {
749+ // find distance to center in grid terms, 0..1
750+ float gridDistance = 2 * max (fabs (object->gridPosition ().x ()-0.5),
751+ fabs (object->gridPosition ().y ()-0.5));
752+
753+ // use that and tau to find r
754+ float cutoff = gridDistance * delay;
755+ float r = 1;
756+ if (getBlackHoleProgress () > cutoff)
757+ r = exp (-(getBlackHoleProgress () - cutoff) / tau);
758+
759+ // find real original coordinates
760+ float origx = wx + mModel->scale ().x () *
761+ (owidth * object->gridPosition ().x () -
762+ outExtents.left);
763+ float origy = wy + mModel->scale ().y () *
764+ (oheight * object->gridPosition ().y () -
765+ outExtents.top);
766+
767+ // shrink toward center by r
768+ Point3d &objPos = object->position ();
769+ objPos.setX ((origx-centerx) * r + centerx);
770+ objPos.setY ((origy-centery) * r + centery);
771+ objPos.setZ (0);
772+ }
773+}
774
775=== added file 'plugins/animationjc/src/flicker.cpp'
776--- plugins/animationjc/src/flicker.cpp 1970-01-01 00:00:00 +0000
777+++ plugins/animationjc/src/flicker.cpp 2013-04-02 20:51:55 +0000
778@@ -0,0 +1,96 @@
779+#include <private.h>
780+
781+void
782+FlickerSingleAnim::updateAttrib (GLWindowPaintAttrib &attrib)
783+{
784+ int layer = MultiAnim <FlickerSingleAnim,5>::getCurrAnimNumber (mAWindow);
785+ float o = 0.2;
786+ attrib.opacity *= o / (1. - (4-layer)*o);
787+}
788+
789+void
790+FlickerSingleAnim::initGrid ()
791+{
792+ mGridWidth = 2;
793+ mGridHeight = 20;
794+}
795+
796+void
797+FlickerSingleAnim::step ()
798+{
799+ int layer = MultiAnim <FlickerSingleAnim,5>::getCurrAnimNumber (mAWindow);
800+
801+ CompRect winRect (mAWindow->savedRectsValid () ?
802+ mAWindow->saveWinRect () :
803+ mWindow->geometry ());
804+ CompRect outRect (mAWindow->savedRectsValid () ?
805+ mAWindow->savedOutRect () :
806+ mWindow->outputRect ());
807+ CompWindowExtents outExtents (mAWindow->savedRectsValid () ?
808+ mAWindow->savedOutExtents () :
809+ mWindow->output ());
810+
811+ int wx = winRect.x ();
812+ int wy = winRect.y ();
813+ int owidth = outRect.width ();
814+ int oheight = outRect.height ();
815+
816+ float t = 1 - progressLinear ();
817+ if (mCurWindowEvent == WindowEventClose)
818+ t = 1 - t;
819+
820+ float amplitude = AnimJCScreen::get (screen)->optionGetFlickerAmplitude ();
821+ float waveLength = 0.4;
822+ float wavePosition = -waveLength + (1. + waveLength) * t;
823+
824+ float displacement = 0;
825+
826+ GridModel::GridObject *object = mModel->objects ();
827+ unsigned int n = mModel->numObjects ();
828+ for (unsigned int i = 0; i < n; i++, object++)
829+ {
830+ Point3d &objPos = object->position ();
831+
832+ if (i % 2 == 0) // left side; reuse old displacement on right side
833+ {
834+ float distFromWave = object->gridPosition ().y () - wavePosition;
835+
836+ if (distFromWave > 0 && distFromWave <= waveLength)
837+ {
838+ displacement = amplitude * sin (distFromWave/waveLength * M_PI);
839+ }
840+ else
841+ {
842+ displacement = 0;
843+ }
844+ }
845+
846+ float x = wx + mModel->scale ().x () *
847+ (owidth * object->gridPosition ().x () - outExtents.left);
848+
849+ float y = wy + mModel->scale ().y () *
850+ (oheight * object->gridPosition ().y () - outExtents.top);
851+
852+ switch (layer)
853+ {
854+ case 1:
855+ x -= displacement;
856+ break;
857+ case 2:
858+ x += displacement;
859+ break;
860+ case 3:
861+ y -= displacement;
862+ break;
863+ case 4:
864+ y += displacement;
865+ break;
866+ default:
867+ break;
868+ }
869+
870+ objPos.setX (x);
871+ objPos.setY (y);
872+ objPos.setZ (0);
873+ }
874+}
875
876=== added file 'plugins/animationjc/src/ghost.cpp'
877--- plugins/animationjc/src/ghost.cpp 1970-01-01 00:00:00 +0000
878+++ plugins/animationjc/src/ghost.cpp 2013-04-02 20:51:55 +0000
879@@ -0,0 +1,98 @@
880+#include "private.h"
881+
882+GhostAnim::GhostAnim (CompWindow *w,
883+ WindowEvent curWindowEvent,
884+ float duration,
885+ const AnimEffect info,
886+ const CompRect &icon) :
887+ Animation::Animation (w, curWindowEvent, duration, info, icon),
888+ TransformAnim::TransformAnim (w, curWindowEvent, duration, info, icon),
889+ GridTransformAnim::GridTransformAnim (w, curWindowEvent, duration, info,
890+ icon)
891+{
892+}
893+
894+void
895+GhostAnim::updateAttrib (GLWindowPaintAttrib &attrib)
896+{
897+ AnimJCScreen *ajs = AnimJCScreen::get (screen);
898+ attrib.opacity *= 1. - progressLinear ();
899+ attrib.saturation *= ajs->optionGetGhostSaturation ();
900+}
901+
902+void
903+GhostAnim::initGrid ()
904+{
905+ AnimJCScreen *ajs = AnimJCScreen::get (screen);
906+ mGridWidth = ajs->optionGetGhostGrid ();
907+ mGridHeight = ajs->optionGetGhostGrid ();
908+}
909+
910+void
911+GhostAnim::step ()
912+{
913+ float t = 1. - progressLinear ();
914+ if (mCurWindowEvent == WindowEventClose)
915+ t = 1. - t;
916+
917+ CompRect winRect (mAWindow->savedRectsValid () ?
918+ mAWindow->saveWinRect () :
919+ mWindow->geometry ());
920+ CompRect outRect (mAWindow->savedRectsValid () ?
921+ mAWindow->savedOutRect () :
922+ mWindow->outputRect ());
923+ CompWindowExtents outExtents (mAWindow->savedRectsValid () ?
924+ mAWindow->savedOutExtents () :
925+ mWindow->output ());
926+
927+ int wx = winRect.x ();
928+ int wy = winRect.y ();
929+
930+ int owidth = outRect.width ();
931+ int oheight = outRect.height ();
932+
933+ AnimJCScreen *ajs = AnimJCScreen::get (screen);
934+
935+ float waveAmp = 3 * ajs->optionGetGhostAmplitude ();
936+ float waveLengthX1 = 0.4;
937+ float waveLengthX2 = 0.3;
938+ float waveLengthY1 = 0.45;
939+ float waveLengthY2 = 0.35;
940+ float wavePositionX1 = 0.25 * t * ajs->optionGetGhostWaveSpeed ();
941+ float wavePositionX2 = -0.25 * t * ajs->optionGetGhostWaveSpeed ();
942+ float wavePositionY1 = 0.25 * t * ajs->optionGetGhostWaveSpeed ();
943+ float wavePositionY2 = -0.25 * t * ajs->optionGetGhostWaveSpeed ();
944+
945+ GridModel::GridObject *object = mModel->objects ();
946+ unsigned int n = mModel->numObjects ();
947+ for (unsigned int i = 0; i < n; i++, object++)
948+ {
949+ Point3d &objPos = object->position ();
950+
951+ float origx = wx + mModel->scale ().x () *
952+ (owidth * object->gridPosition ().x () -
953+ outExtents.left);
954+
955+ float origy = wy + mModel->scale ().y () *
956+ (oheight * object->gridPosition ().y () -
957+ outExtents.top);
958+
959+ float x = object->gridPosition ().x ();
960+ float y = object->gridPosition ().y ();
961+
962+ float distFromWaveX1 = x - wavePositionX1;
963+ float distFromWaveX2 = x - wavePositionX2;
964+ float distFromWaveY1 = y - wavePositionY1;
965+ float distFromWaveY2 = y - wavePositionY2;
966+
967+ objPos.setX (origx +
968+ waveAmp * sin (distFromWaveX1 / waveLengthX1 * 2 * M_PI) +
969+ waveAmp * sin (distFromWaveX2 / waveLengthX2 * 2 * M_PI));
970+
971+ objPos.setY (origy +
972+ waveAmp * sin (distFromWaveY1 / waveLengthY1 * 2 * M_PI) +
973+ waveAmp * sin (distFromWaveY2 / waveLengthY2 * 2 * M_PI));
974+
975+ objPos.setZ (0);
976+ }
977+}
978
979=== added file 'plugins/animationjc/src/popcorn.cpp'
980--- plugins/animationjc/src/popcorn.cpp 1970-01-01 00:00:00 +0000
981+++ plugins/animationjc/src/popcorn.cpp 2013-04-02 20:51:55 +0000
982@@ -0,0 +1,60 @@
983+#include <private.h>
984+
985+#define WIN_X(w) ((w)->x () - (w)->input ().left)
986+#define WIN_Y(w) ((w)->y () - (w)->input ().top)
987+#define WIN_W(w) ((w)->width () + (w)->input ().left + (w)->input ().right)
988+#define WIN_H(w) ((w)->height () + (w)->input ().top + (w)->input ().bottom)
989+
990+float
991+PopcornSingleAnim::layerProgress (int layer)
992+{
993+ if (layer == 0)
994+ return 0;
995+
996+ float tStart = (5. - layer) / 6.;
997+ float tEnd = tStart + 1./3.;
998+
999+ float t = progressLinear ();
1000+
1001+ if (t < tStart)
1002+ return 0;
1003+
1004+ if (t > tEnd)
1005+ return 1;
1006+
1007+ return (t - tStart) / (tEnd - tStart);
1008+}
1009+
1010+void
1011+PopcornSingleAnim::updateAttrib (GLWindowPaintAttrib &attrib)
1012+{
1013+ int layer = MultiAnim <PopcornSingleAnim, 6>::getCurrAnimNumber (mAWindow);
1014+
1015+ attrib.opacity *= 1. - progressLinear ();
1016+
1017+ attrib.opacity *= 1. - layerProgress (layer);
1018+}
1019+
1020+void
1021+PopcornSingleAnim::applyTransform ()
1022+{
1023+ int layer = MultiAnim <PopcornSingleAnim, 6>::getCurrAnimNumber (mAWindow);
1024+
1025+ if (layer == 0) return;
1026+
1027+ float p = layerProgress (layer);
1028+
1029+ float v = 40.;
1030+ float theta = (54. + 144.*(layer-1)) / 180. * 3.14159265;
1031+ float dx = v * cos (theta) * p;
1032+ float dy = -v * sin (theta) * p;
1033+
1034+ mTransform.translate (dx, dy,
1035+ 0.16*p*AnimJCScreen::get (screen)->optionGetPopcornKernelHeight ());
1036+}
1037+
1038+void
1039+PopcornSingleAnim::updateBB (CompOutput &output)
1040+{
1041+ TransformAnim::updateBB (output);
1042+}
1043
1044=== added file 'plugins/animationjc/src/private.h'
1045--- plugins/animationjc/src/private.h 1970-01-01 00:00:00 +0000
1046+++ plugins/animationjc/src/private.h 2013-04-02 20:51:55 +0000
1047@@ -0,0 +1,232 @@
1048+#include <string.h>
1049+#include <stdlib.h>
1050+#include <math.h>
1051+
1052+#include <core/core.h>
1053+#include <composite/composite.h>
1054+#include <opengl/opengl.h>
1055+
1056+#include <boost/foreach.hpp>
1057+#define foreach BOOST_FOREACH
1058+
1059+#include <animation/animation.h>
1060+#include <animationjc/animationjc.h>
1061+
1062+#include "animationjc_options.h"
1063+
1064+extern AnimEffect AnimEffectBlackHole;
1065+extern AnimEffect AnimEffectFlicker;
1066+extern AnimEffect AnimEffectGhost;
1067+extern AnimEffect AnimEffectPopcorn;
1068+extern AnimEffect AnimEffectRaindrop;
1069+
1070+#define NUM_EFFECTS 5
1071+
1072+// This must have the value of the first "effect setting" above
1073+// in AnimJCScreenOptions
1074+#define NUM_NONEFFECT_OPTIONS 0
1075+
1076+class ExtensionPluginAnimJC : public ExtensionPluginInfo
1077+{
1078+public:
1079+ ExtensionPluginAnimJC (const CompString &name,
1080+ unsigned int nEffects,
1081+ AnimEffect *effects,
1082+ CompOption::Vector *effectOptions,
1083+ unsigned int firstEffectOptionIndex) :
1084+ ExtensionPluginInfo (name, nEffects, effects, effectOptions,
1085+ firstEffectOptionIndex) {}
1086+ ~ExtensionPluginAnimJC () {}
1087+
1088+ const CompOutput *output () { return mOutput; }
1089+
1090+private:
1091+ const CompOutput *mOutput;
1092+};
1093+
1094+class AnimJCScreen :
1095+ public PluginClassHandler<AnimJCScreen, CompScreen, ANIMATIONADDON_ABI>,
1096+ public AnimationjcOptions
1097+{
1098+public:
1099+ AnimJCScreen (CompScreen *);
1100+ ~AnimJCScreen ();
1101+
1102+ int getIntenseTimeStep ();
1103+
1104+ void initAnimationList ();
1105+
1106+private:
1107+ PrivateAnimJCScreen *priv;
1108+};
1109+
1110+class PrivateAnimJCScreen
1111+{
1112+ friend class AnimJCScreen;
1113+
1114+public:
1115+ PrivateAnimJCScreen (CompScreen *);
1116+ ~PrivateAnimJCScreen ();
1117+
1118+protected:
1119+ CompOutput &mOutput;
1120+};
1121+
1122+class AnimJCWindow :
1123+ public PluginClassHandler<AnimJCWindow, CompWindow>
1124+{
1125+public:
1126+ AnimJCWindow (CompWindow *);
1127+ ~AnimJCWindow ();
1128+
1129+protected:
1130+ CompWindow *mWindow; ///< Window being animated.
1131+ AnimWindow *aWindow;
1132+};
1133+
1134+/*** BLACK HOLE **************************************************************/
1135+
1136+class BlackHoleAnim :
1137+ public GridTransformAnim
1138+{
1139+public:
1140+ BlackHoleAnim (CompWindow *w,
1141+ WindowEvent curWindowEvent,
1142+ float duration,
1143+ const AnimEffect info,
1144+ const CompRect &icon);
1145+
1146+ float getBlackHoleProgress () { return progressLinear (); }
1147+
1148+ void initGrid ();
1149+ inline bool using3D () { return false; }
1150+ void step ();
1151+};
1152+
1153+/*** RAINDROP ****************************************************************/
1154+
1155+class RaindropAnim :
1156+ public GridTransformAnim
1157+{
1158+public:
1159+ RaindropAnim (CompWindow *w,
1160+ WindowEvent curWindowEvent,
1161+ float duration,
1162+ const AnimEffect info,
1163+ const CompRect &icon);
1164+
1165+ void initGrid ();
1166+
1167+ inline bool using3D () { return true; }
1168+
1169+ void step ();
1170+};
1171+
1172+/*** POPCORN *****************************************************************/
1173+
1174+class PopcornSingleAnim :
1175+ public TransformAnim
1176+{
1177+public:
1178+ PopcornSingleAnim (CompWindow *w,
1179+ WindowEvent curWindowEvent,
1180+ float duration,
1181+ const AnimEffect info,
1182+ const CompRect &icon) :
1183+ Animation::Animation
1184+ (w, curWindowEvent, duration, info, icon),
1185+ TransformAnim::TransformAnim
1186+ (w, curWindowEvent, duration, info, icon)
1187+ {
1188+ }
1189+
1190+ float layerProgress (int);
1191+
1192+ void applyTransform ();
1193+
1194+ void updateAttrib (GLWindowPaintAttrib &);
1195+
1196+ void updateBB (CompOutput &output);
1197+ bool updateBBUsed () { return true; }
1198+};
1199+
1200+class PopcornAnim :
1201+ public MultiAnim <PopcornSingleAnim, 6>
1202+{
1203+public:
1204+ PopcornAnim (CompWindow *w,
1205+ WindowEvent curWindowEvent,
1206+ float duration,
1207+ const AnimEffect info,
1208+ const CompRect &icon) :
1209+ MultiAnim <PopcornSingleAnim, 6>::MultiAnim
1210+ (w, curWindowEvent, duration, info, icon)
1211+ {
1212+ }
1213+};
1214+
1215+/*** GHOST *******************************************************************/
1216+
1217+class GhostAnim :
1218+ public GridTransformAnim
1219+{
1220+public:
1221+ GhostAnim (CompWindow *w,
1222+ WindowEvent curWindowEvent,
1223+ float duration,
1224+ const AnimEffect info,
1225+ const CompRect &icon);
1226+
1227+ void initGrid ();
1228+
1229+ inline bool using3D () { return true; }
1230+
1231+ void step ();
1232+
1233+ void updateAttrib (GLWindowPaintAttrib &);
1234+};
1235+
1236+/*** FLICKER *****************************************************************/
1237+
1238+class FlickerSingleAnim :
1239+ public GridTransformAnim
1240+{
1241+public:
1242+ FlickerSingleAnim (CompWindow *w,
1243+ WindowEvent curWindowEvent,
1244+ float duration,
1245+ const AnimEffect info,
1246+ const CompRect &icon) :
1247+ Animation::Animation
1248+ (w, curWindowEvent, duration, info, icon),
1249+ TransformAnim::TransformAnim
1250+ (w, curWindowEvent, duration, info, icon),
1251+ GridTransformAnim::GridTransformAnim
1252+ (w, curWindowEvent, duration, info, icon)
1253+ {
1254+ }
1255+
1256+ void updateAttrib (GLWindowPaintAttrib &);
1257+
1258+ void initGrid ();
1259+
1260+ void step ();
1261+
1262+ bool updateBBUsed () { return true; }
1263+ void updateBB (CompOutput &output) { TransformAnim::updateBB (output); }
1264+};
1265+
1266+class FlickerAnim :
1267+ public MultiAnim <FlickerSingleAnim, 5>
1268+{
1269+public:
1270+ FlickerAnim (CompWindow *w,
1271+ WindowEvent curWindowEvent,
1272+ float duration,
1273+ const AnimEffect info,
1274+ const CompRect &icon) :
1275+ MultiAnim <FlickerSingleAnim, 5>::MultiAnim
1276+ (w, curWindowEvent, duration, info, icon)
1277+ {
1278+ }
1279+};
1280
1281=== added file 'plugins/animationjc/src/raindrop.cpp'
1282--- plugins/animationjc/src/raindrop.cpp 1970-01-01 00:00:00 +0000
1283+++ plugins/animationjc/src/raindrop.cpp 2013-04-02 20:51:55 +0000
1284@@ -0,0 +1,85 @@
1285+#include "private.h"
1286+
1287+#include <algorithm>
1288+
1289+RaindropAnim::RaindropAnim (CompWindow *w,
1290+ WindowEvent curWindowEvent,
1291+ float duration,
1292+ const AnimEffect info,
1293+ const CompRect &icon) :
1294+ Animation::Animation (w, curWindowEvent, duration, info, icon),
1295+ TransformAnim::TransformAnim (w, curWindowEvent, duration, info, icon),
1296+ GridTransformAnim::GridTransformAnim (w, curWindowEvent, duration, info,
1297+ icon)
1298+{
1299+}
1300+
1301+void
1302+RaindropAnim::initGrid ()
1303+{
1304+ mGridWidth = 20;
1305+ mGridHeight = 20;
1306+}
1307+
1308+void
1309+RaindropAnim::step ()
1310+{
1311+ float t = 1. - progressLinear ();
1312+ if (mCurWindowEvent == WindowEventClose)
1313+ t = 1. - t;
1314+
1315+ CompRect winRect (mAWindow->savedRectsValid () ?
1316+ mAWindow->saveWinRect () :
1317+ mWindow->geometry ());
1318+ CompRect outRect (mAWindow->savedRectsValid () ?
1319+ mAWindow->savedOutRect () :
1320+ mWindow->outputRect ());
1321+ CompWindowExtents outExtents (mAWindow->savedRectsValid () ?
1322+ mAWindow->savedOutExtents () :
1323+ mWindow->output ());
1324+
1325+ int wx = winRect.x ();
1326+ int wy = winRect.y ();
1327+
1328+ int owidth = outRect.width ();
1329+ int oheight = outRect.height ();
1330+
1331+ AnimJCScreen *ajs = AnimJCScreen::get (screen);
1332+
1333+ float waveLength = ajs->optionGetRaindropWavelength ();
1334+ int numWaves = ajs->optionGetRaindropNumWaves ();
1335+ float waveAmp = (pow ((float)oheight / ::screen->height (), 0.4) * 0.08) *
1336+ ajs->optionGetRaindropAmplitude ();
1337+ float wavePosition = -waveLength * numWaves +
1338+ (1. + waveLength * numWaves) * t;
1339+
1340+ GridModel::GridObject *object = mModel->objects ();
1341+ unsigned int n = mModel->numObjects ();
1342+ for (unsigned int i = 0; i < n; i++, object++)
1343+ {
1344+ Point3d &objPos = object->position ();
1345+
1346+ float origx = wx + mModel->scale ().x () *
1347+ (owidth * object->gridPosition ().x () -
1348+ outExtents.left);
1349+ objPos.setX (origx);
1350+
1351+ float origy = wy + mModel->scale ().y () *
1352+ (oheight * object->gridPosition ().y () -
1353+ outExtents.top);
1354+ objPos.setY (origy);
1355+
1356+ // find distance to center in grid terms
1357+ float gridDistance = sqrt (pow (object->gridPosition ().x ()-0.5, 2) +
1358+ pow (object->gridPosition ().y ()-0.5, 2)) *
1359+ sqrt (2);
1360+
1361+ float distFromWave = gridDistance - wavePosition;
1362+ if (distFromWave < waveLength*numWaves && distFromWave > 0)
1363+ objPos.setZ (waveAmp *
1364+ sin (3.14159265 * distFromWave / waveLength / numWaves) *
1365+ pow (sin (3.14159265 * distFromWave / waveLength), 2));
1366+ else
1367+ objPos.setZ (0);
1368+ }
1369+}

Subscribers

People subscribed via source and target branches

to all changes: