Merge lp:~smspillaz/compiz/compiz.animationsjc-returns into lp:compiz/0.9.12

Proposed by Sam Spilsbury
Status: Rejected
Rejected by: Sam Spilsbury
Proposed branch: lp:~smspillaz/compiz/compiz.animationsjc-returns
Merge into: lp:compiz/0.9.12
Prerequisite: lp:~smspillaz/compiz/compiz.animationaddon-returns
Diff against target: 1112 lines (+1021/-0)
14 files modified
debian/compiz-plugins.install (+2/-0)
debian/compiz-plugins.install.armel (+2/-0)
debian/compiz-plugins.install.armhf (+2/-0)
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 (+42/-0)
plugins/animationjc/src/animationjc.cpp (+150/-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:~smspillaz/compiz/compiz.animationsjc-returns
Reviewer Review Type Date Requested Status
Sam Spilsbury Needs Resubmitting
Marco Trevisan (Treviño) Needs Fixing
PS Jenkins bot continuous-integration Pending
Review via email: mp+295534@code.launchpad.net

Commit message

animationsjc: Re-add the animationsjc plugin

Description of the change

animationsjc: Re-add the animationsjc plugin (thanks MC Return!)

To post a comment you must log in.
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

I guess you want to add this to debian/compiz-plugins.install file as well, or pkg build system will complain.

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

Hah! I always forget that. Thanks - I'll add it now :)

4024. By Sam Spilsbury <email address hidden>

debian: Add animationsjc to compiz-plugins.install

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

Done

Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

As you said, conflicts are behind the corner, so please merge this again with lp:~smspillaz/compiz/compiz.animationaddon-returns

Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

There's still a merge conflict with prereq branch: https://ci-train.ubuntu.com/job/ubuntu-landing-012-1-build/58/consoleText

4025. By Sam Spilsbury <email address hidden>

Merge lp:~smspillaz/compiz/compiz.animationaddon-returns

Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Mh, unfortunately this still fails to build:
 - compiz-animationjc.pc has to be added to debian/compiz-dev.install
 - In ARM still fails

https://launchpadlibrarian.net/262762083/buildlog_ubuntu-yakkety-armhf.compiz_1%3A0.9.12.2+16.10.20160601.1-0ubuntu1_BUILDING.txt.gz

/«BUILDDIR»/compiz-0.9.12.2+16.10.20160601.1/plugins/animationaddon/src/polygon.cpp: In member function ‘virtual void ExtensionPluginAnimAddon::prePaintOutput(CompOutput*)’:
/«BUILDDIR»/compiz-0.9.12.2+16.10.20160601.1/plugins/animationaddon/src/polygon.cpp:1996:23: error: ‘glClearDepth’ was not declared in this scope
  glClearDepth (1000.0f);
                       ^

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

Yeah, looks like the issue is in animationaddon - yet another pointless rename of a core function (sigh): https://www.khronos.org/opengles/sdk/docs/man/xhtml/glClearDepthf.xml

I had assumed that since all the fixed function stuff had been removed that we were more or less clear for GLES support, but it looks like I'll need to compile everything locally here to double check.

Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Almost there...

Just add the .pc file to compiz-dev

dh_install: usr/lib/powerpc64le-linux-gnu/pkgconfig/compiz-animationjc.pc exists in debian/tmp but is not installed to anywhere

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

These all need to be resubmitted to lp:compiz anyway

review: Needs Resubmitting

Unmerged revisions

4025. By Sam Spilsbury <email address hidden>

Merge lp:~smspillaz/compiz/compiz.animationaddon-returns

4024. By Sam Spilsbury <email address hidden>

debian: Add animationsjc to compiz-plugins.install

4023. By Sam Spilsbury <email address hidden>

animationjc: Re-add the animationjc plugin

(Thanks MC Return)

4022. By Sam Spilsbury <email address hidden>

CMakeLists: Enable building animationaddon

4021. By Sam Spilsbury <email address hidden>

animationaddon: Provide damage box for dissolveAnim

4020. By Sam Spilsbury <email address hidden>

animationaddon: Use opacity which actually fades out for dissolve.

4019. By Sam Spilsbury <email address hidden>

animationaddon: Port the animationaddon plugin to use modern GL API.

This involved a lot of changes:
 - Removal of glPush/glPop. State is assumed to be off in newer versions
   of compiz, so switch off whatever gets switched on.
 - Switch from glVertexPointer/glDrawArrays/glDrawElements to GLVertexBuffer
 - Changes in primitive assembly: GL_POLYGON doesn't exist in GLES
   so switch to using GL_TRIANGLES. This meant that the indices
   for all the animatons needed to be re-tesselated. That was done
   by hand using a winding rule which just duplicates the first and
   third vertex around the fourth.
 - Dropping of glTexEnv calls.
 - Reworking of the depth test, since writes to the depth buffer
   have been disabled by default.

Some things still don't work:
 - Anything depending on clipping planes: glClipPlane and friends
   were removed on GLES20 and they are quite difficult to implement
   using other methods.
 - Drawing of decoration textures - these appear to be stretched
   and skewed incorrectly.
 - Lighting. This will require special shaders.

4018. By Sam Spilsbury <email address hidden>

animation: Just set values in paint attrib directly

4017. By Sam Spilsbury <email address hidden>

animation: Expose drawGeometry function again

Since glDrawGeometry was dropped post GLES, this function mirrors
glDrawTexture and allows animations to specify their own complete
replacement for it.

4016. By Sam Spilsbury <email address hidden>

animation: Reset the glPaint index each time it is called in MultiAnim

Before we were allowing the wrapable function handler to reset
the index, which means that each copy of the animation had
different behaviour.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/compiz-plugins.install'
2--- debian/compiz-plugins.install 2016-06-01 03:18:26 +0000
3+++ debian/compiz-plugins.install 2016-06-01 03:18:30 +0000
4@@ -4,6 +4,8 @@
5 usr/share/compiz/*annotate.*
6 usr/lib/*/compiz/*animationaddon.*
7 usr/share/compiz/*animationaddon.*
8+usr/lib/*/compiz/*animationjc.*
9+usr/share/compiz/*animationjc.*
10 usr/lib/*/compiz/*bench.*
11 usr/share/compiz/*bench.*
12 usr/lib/*/compiz/*blur.*
13
14=== modified file 'debian/compiz-plugins.install.armel'
15--- debian/compiz-plugins.install.armel 2016-06-01 03:18:26 +0000
16+++ debian/compiz-plugins.install.armel 2016-06-01 03:18:30 +0000
17@@ -4,6 +4,8 @@
18 usr/share/compiz/*annotate.*
19 usr/lib/*/compiz/*animationaddon.*
20 usr/share/compiz/*animationaddon.*
21+usr/lib/*/compiz/*animationjc.*
22+usr/share/compiz/*animationjc.*
23 usr/lib/*/compiz/*clone.*
24 usr/share/compiz/*clone.*
25 usr/lib/*/compiz/*crashhandler.*
26
27=== modified file 'debian/compiz-plugins.install.armhf'
28--- debian/compiz-plugins.install.armhf 2016-06-01 03:18:26 +0000
29+++ debian/compiz-plugins.install.armhf 2016-06-01 03:18:30 +0000
30@@ -4,6 +4,8 @@
31 usr/share/compiz/*annotate.*
32 usr/lib/*/compiz/*animationaddon.*
33 usr/share/compiz/*animationaddon.*
34+usr/lib/*/compiz/*animationjc.*
35+usr/share/compiz/*animationjc.*
36 usr/lib/*/compiz/*clone.*
37 usr/share/compiz/*clone.*
38 usr/lib/*/compiz/*crashhandler.*
39
40=== added directory 'plugins/animationjc'
41=== added file 'plugins/animationjc/CMakeLists.txt'
42--- plugins/animationjc/CMakeLists.txt 1970-01-01 00:00:00 +0000
43+++ plugins/animationjc/CMakeLists.txt 2016-06-01 03:18:30 +0000
44@@ -0,0 +1,7 @@
45+find_package (Compiz REQUIRED)
46+include (CompizPlugin)
47+include (FindOpenGL)
48+
49+if (OPENGL_GLU_FOUND)
50+ compiz_plugin (animationjc PLUGINDEPS composite opengl animation LIBRARIES ${OPENGL_glu_LIBRARY} INCDIRS ${OPENGL_INCLUDE_DIR})
51+endif (OPENGL_GLU_FOUND)
52
53=== added file 'plugins/animationjc/animationjc.xml.in'
54--- plugins/animationjc/animationjc.xml.in 1970-01-01 00:00:00 +0000
55+++ plugins/animationjc/animationjc.xml.in 2016-06-01 03:18:30 +0000
56@@ -0,0 +1,154 @@
57+<compiz>
58+ <!-- animationaddon metadata -->
59+ <plugin name="animationjc" useBcop="true">
60+ <_short>Animations Experimental</_short>
61+ <_long>Extra window animations</_long>
62+ <category>Effects</category>
63+ <deps>
64+ <requirement>
65+ <plugin>opengl</plugin>
66+ <plugin>animation</plugin>
67+ </requirement>
68+ <relation type="after">
69+ <plugin>opengl</plugin>
70+ <plugin>composite</plugin>
71+ <plugin>animation</plugin>
72+ <plugin>decor</plugin>
73+ </relation>
74+ </deps>
75+
76+ <options>
77+ <group>
78+ <_short>Effect Settings</_short>
79+
80+ <subgroup>
81+ <_short>Black Hole</_short>
82+ <option name="blackhole_delay" type="float">
83+ <_short>Delay</_short>
84+ <default>0.75</default>
85+ <min>0.0</min>
86+ <max>0.99</max>
87+ <precision>0.01</precision>
88+ </option>
89+ </subgroup>
90+
91+ <subgroup>
92+ <_short>Flicker</_short>
93+ <option name="flicker_amplitude" type="int">
94+ <_short>Amplitude</_short>
95+ <default>3</default>
96+ <min>1</min>
97+ <max>10</max>
98+ </option>
99+ </subgroup>
100+
101+ <subgroup>
102+ <_short>Ghost</_short>
103+ <option name="ghost_grid" type="int">
104+ <_short>Grid</_short>
105+ <default>20</default>
106+ <min>2</min>
107+ <max>20</max>
108+ </option>
109+
110+ <option name="ghost_saturation" type="float">
111+ <_short>Saturation</_short>
112+ <default>0.0</default>
113+ <min>0.0</min>
114+ <max>1.0</max>
115+ <precision>0.1</precision>
116+ </option>
117+
118+ <option name="ghost_amplitude" type="float">
119+ <_short>Amplitude</_short>
120+ <default>1.0</default>
121+ <min>0.0</min>
122+ <max>5.0</max>
123+ </option>
124+
125+ <option name="ghost_wave_speed" type="float">
126+ <_short>Wave Speed</_short>
127+ <default>1.0</default>
128+ <min>0.0</min>
129+ <max>5.0</max>
130+ </option>
131+ </subgroup>
132+
133+ <subgroup>
134+ <_short>Popcorn</_short>
135+ <option name="popcorn_kernel_height" type="float">
136+ <_short>Kernel Height</_short>
137+ <default>1.0</default>
138+ <min>0.0</min>
139+ <max>5.0</max>
140+ <precision>0.1</precision>
141+ </option>
142+ </subgroup>
143+
144+ <subgroup>
145+ <_short>Raindrop</_short>
146+
147+ <option name="raindrop_amplitude" type="float">
148+ <_short>Amplitude</_short>
149+ <default>1.0</default>
150+ <min>-5.0</min>
151+ <max>5.0</max>
152+ <precision>0.1</precision>
153+ </option>
154+
155+ <option name="raindrop_wavelength" type="float">
156+ <_short>Wavelength</_short>
157+ <default>0.4</default>
158+ <min>0.0</min>
159+ <max>1.0</max>
160+ <precision>0.05</precision>
161+ </option>
162+
163+ <option name="raindrop_num_waves" type="int">
164+ <_short>Number of Waves</_short>
165+ <default>1</default>
166+ <min>1</min>
167+ <max>5</max>
168+ </option>
169+ </subgroup>
170+ </group>
171+ </options>
172+
173+ <extension base_plugin="animation">
174+ <base_option>open_effects</base_option>
175+ <base_option>open_random_effects</base_option>
176+ <base_option>close_effects</base_option>
177+ <base_option>close_random_effects</base_option>
178+ <base_option>minimize_effects</base_option>
179+ <base_option>minimize_random_effects</base_option>
180+ <restriction>
181+ <value>animationjc:Black Hole</value>
182+ <_name>Black Hole</_name>
183+ </restriction>
184+ <restriction>
185+ <value>animationjc:Ghost</value>
186+ <_name>Ghost</_name>
187+ </restriction>
188+ <restriction>
189+ <value>animationjc:Popcorn</value>
190+ <_name>Popcorn</_name>
191+ </restriction>
192+ </extension>
193+
194+ <extension base_plugin="animation">
195+ <base_option>open_effects</base_option>
196+ <base_option>open_random_effects</base_option>
197+ <base_option>close_effects</base_option>
198+ <base_option>close_random_effects</base_option>
199+ <base_option>focus_effects</base_option>
200+ <restriction>
201+ <value>animationjc:Flicker</value>
202+ <_name>Flicker</_name>
203+ </restriction>
204+ <restriction>
205+ <value>animationjc:Raindrop</value>
206+ <_name>Raindrop</_name>
207+ </restriction>
208+ </extension>
209+ </plugin>
210+</compiz>
211
212=== added file 'plugins/animationjc/compiz-animationjc.pc.in'
213--- plugins/animationjc/compiz-animationjc.pc.in 1970-01-01 00:00:00 +0000
214+++ plugins/animationjc/compiz-animationjc.pc.in 2016-06-01 03:18:30 +0000
215@@ -0,0 +1,12 @@
216+prefix=@prefix@
217+exec_prefix=@prefix@
218+libdir=@libdir@
219+includedir=@includedir@
220+
221+Name: compiz-animationjc
222+Description: Animation JC plugin for compiz
223+Version: @VERSION@
224+
225+Requires: compiz compiz-composite compiz-opengl compiz-animation
226+Libs: -L${libdir} -lanimationjc
227+Cflags: @COMPIZ_CFLAGS@
228
229=== added directory 'plugins/animationjc/include'
230=== added directory 'plugins/animationjc/include/animationjc'
231=== added file 'plugins/animationjc/include/animationjc/animationjc.h'
232--- plugins/animationjc/include/animationjc/animationjc.h 1970-01-01 00:00:00 +0000
233+++ plugins/animationjc/include/animationjc/animationjc.h 2016-06-01 03:18:30 +0000
234@@ -0,0 +1,42 @@
235+#ifndef _COMPIZ_ANIMATIONJC_H
236+#define _COMPIZ_ANIMATIONJC_H
237+
238+#define ANIMATIONADDON_ABI 20091206
239+
240+#include <core/pluginclasshandler.h>
241+
242+#include <vector>
243+#include <boost/ptr_container/ptr_vector.hpp>
244+
245+#include <opengl/opengl.h>
246+
247+using namespace::std;
248+
249+class PrivateAnimJCScreen;
250+
251+
252+/// Base class for all polygon- and particle-based animations
253+class BaseAddonAnim :
254+ virtual public Animation
255+{
256+public:
257+ BaseAddonAnim (CompWindow *w,
258+ WindowEvent curWindowEvent,
259+ float duration,
260+ const AnimEffect info,
261+ const CompRect &icon);
262+ ~BaseAddonAnim () {}
263+
264+ bool needsDepthTest () { return mDoDepthTest; }
265+
266+protected:
267+ /// Gets info about the extension plugin that implements this animation.
268+ ExtensionPluginInfo *getExtensionPluginInfo ();
269+
270+ CompositeScreen *mCScreen;
271+ GLScreen *mGScreen;
272+
273+ bool mDoDepthTest; ///< Whether depth testing should be used in the effect
274+};
275+
276+#endif
277
278=== added directory 'plugins/animationjc/src'
279=== added file 'plugins/animationjc/src/animationjc.cpp'
280--- plugins/animationjc/src/animationjc.cpp 1970-01-01 00:00:00 +0000
281+++ plugins/animationjc/src/animationjc.cpp 2016-06-01 03:18:30 +0000
282@@ -0,0 +1,150 @@
283+#include "private.h"
284+
285+class AnimJCPluginVTable :
286+ public CompPlugin::VTableForScreenAndWindow<AnimJCScreen, AnimJCWindow>
287+{
288+public:
289+ bool init ();
290+};
291+
292+COMPIZ_PLUGIN_20090315 (animationjc, AnimJCPluginVTable);
293+
294+AnimEffect animEffects[NUM_EFFECTS];
295+
296+ExtensionPluginAnimJC animJCExtPluginInfo (CompString ("animationjc"),
297+ NUM_EFFECTS, animEffects, NULL,
298+ NUM_NONEFFECT_OPTIONS);
299+
300+AnimEffect AnimEffectBlackHole;
301+AnimEffect AnimEffectFlicker;
302+AnimEffect AnimEffectGhost;
303+AnimEffect AnimEffectPopcorn;
304+AnimEffect AnimEffectRaindrop;
305+
306+ExtensionPluginInfo *
307+BaseAddonAnim::getExtensionPluginInfo ()
308+{
309+ return &animJCExtPluginInfo;
310+}
311+
312+BaseAddonAnim::BaseAddonAnim (CompWindow *w,
313+ WindowEvent curWindowEvent,
314+ float duration,
315+ const AnimEffect info,
316+ const CompRect &icon) :
317+ Animation::Animation (w, curWindowEvent, duration, info, icon),
318+ mCScreen (CompositeScreen::get (::screen)),
319+ mGScreen (GLScreen::get (::screen)),
320+ mDoDepthTest (false)
321+{
322+}
323+
324+void
325+AnimJCScreen::initAnimationList ()
326+{
327+ int i = 0;
328+
329+ AnimEffectUsedFor focusableUsedFor = AnimEffectUsedFor::all ()
330+ .exclude (AnimEventShade);
331+ AnimEffectUsedFor openUsedFor = AnimEffectUsedFor::all ()
332+ .exclude (AnimEventShade)
333+ .exclude (AnimEventFocus);
334+
335+ animEffects[i++] = AnimEffectBlackHole =
336+ new AnimEffectInfo ("animationjc:Black Hole",
337+ openUsedFor,
338+ &createAnimation<BlackHoleAnim>);
339+
340+ animEffects[i++] = AnimEffectFlicker =
341+ new AnimEffectInfo ("animationjc:Flicker",
342+ focusableUsedFor,
343+ &createAnimation<FlickerAnim>);
344+
345+ animEffects[i++] = AnimEffectGhost =
346+ new AnimEffectInfo ("animationjc:Ghost",
347+ openUsedFor,
348+ &createAnimation<GhostAnim>);
349+
350+ animEffects[i++] = AnimEffectPopcorn =
351+ new AnimEffectInfo ("animationjc:Popcorn",
352+ openUsedFor,
353+ &createAnimation<PopcornAnim>);
354+
355+ animEffects[i++] = AnimEffectRaindrop =
356+ new AnimEffectInfo ("animationjc:Raindrop",
357+ focusableUsedFor,
358+ &createAnimation<RaindropAnim>);
359+
360+ animJCExtPluginInfo.effectOptions = &getOptions ();
361+
362+ AnimScreen *as = AnimScreen::get (::screen);
363+
364+ // Extends animation plugin with this set of animation effects.
365+ as->addExtension (&animJCExtPluginInfo);
366+}
367+
368+PrivateAnimJCScreen::PrivateAnimJCScreen (CompScreen *s) :
369+ mOutput (s->fullscreenOutput ())
370+{
371+}
372+
373+PrivateAnimJCScreen::~PrivateAnimJCScreen ()
374+{
375+ AnimScreen *as = AnimScreen::get (::screen);
376+
377+ as->removeExtension (&animJCExtPluginInfo);
378+
379+ for (int i = 0; i < NUM_EFFECTS; i++)
380+ {
381+ delete animEffects[i];
382+ animEffects[i] = NULL;
383+ }
384+}
385+
386+AnimJCScreen::AnimJCScreen (CompScreen *s) :
387+ PluginClassHandler<AnimJCScreen, CompScreen> (s),
388+ priv (new PrivateAnimJCScreen (s))
389+{
390+ initAnimationList ();
391+}
392+
393+AnimJCScreen::~AnimJCScreen ()
394+{
395+ delete priv;
396+}
397+
398+AnimJCWindow::AnimJCWindow (CompWindow *w) :
399+ PluginClassHandler<AnimJCWindow, CompWindow> (w),
400+ mWindow (w),
401+ aWindow (AnimWindow::get (w))
402+{
403+}
404+
405+AnimJCWindow::~AnimJCWindow ()
406+{
407+ Animation *curAnim = aWindow->curAnimation ();
408+
409+ if (!curAnim)
410+ return;
411+
412+ // We need to interrupt and clean up the animation currently being played
413+ // by animationaddon for this window (if any)
414+ if (curAnim->remainingTime () > 0 &&
415+ curAnim->getExtensionPluginInfo ()->name ==
416+ CompString ("animationjc"))
417+ {
418+ aWindow->postAnimationCleanUp ();
419+ }
420+}
421+
422+bool
423+AnimJCPluginVTable::init ()
424+{
425+ if (!CompPlugin::checkPluginABI ("core", CORE_ABIVERSION) |
426+ !CompPlugin::checkPluginABI ("composite", COMPIZ_COMPOSITE_ABI) |
427+ !CompPlugin::checkPluginABI ("opengl", COMPIZ_OPENGL_ABI) |
428+ !CompPlugin::checkPluginABI ("animation", ANIMATION_ABI))
429+ return false;
430+
431+ return true;
432+}
433
434=== added file 'plugins/animationjc/src/blackhole.cpp'
435--- plugins/animationjc/src/blackhole.cpp 1970-01-01 00:00:00 +0000
436+++ plugins/animationjc/src/blackhole.cpp 2016-06-01 03:18:30 +0000
437@@ -0,0 +1,79 @@
438+#include "private.h"
439+
440+#include <algorithm>
441+
442+BlackHoleAnim::BlackHoleAnim (CompWindow *w,
443+ WindowEvent curWindowEvent,
444+ float duration,
445+ const AnimEffect info,
446+ const CompRect &icon) :
447+ Animation::Animation (w, curWindowEvent, duration, info, icon),
448+ TransformAnim::TransformAnim (w, curWindowEvent, duration, info, icon),
449+ GridTransformAnim::GridTransformAnim (w, curWindowEvent, duration, info,
450+ icon)
451+{
452+}
453+
454+void
455+BlackHoleAnim::initGrid ()
456+{
457+ mGridWidth = 20;
458+ mGridHeight = 20;
459+}
460+
461+void
462+BlackHoleAnim::step ()
463+{
464+ CompRect winRect (mAWindow->savedRectsValid () ?
465+ mAWindow->saveWinRect () :
466+ mWindow->geometry ());
467+ CompRect outRect (mAWindow->savedRectsValid () ?
468+ mAWindow->savedOutRect () :
469+ mWindow->outputRect ());
470+ CompWindowExtents outExtents (mAWindow->savedRectsValid () ?
471+ mAWindow->savedOutExtents () :
472+ mWindow->output ());
473+
474+ int wx = winRect.x ();
475+ int wy = winRect.y ();
476+
477+ int owidth = outRect.width ();
478+ int oheight = outRect.height ();
479+
480+ float centerx = wx + mModel->scale ().x () *
481+ (owidth * 0.5 - outExtents.left);
482+ float centery = wy + mModel->scale ().y () *
483+ (oheight * 0.5 - outExtents.top);
484+
485+ float delay = AnimJCScreen::get (screen)->optionGetBlackholeDelay ();
486+ float tau = (1. - delay) / 8.;
487+
488+ GridModel::GridObject *object = mModel->objects ();
489+ unsigned int n = mModel->numObjects ();
490+ for (unsigned int i = 0; i < n; i++, object++)
491+ {
492+ // find distance to center in grid terms, 0..1
493+ float gridDistance = 2 * max (fabs (object->gridPosition ().x ()-0.5),
494+ fabs (object->gridPosition ().y ()-0.5));
495+
496+ // use that and tau to find r
497+ float cutoff = gridDistance * delay;
498+ float r = 1;
499+ if (getBlackHoleProgress () > cutoff)
500+ r = exp (-(getBlackHoleProgress () - cutoff) / tau);
501+
502+ // find real original coordinates
503+ float origx = wx + mModel->scale ().x () *
504+ (owidth * object->gridPosition ().x () -
505+ outExtents.left);
506+ float origy = wy + mModel->scale ().y () *
507+ (oheight * object->gridPosition ().y () -
508+ outExtents.top);
509+
510+ // shrink toward center by r
511+ Point3d &objPos = object->position ();
512+ objPos.setX ((origx-centerx) * r + centerx);
513+ objPos.setY ((origy-centery) * r + centery);
514+ objPos.setZ (0);
515+ }
516+}
517
518=== added file 'plugins/animationjc/src/flicker.cpp'
519--- plugins/animationjc/src/flicker.cpp 1970-01-01 00:00:00 +0000
520+++ plugins/animationjc/src/flicker.cpp 2016-06-01 03:18:30 +0000
521@@ -0,0 +1,96 @@
522+#include <private.h>
523+
524+void
525+FlickerSingleAnim::updateAttrib (GLWindowPaintAttrib &attrib)
526+{
527+ int layer = MultiAnim <FlickerSingleAnim,5>::getCurrAnimNumber (mAWindow);
528+ float o = 0.2;
529+ attrib.opacity *= o / (1. - (4-layer)*o);
530+}
531+
532+void
533+FlickerSingleAnim::initGrid ()
534+{
535+ mGridWidth = 2;
536+ mGridHeight = 20;
537+}
538+
539+void
540+FlickerSingleAnim::step ()
541+{
542+ int layer = MultiAnim <FlickerSingleAnim,5>::getCurrAnimNumber (mAWindow);
543+
544+ CompRect winRect (mAWindow->savedRectsValid () ?
545+ mAWindow->saveWinRect () :
546+ mWindow->geometry ());
547+ CompRect outRect (mAWindow->savedRectsValid () ?
548+ mAWindow->savedOutRect () :
549+ mWindow->outputRect ());
550+ CompWindowExtents outExtents (mAWindow->savedRectsValid () ?
551+ mAWindow->savedOutExtents () :
552+ mWindow->output ());
553+
554+ int wx = winRect.x ();
555+ int wy = winRect.y ();
556+ int owidth = outRect.width ();
557+ int oheight = outRect.height ();
558+
559+ float t = 1 - progressLinear ();
560+ if (mCurWindowEvent == WindowEventClose)
561+ t = 1 - t;
562+
563+ float amplitude = AnimJCScreen::get (screen)->optionGetFlickerAmplitude ();
564+ float waveLength = 0.4;
565+ float wavePosition = -waveLength + (1. + waveLength) * t;
566+
567+ float displacement = 0;
568+
569+ GridModel::GridObject *object = mModel->objects ();
570+ unsigned int n = mModel->numObjects ();
571+ for (unsigned int i = 0; i < n; i++, object++)
572+ {
573+ Point3d &objPos = object->position ();
574+
575+ if (i % 2 == 0) // left side; reuse old displacement on right side
576+ {
577+ float distFromWave = object->gridPosition ().y () - wavePosition;
578+
579+ if (distFromWave > 0 && distFromWave <= waveLength)
580+ {
581+ displacement = amplitude * sin (distFromWave/waveLength * M_PI);
582+ }
583+ else
584+ {
585+ displacement = 0;
586+ }
587+ }
588+
589+ float x = wx + mModel->scale ().x () *
590+ (owidth * object->gridPosition ().x () - outExtents.left);
591+
592+ float y = wy + mModel->scale ().y () *
593+ (oheight * object->gridPosition ().y () - outExtents.top);
594+
595+ switch (layer)
596+ {
597+ case 1:
598+ x -= displacement;
599+ break;
600+ case 2:
601+ x += displacement;
602+ break;
603+ case 3:
604+ y -= displacement;
605+ break;
606+ case 4:
607+ y += displacement;
608+ break;
609+ default:
610+ break;
611+ }
612+
613+ objPos.setX (x);
614+ objPos.setY (y);
615+ objPos.setZ (0);
616+ }
617+}
618
619=== added file 'plugins/animationjc/src/ghost.cpp'
620--- plugins/animationjc/src/ghost.cpp 1970-01-01 00:00:00 +0000
621+++ plugins/animationjc/src/ghost.cpp 2016-06-01 03:18:30 +0000
622@@ -0,0 +1,98 @@
623+#include "private.h"
624+
625+GhostAnim::GhostAnim (CompWindow *w,
626+ WindowEvent curWindowEvent,
627+ float duration,
628+ const AnimEffect info,
629+ const CompRect &icon) :
630+ Animation::Animation (w, curWindowEvent, duration, info, icon),
631+ TransformAnim::TransformAnim (w, curWindowEvent, duration, info, icon),
632+ GridTransformAnim::GridTransformAnim (w, curWindowEvent, duration, info,
633+ icon)
634+{
635+}
636+
637+void
638+GhostAnim::updateAttrib (GLWindowPaintAttrib &attrib)
639+{
640+ AnimJCScreen *ajs = AnimJCScreen::get (screen);
641+ attrib.opacity *= 1. - progressLinear ();
642+ attrib.saturation *= ajs->optionGetGhostSaturation ();
643+}
644+
645+void
646+GhostAnim::initGrid ()
647+{
648+ AnimJCScreen *ajs = AnimJCScreen::get (screen);
649+ mGridWidth = ajs->optionGetGhostGrid ();
650+ mGridHeight = ajs->optionGetGhostGrid ();
651+}
652+
653+void
654+GhostAnim::step ()
655+{
656+ float t = 1. - progressLinear ();
657+ if (mCurWindowEvent == WindowEventClose)
658+ t = 1. - t;
659+
660+ CompRect winRect (mAWindow->savedRectsValid () ?
661+ mAWindow->saveWinRect () :
662+ mWindow->geometry ());
663+ CompRect outRect (mAWindow->savedRectsValid () ?
664+ mAWindow->savedOutRect () :
665+ mWindow->outputRect ());
666+ CompWindowExtents outExtents (mAWindow->savedRectsValid () ?
667+ mAWindow->savedOutExtents () :
668+ mWindow->output ());
669+
670+ int wx = winRect.x ();
671+ int wy = winRect.y ();
672+
673+ int owidth = outRect.width ();
674+ int oheight = outRect.height ();
675+
676+ AnimJCScreen *ajs = AnimJCScreen::get (screen);
677+
678+ float waveAmp = 3 * ajs->optionGetGhostAmplitude ();
679+ float waveLengthX1 = 0.4;
680+ float waveLengthX2 = 0.3;
681+ float waveLengthY1 = 0.45;
682+ float waveLengthY2 = 0.35;
683+ float wavePositionX1 = 0.25 * t * ajs->optionGetGhostWaveSpeed ();
684+ float wavePositionX2 = -0.25 * t * ajs->optionGetGhostWaveSpeed ();
685+ float wavePositionY1 = 0.25 * t * ajs->optionGetGhostWaveSpeed ();
686+ float wavePositionY2 = -0.25 * t * ajs->optionGetGhostWaveSpeed ();
687+
688+ GridModel::GridObject *object = mModel->objects ();
689+ unsigned int n = mModel->numObjects ();
690+ for (unsigned int i = 0; i < n; i++, object++)
691+ {
692+ Point3d &objPos = object->position ();
693+
694+ float origx = wx + mModel->scale ().x () *
695+ (owidth * object->gridPosition ().x () -
696+ outExtents.left);
697+
698+ float origy = wy + mModel->scale ().y () *
699+ (oheight * object->gridPosition ().y () -
700+ outExtents.top);
701+
702+ float x = object->gridPosition ().x ();
703+ float y = object->gridPosition ().y ();
704+
705+ float distFromWaveX1 = x - wavePositionX1;
706+ float distFromWaveX2 = x - wavePositionX2;
707+ float distFromWaveY1 = y - wavePositionY1;
708+ float distFromWaveY2 = y - wavePositionY2;
709+
710+ objPos.setX (origx +
711+ waveAmp * sin (distFromWaveX1 / waveLengthX1 * 2 * M_PI) +
712+ waveAmp * sin (distFromWaveX2 / waveLengthX2 * 2 * M_PI));
713+
714+ objPos.setY (origy +
715+ waveAmp * sin (distFromWaveY1 / waveLengthY1 * 2 * M_PI) +
716+ waveAmp * sin (distFromWaveY2 / waveLengthY2 * 2 * M_PI));
717+
718+ objPos.setZ (0);
719+ }
720+}
721
722=== added file 'plugins/animationjc/src/popcorn.cpp'
723--- plugins/animationjc/src/popcorn.cpp 1970-01-01 00:00:00 +0000
724+++ plugins/animationjc/src/popcorn.cpp 2016-06-01 03:18:30 +0000
725@@ -0,0 +1,60 @@
726+#include <private.h>
727+
728+#define WIN_X(w) ((w)->x () - (w)->input ().left)
729+#define WIN_Y(w) ((w)->y () - (w)->input ().top)
730+#define WIN_W(w) ((w)->width () + (w)->input ().left + (w)->input ().right)
731+#define WIN_H(w) ((w)->height () + (w)->input ().top + (w)->input ().bottom)
732+
733+float
734+PopcornSingleAnim::layerProgress (int layer)
735+{
736+ if (layer == 0)
737+ return 0;
738+
739+ float tStart = (5. - layer) / 6.;
740+ float tEnd = tStart + 1./3.;
741+
742+ float t = progressLinear ();
743+
744+ if (t < tStart)
745+ return 0;
746+
747+ if (t > tEnd)
748+ return 1;
749+
750+ return (t - tStart) / (tEnd - tStart);
751+}
752+
753+void
754+PopcornSingleAnim::updateAttrib (GLWindowPaintAttrib &attrib)
755+{
756+ int layer = MultiAnim <PopcornSingleAnim, 6>::getCurrAnimNumber (mAWindow);
757+
758+ attrib.opacity *= 1. - progressLinear ();
759+
760+ attrib.opacity *= 1. - layerProgress (layer);
761+}
762+
763+void
764+PopcornSingleAnim::applyTransform ()
765+{
766+ int layer = MultiAnim <PopcornSingleAnim, 6>::getCurrAnimNumber (mAWindow);
767+
768+ if (layer == 0) return;
769+
770+ float p = layerProgress (layer);
771+
772+ float v = 40.;
773+ float theta = (54. + 144.*(layer-1)) / 180. * 3.14159265;
774+ float dx = v * cos (theta) * p;
775+ float dy = -v * sin (theta) * p;
776+
777+ mTransform.translate (dx, dy,
778+ 0.16*p*AnimJCScreen::get (screen)->optionGetPopcornKernelHeight ());
779+}
780+
781+void
782+PopcornSingleAnim::updateBB (CompOutput &output)
783+{
784+ TransformAnim::updateBB (output);
785+}
786
787=== added file 'plugins/animationjc/src/private.h'
788--- plugins/animationjc/src/private.h 1970-01-01 00:00:00 +0000
789+++ plugins/animationjc/src/private.h 2016-06-01 03:18:30 +0000
790@@ -0,0 +1,232 @@
791+#include <string.h>
792+#include <stdlib.h>
793+#include <math.h>
794+
795+#include <core/core.h>
796+#include <composite/composite.h>
797+#include <opengl/opengl.h>
798+
799+#include <boost/foreach.hpp>
800+#define foreach BOOST_FOREACH
801+
802+#include <animation/animation.h>
803+#include <animationjc/animationjc.h>
804+
805+#include "animationjc_options.h"
806+
807+extern AnimEffect AnimEffectBlackHole;
808+extern AnimEffect AnimEffectFlicker;
809+extern AnimEffect AnimEffectGhost;
810+extern AnimEffect AnimEffectPopcorn;
811+extern AnimEffect AnimEffectRaindrop;
812+
813+#define NUM_EFFECTS 5
814+
815+// This must have the value of the first "effect setting" above
816+// in AnimJCScreenOptions
817+#define NUM_NONEFFECT_OPTIONS 0
818+
819+class ExtensionPluginAnimJC : public ExtensionPluginInfo
820+{
821+public:
822+ ExtensionPluginAnimJC (const CompString &name,
823+ unsigned int nEffects,
824+ AnimEffect *effects,
825+ CompOption::Vector *effectOptions,
826+ unsigned int firstEffectOptionIndex) :
827+ ExtensionPluginInfo (name, nEffects, effects, effectOptions,
828+ firstEffectOptionIndex) {}
829+ ~ExtensionPluginAnimJC () {}
830+
831+ const CompOutput *output () { return mOutput; }
832+
833+private:
834+ const CompOutput *mOutput;
835+};
836+
837+class AnimJCScreen :
838+ public PluginClassHandler<AnimJCScreen, CompScreen>,
839+ public AnimationjcOptions
840+{
841+public:
842+ AnimJCScreen (CompScreen *);
843+ ~AnimJCScreen ();
844+
845+ int getIntenseTimeStep ();
846+
847+ void initAnimationList ();
848+
849+private:
850+ PrivateAnimJCScreen *priv;
851+};
852+
853+class PrivateAnimJCScreen
854+{
855+ friend class AnimJCScreen;
856+
857+public:
858+ PrivateAnimJCScreen (CompScreen *);
859+ ~PrivateAnimJCScreen ();
860+
861+protected:
862+ CompOutput &mOutput;
863+};
864+
865+class AnimJCWindow :
866+ public PluginClassHandler<AnimJCWindow, CompWindow>
867+{
868+public:
869+ AnimJCWindow (CompWindow *);
870+ ~AnimJCWindow ();
871+
872+protected:
873+ CompWindow *mWindow; ///< Window being animated.
874+ AnimWindow *aWindow;
875+};
876+
877+/*** BLACK HOLE **************************************************************/
878+
879+class BlackHoleAnim :
880+ public GridTransformAnim
881+{
882+public:
883+ BlackHoleAnim (CompWindow *w,
884+ WindowEvent curWindowEvent,
885+ float duration,
886+ const AnimEffect info,
887+ const CompRect &icon);
888+
889+ float getBlackHoleProgress () { return progressLinear (); }
890+
891+ void initGrid ();
892+ inline bool using3D () { return false; }
893+ void step ();
894+};
895+
896+/*** RAINDROP ****************************************************************/
897+
898+class RaindropAnim :
899+ public GridTransformAnim
900+{
901+public:
902+ RaindropAnim (CompWindow *w,
903+ WindowEvent curWindowEvent,
904+ float duration,
905+ const AnimEffect info,
906+ const CompRect &icon);
907+
908+ void initGrid ();
909+
910+ inline bool using3D () { return true; }
911+
912+ void step ();
913+};
914+
915+/*** POPCORN *****************************************************************/
916+
917+class PopcornSingleAnim :
918+ public TransformAnim
919+{
920+public:
921+ PopcornSingleAnim (CompWindow *w,
922+ WindowEvent curWindowEvent,
923+ float duration,
924+ const AnimEffect info,
925+ const CompRect &icon) :
926+ Animation::Animation
927+ (w, curWindowEvent, duration, info, icon),
928+ TransformAnim::TransformAnim
929+ (w, curWindowEvent, duration, info, icon)
930+ {
931+ }
932+
933+ float layerProgress (int);
934+
935+ void applyTransform ();
936+
937+ void updateAttrib (GLWindowPaintAttrib &);
938+
939+ void updateBB (CompOutput &output);
940+ bool updateBBUsed () { return true; }
941+};
942+
943+class PopcornAnim :
944+ public MultiAnim <PopcornSingleAnim, 6>
945+{
946+public:
947+ PopcornAnim (CompWindow *w,
948+ WindowEvent curWindowEvent,
949+ float duration,
950+ const AnimEffect info,
951+ const CompRect &icon) :
952+ MultiAnim <PopcornSingleAnim, 6>::MultiAnim
953+ (w, curWindowEvent, duration, info, icon)
954+ {
955+ }
956+};
957+
958+/*** GHOST *******************************************************************/
959+
960+class GhostAnim :
961+ public GridTransformAnim
962+{
963+public:
964+ GhostAnim (CompWindow *w,
965+ WindowEvent curWindowEvent,
966+ float duration,
967+ const AnimEffect info,
968+ const CompRect &icon);
969+
970+ void initGrid ();
971+
972+ inline bool using3D () { return true; }
973+
974+ void step ();
975+
976+ void updateAttrib (GLWindowPaintAttrib &);
977+};
978+
979+/*** FLICKER *****************************************************************/
980+
981+class FlickerSingleAnim :
982+ public GridTransformAnim
983+{
984+public:
985+ FlickerSingleAnim (CompWindow *w,
986+ WindowEvent curWindowEvent,
987+ float duration,
988+ const AnimEffect info,
989+ const CompRect &icon) :
990+ Animation::Animation
991+ (w, curWindowEvent, duration, info, icon),
992+ TransformAnim::TransformAnim
993+ (w, curWindowEvent, duration, info, icon),
994+ GridTransformAnim::GridTransformAnim
995+ (w, curWindowEvent, duration, info, icon)
996+ {
997+ }
998+
999+ void updateAttrib (GLWindowPaintAttrib &);
1000+
1001+ void initGrid ();
1002+
1003+ void step ();
1004+
1005+ bool updateBBUsed () { return true; }
1006+ void updateBB (CompOutput &output) { TransformAnim::updateBB (output); }
1007+};
1008+
1009+class FlickerAnim :
1010+ public MultiAnim <FlickerSingleAnim, 5>
1011+{
1012+public:
1013+ FlickerAnim (CompWindow *w,
1014+ WindowEvent curWindowEvent,
1015+ float duration,
1016+ const AnimEffect info,
1017+ const CompRect &icon) :
1018+ MultiAnim <FlickerSingleAnim, 5>::MultiAnim
1019+ (w, curWindowEvent, duration, info, icon)
1020+ {
1021+ }
1022+};
1023
1024=== added file 'plugins/animationjc/src/raindrop.cpp'
1025--- plugins/animationjc/src/raindrop.cpp 1970-01-01 00:00:00 +0000
1026+++ plugins/animationjc/src/raindrop.cpp 2016-06-01 03:18:30 +0000
1027@@ -0,0 +1,85 @@
1028+#include "private.h"
1029+
1030+#include <algorithm>
1031+
1032+RaindropAnim::RaindropAnim (CompWindow *w,
1033+ WindowEvent curWindowEvent,
1034+ float duration,
1035+ const AnimEffect info,
1036+ const CompRect &icon) :
1037+ Animation::Animation (w, curWindowEvent, duration, info, icon),
1038+ TransformAnim::TransformAnim (w, curWindowEvent, duration, info, icon),
1039+ GridTransformAnim::GridTransformAnim (w, curWindowEvent, duration, info,
1040+ icon)
1041+{
1042+}
1043+
1044+void
1045+RaindropAnim::initGrid ()
1046+{
1047+ mGridWidth = 20;
1048+ mGridHeight = 20;
1049+}
1050+
1051+void
1052+RaindropAnim::step ()
1053+{
1054+ float t = 1. - progressLinear ();
1055+ if (mCurWindowEvent == WindowEventClose)
1056+ t = 1. - t;
1057+
1058+ CompRect winRect (mAWindow->savedRectsValid () ?
1059+ mAWindow->saveWinRect () :
1060+ mWindow->geometry ());
1061+ CompRect outRect (mAWindow->savedRectsValid () ?
1062+ mAWindow->savedOutRect () :
1063+ mWindow->outputRect ());
1064+ CompWindowExtents outExtents (mAWindow->savedRectsValid () ?
1065+ mAWindow->savedOutExtents () :
1066+ mWindow->output ());
1067+
1068+ int wx = winRect.x ();
1069+ int wy = winRect.y ();
1070+
1071+ int owidth = outRect.width ();
1072+ int oheight = outRect.height ();
1073+
1074+ AnimJCScreen *ajs = AnimJCScreen::get (screen);
1075+
1076+ float waveLength = ajs->optionGetRaindropWavelength ();
1077+ int numWaves = ajs->optionGetRaindropNumWaves ();
1078+ float waveAmp = (pow ((float)oheight / ::screen->height (), 0.4) * 0.08) *
1079+ ajs->optionGetRaindropAmplitude ();
1080+ float wavePosition = -waveLength * numWaves +
1081+ (1. + waveLength * numWaves) * t;
1082+
1083+ GridModel::GridObject *object = mModel->objects ();
1084+ unsigned int n = mModel->numObjects ();
1085+ for (unsigned int i = 0; i < n; i++, object++)
1086+ {
1087+ Point3d &objPos = object->position ();
1088+
1089+ float origx = wx + mModel->scale ().x () *
1090+ (owidth * object->gridPosition ().x () -
1091+ outExtents.left);
1092+ objPos.setX (origx);
1093+
1094+ float origy = wy + mModel->scale ().y () *
1095+ (oheight * object->gridPosition ().y () -
1096+ outExtents.top);
1097+ objPos.setY (origy);
1098+
1099+ // find distance to center in grid terms
1100+ float gridDistance = sqrt (pow (object->gridPosition ().x ()-0.5, 2) +
1101+ pow (object->gridPosition ().y ()-0.5, 2)) *
1102+ sqrt (2);
1103+
1104+ float distFromWave = gridDistance - wavePosition;
1105+ if (distFromWave < waveLength*numWaves && distFromWave > 0)
1106+ objPos.setZ (waveAmp *
1107+ sin (3.14159265 * distFromWave / waveLength / numWaves) *
1108+ pow (sin (3.14159265 * distFromWave / waveLength), 2));
1109+ else
1110+ objPos.setZ (0);
1111+ }
1112+}

Subscribers

People subscribed via source and target branches