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

Proposed by Sam Spilsbury on 2016-05-24
Status: Rejected
Rejected by: Sam Spilsbury on 2016-07-09
Proposed branch: lp:~smspillaz/compiz/compiz.simple-animations-returns
Merge into: lp:compiz/0.9.12
Prerequisite: lp:~smspillaz/compiz/compiz.animationaddon-returns
Diff against target: 1821 lines (+1726/-0)
15 files modified
debian/compiz-plugins.install (+2/-0)
debian/compiz-plugins.install.armel (+2/-0)
debian/compiz-plugins.install.armhf (+2/-0)
plugins/simple-animations/CMakeLists.txt (+8/-0)
plugins/simple-animations/animationsim.xml.in (+235/-0)
plugins/simple-animations/src/animationsim.cpp (+164/-0)
plugins/simple-animations/src/animationsim.h (+405/-0)
plugins/simple-animations/src/bounce.cpp (+76/-0)
plugins/simple-animations/src/expand-piecewise.cpp (+90/-0)
plugins/simple-animations/src/expand.cpp (+70/-0)
plugins/simple-animations/src/fan.cpp (+51/-0)
plugins/simple-animations/src/flyin.cpp (+86/-0)
plugins/simple-animations/src/pulse.cpp (+50/-0)
plugins/simple-animations/src/rotatein.cpp (+210/-0)
plugins/simple-animations/src/sheet.cpp (+275/-0)
To merge this branch: bzr merge lp:~smspillaz/compiz/compiz.simple-animations-returns
Reviewer Review Type Date Requested Status
Sam Spilsbury Resubmit on 2016-07-09
Marco Trevisan (Treviño) 2016-05-24 Needs Fixing on 2016-05-30
PS Jenkins bot continuous-integration Pending
Review via email: mp+295533@code.launchpad.net

Commit Message

simple-animations: import plugin

Description of the Change

Re-import the simple-animations plugin (thanks MC Return!)

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

Same here: add this to debian/compiz-plugins.install file as well.

Sam Spilsbury (smspillaz) wrote :

Done

Marco Trevisan (Treviño) (3v1n0) wrote :

Ouch no... The basename is animationsim.{xml,so}

review: Needs Fixing
Sam Spilsbury (smspillaz) wrote :

D'oh, of course, how could I forget

4025. By Sam Spilsbury <email address hidden> on 2016-05-30

Merge lp:compiz

Sam Spilsbury (smspillaz) wrote :

These all need to be resubmitted to lp:compiz anyway

review: Resubmit

Unmerged revisions

4025. By Sam Spilsbury <email address hidden> on 2016-05-30

Merge lp:compiz

4024. By Sam Spilsbury <email address hidden> on 2016-05-26

debian: Add simple-animations to compiz-plugins

4023. By Sam Spilsbury <email address hidden> on 2016-05-24

simple-animations: Add and merge the simple-animations plugin

(Thanks MC-Return!)

4022. By Sam Spilsbury <email address hidden> on 2016-05-23

CMakeLists: Enable building animationaddon

4021. By Sam Spilsbury <email address hidden> on 2016-05-23

animationaddon: Provide damage box for dissolveAnim

4020. By Sam Spilsbury <email address hidden> on 2016-05-23

animationaddon: Use opacity which actually fades out for dissolve.

4019. By Sam Spilsbury <email address hidden> on 2016-05-23

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> on 2016-05-23

animation: Just set values in paint attrib directly

4017. By Sam Spilsbury <email address hidden> on 2016-05-23

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> on 2016-05-23

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-05-13 09:45:31 +0000
3+++ debian/compiz-plugins.install 2016-05-30 14:34:38 +0000
4@@ -2,6 +2,8 @@
5 usr/share/compiz/*addhelper.*
6 usr/lib/*/compiz/*annotate.*
7 usr/share/compiz/*annotate.*
8+usr/lib/*/compiz/*animationsim.*
9+usr/share/compiz/*animationsim.*
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 2014-12-02 14:42:34 +0000
16+++ debian/compiz-plugins.install.armel 2016-05-30 14:34:38 +0000
17@@ -2,6 +2,8 @@
18 usr/share/compiz/*addhelper.*
19 usr/lib/*/compiz/*annotate.*
20 usr/share/compiz/*annotate.*
21+usr/lib/*/compiz/*animationsim.*
22+usr/share/compiz/*animationsim.*
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 2014-12-02 14:42:34 +0000
29+++ debian/compiz-plugins.install.armhf 2016-05-30 14:34:38 +0000
30@@ -2,6 +2,8 @@
31 usr/share/compiz/*addhelper.*
32 usr/lib/*/compiz/*annotate.*
33 usr/share/compiz/*annotate.*
34+usr/lib/*/compiz/*animationsim.*
35+usr/share/compiz/*animationsim.*
36 usr/lib/*/compiz/*clone.*
37 usr/share/compiz/*clone.*
38 usr/lib/*/compiz/*crashhandler.*
39
40=== added directory 'plugins/simple-animations'
41=== added file 'plugins/simple-animations/CMakeLists.txt'
42--- plugins/simple-animations/CMakeLists.txt 1970-01-01 00:00:00 +0000
43+++ plugins/simple-animations/CMakeLists.txt 2016-05-30 14:34:38 +0000
44@@ -0,0 +1,8 @@
45+find_package (Compiz REQUIRED)
46+
47+include (FindOpenGL)
48+include (CompizPlugin)
49+
50+if (OPENGL_GLU_FOUND)
51+ compiz_plugin (animationsim PLUGINDEPS composite opengl animation LIBRARIES ${OPENGL_glu_LIBRARY} INCDIRS ${OPENGL_INCLUDE_DIR})
52+endif (OPENGL_GLU_FOUND)
53
54=== added file 'plugins/simple-animations/animationsim.xml.in'
55--- plugins/simple-animations/animationsim.xml.in 1970-01-01 00:00:00 +0000
56+++ plugins/simple-animations/animationsim.xml.in 2016-05-30 14:34:38 +0000
57@@ -0,0 +1,235 @@
58+<compiz>
59+ <plugin name="animationsim" useBcop="true">
60+ <_short>Simple Animations</_short>
61+ <_long>Animations that are simple on the eye</_long>
62+ <category>Effects</category>
63+ <deps>
64+ <requirement>
65+ <plugin>animation</plugin>
66+ </requirement>
67+ <relation type="after">
68+ <plugin>animation</plugin>
69+ </relation>
70+ </deps>
71+ <options>
72+
73+ <group>
74+ <_short>Effect Settings</_short>
75+
76+ <subgroup>
77+ <_short>Fly In</_short>
78+ <option name="flyin_direction" type="int">
79+ <_short>Fly In Direction</_short>
80+ <_long>The direction in which the fly in should take place</_long>
81+ <default>0</default>
82+ <desc>
83+ <value>0</value>
84+ <name>Up</name>
85+ </desc>
86+ <desc>
87+ <value>1</value>
88+ <name>Left</name>
89+ </desc>
90+ <desc>
91+ <value>2</value>
92+ <name>Down</name>
93+ </desc>
94+ <desc>
95+ <value>3</value>
96+ <name>Right</name>
97+ </desc>
98+ <desc>
99+ <value>4</value>
100+ <name>User Defined</name>
101+ </desc>
102+ <min>0</min>
103+ <max>4</max>
104+ </option>
105+ <option name="flyin_direction_x" type="float">
106+ <_short>UD Direction X</_short>
107+ <_long>Direction and Distance X for user defined fly in</_long>
108+ <default>0</default>
109+ <min>-1000</min>
110+ <max>1000</max>
111+ <precision>0.01</precision>
112+ </option>
113+ <option name="flyin_direction_y" type="float">
114+ <_short>UD Direction Y</_short>
115+ <_long>Direction and Distance Y for user defined fly in</_long>
116+ <default>0</default>
117+ <min>-1000</min>
118+ <max>1000</max>
119+ <precision>0.01</precision>
120+ </option>
121+ <option name="flyin_fade" type="bool">
122+ <_short>Fade</_short>
123+ <_long>Fade when flying in</_long>
124+ <default>True</default>
125+ </option>
126+ <option name="flyin_distance" type="float">
127+ <_short>Distance</_short>
128+ <_long>Distance to fly in</_long>
129+ <default>20</default>
130+ <min>5</min>
131+ <max>1000</max>
132+ <precision>0.01</precision>
133+ </option>
134+ </subgroup>
135+ <subgroup>
136+ <_short>Rotate In</_short>
137+ <option name="rotatein_direction" type="int">
138+ <_short>Rotate In Direction</_short>
139+ <_long>The direction in which the window rotates</_long>
140+ <default>3</default>
141+ <desc>
142+ <value>1</value>
143+ <name>Up</name>
144+ </desc>
145+ <desc>
146+ <value>2</value>
147+ <name>Left</name>
148+ </desc>
149+ <desc>
150+ <value>3</value>
151+ <name>Down</name>
152+ </desc>
153+ <desc>
154+ <value>4</value>
155+ <name>Right</name>
156+ </desc>
157+ <min>1</min>
158+ <max>4</max>
159+ </option>
160+ <option name="rotatein_angle" type="float">
161+ <_short>Angle</_short>
162+ <_long>Angle to start from</_long>
163+ <default>90</default>
164+ <min>-720</min>
165+ <max>720</max>
166+ </option>
167+ </subgroup>
168+ <subgroup>
169+ <_short>Bounce</_short>
170+ <option name="bounce_max_size" type="float">
171+ <_short>Maximum Size</_short>
172+ <_long>Maximum scale factor of window when bouncing</_long>
173+ <default>1.2</default>
174+ <min>1.0</min>
175+ <max>3.0</max>
176+ </option>
177+ <option name="bounce_min_size" type="float">
178+ <_short>Minimum Size</_short>
179+ <_long>Minimum scale factor of window when bouncing</_long>
180+ <default>0.6</default>
181+ <min>0.1</min>
182+ <max>1.0</max>
183+ </option>
184+ <option name="bounce_number" type="int">
185+ <_short>Number of Bounces</_short>
186+ <_long>How many bounces during the animation</_long>
187+ <default>3</default>
188+ <min>0</min>
189+ <max>10</max>
190+ </option>
191+ <option name="bounce_fade" type="bool">
192+ <_short>Fade</_short>
193+ <_long>Fade when flying in</_long>
194+ <default>True</default>
195+ </option>
196+ </subgroup>
197+ <subgroup>
198+ <_short>Sheet</_short>
199+ <option name="sheet_start_percent" type="float">
200+ <_short>Starting Percent</_short>
201+ <_long>How wide the beginning of the sheet animation should be compared to the end</_long>
202+ <default>80.0</default>
203+ <min>1.0</min>
204+ <max>150.0</max>
205+ </option>
206+ </subgroup>
207+ <subgroup>
208+ <_short>Fan</_short>
209+ <option name="fan_angle" type="float">
210+ <_short>Fan Angle</_short>
211+ <_long>Angle of windows away from the main window</_long>
212+ <default>35</default>
213+ <min>0</min>
214+ <max>90</max>
215+ <precision>0.1</precision>
216+ </option>
217+ </subgroup>
218+ <subgroup>
219+ <_short>Expand Piecewise</_short>
220+ <option name="expandpw_horiz_first" type="bool">
221+ <_short>First expand horizontally</_short>
222+ <_long>If checked, initially expand horizontally, then vertically</_long>
223+ <default>True</default>
224+ </option>
225+ <option name="expandpw_initial_horiz" type="int">
226+ <_short>Initial horizontal size</_short>
227+ <_long>Number of pixels initially in horizontal direction</_long>
228+ <default>20</default>
229+ <min>0</min>
230+ <max>50</max>
231+ </option>
232+ <option name="expandpw_initial_vert" type="int">
233+ <_short>Initial vertical size</_short>
234+ <_long>Number of pixels initially in vertical direction</_long>
235+ <default>20</default>
236+ <min>0</min>
237+ <max>50</max>
238+ </option>
239+ <option name="expandpw_delay" type="float">
240+ <_short>Delay</_short>
241+ <_long>Delay between expanding horizontally and vertically (expressed as a fraction)</_long>
242+ <default>0.25</default>
243+ <min>0.0</min>
244+ <max>1.0</max>
245+ </option>
246+ </subgroup>
247+
248+ </group>
249+
250+ </options>
251+
252+ <extension base_plugin="animation">
253+ <base_option>open_effects</base_option>
254+ <base_option>open_random_effects</base_option>
255+ <base_option>close_effects</base_option>
256+ <base_option>close_random_effects</base_option>
257+ <restriction>
258+ <value>animationsim:Fly In</value>
259+ <_name>Fly In</_name>
260+ </restriction>
261+ <restriction>
262+ <value>animationsim:Bounce</value>
263+ <_name>Bounce</_name>
264+ </restriction>
265+ <restriction>
266+ <value>animationsim:Rotate In</value>
267+ <_name>Rotate In</_name>
268+ </restriction>
269+ <restriction>
270+ <value>animationsim:Sheet</value>
271+ <_name>Sheet</_name>
272+ </restriction>
273+ <restriction>
274+ <value>animationsim:Expand</value>
275+ <_name>Expand</_name>
276+ </restriction>
277+ <restriction>
278+ <value>animationsim:Expand Piecewise</value>
279+ <_name>Expand Piecewise</_name>
280+ </restriction>
281+ <restriction>
282+ <value>animationsim:Pulse</value>
283+ <_name>Pulse</_name>
284+ </restriction>
285+ <restriction>
286+ <value>animationsim:Fan</value>
287+ <_name>Fan</_name>
288+ </restriction>
289+ </extension>
290+
291+ </plugin>
292+</compiz>
293
294=== added directory 'plugins/simple-animations/src'
295=== added file 'plugins/simple-animations/src/animationsim.cpp'
296--- plugins/simple-animations/src/animationsim.cpp 1970-01-01 00:00:00 +0000
297+++ plugins/simple-animations/src/animationsim.cpp 2016-05-30 14:34:38 +0000
298@@ -0,0 +1,164 @@
299+/**
300+ * Example Animation extension plugin for compiz
301+ *
302+ *
303+ * This program is free software; you can redistribute it and/or
304+ * modify it under the terms of the GNU General Public License
305+ * as published by the Free Software Foundation; either version 2
306+ * of the License, or (at your option) any later version.
307+ *
308+ * This program is distributed in the hope that it will be useful,
309+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
310+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
311+ * GNU General Public License for more details.
312+ *
313+ * You should have received a copy of the GNU General Public License
314+ * along with this program; if not, write to the Free Software
315+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
316+ **/
317+
318+#include "animationsim.h"
319+
320+COMPIZ_PLUGIN_20090315 (animationsim, AnimSimPluginVTable);
321+
322+AnimEffect animEffects[NUM_EFFECTS];
323+
324+ExtensionPluginAnimSim animSimExtPluginInfo (CompString ("animationsim"),
325+ NUM_EFFECTS, animEffects, NULL,
326+ NUM_NONEFFECT_OPTIONS);
327+
328+ExtensionPluginInfo *
329+BaseSimAnim::getExtensionPluginInfo ()
330+{
331+ return &animSimExtPluginInfo;
332+}
333+
334+BaseSimAnim::BaseSimAnim (CompWindow *w,
335+ WindowEvent curWindowEvent,
336+ float duration,
337+ const AnimEffect info,
338+ const CompRect &icon) :
339+ Animation::Animation (w, curWindowEvent, duration, info, icon),
340+ mCScreen (CompositeScreen::get (::screen)),
341+ mGScreen (GLScreen::get (::screen))
342+{
343+}
344+
345+AnimEffect AnimEffectFlyIn;
346+AnimEffect AnimEffectRotateIn;
347+AnimEffect AnimEffectExpand;
348+AnimEffect AnimEffectExpandPW;
349+AnimEffect AnimEffectBounce;
350+AnimEffect AnimEffectSheet;
351+AnimEffect AnimEffectPulse;
352+AnimEffect AnimEffectFan;
353+
354+void
355+AnimSimScreen::initAnimationList ()
356+{
357+ int i = 0;
358+ AnimEffectUsedFor usedFor = AnimEffectUsedFor::all()
359+ .exclude(AnimEventFocus)
360+ .exclude(AnimEventShade);
361+ AnimEffectUsedFor openUsedFor = AnimEffectUsedFor::all()
362+ .exclude(AnimEventFocus)
363+ .exclude(AnimEventShade)
364+ .exclude(AnimEventMinimize)
365+ .exclude(AnimEventUnminimize);
366+
367+ animEffects[i++] = AnimEffectFlyIn =
368+ new AnimEffectInfo ("animationsim:Fly In", usedFor,
369+ &createAnimation<FlyInAnim>);
370+
371+ animEffects[i++] = AnimEffectRotateIn =
372+ new AnimEffectInfo ("animationsim:Rotate In", usedFor,
373+ &createAnimation<RotateInAnim>);
374+
375+ animEffects[i++] = AnimEffectExpand =
376+ new AnimEffectInfo ("animationsim:Expand", usedFor,
377+ &createAnimation<ExpandAnim>);
378+
379+ animEffects[i++] = AnimEffectExpandPW =
380+ new AnimEffectInfo ("animationsim:Expand Piecewise", usedFor,
381+ &createAnimation<ExpandPWAnim>);
382+
383+ animEffects[i++] = AnimEffectBounce =
384+ new AnimEffectInfo ("animationsim:Bounce", openUsedFor,
385+ &createAnimation<BounceAnim>);
386+
387+ animEffects[i++] = AnimEffectSheet =
388+ new AnimEffectInfo ("animationsim:Sheet", openUsedFor,
389+ &createAnimation<SheetAnim>);
390+ animEffects[i++] = AnimEffectPulse =
391+ new AnimEffectInfo ("animationsim:Pulse", openUsedFor,
392+ &createAnimation<PulseAnim>);
393+ animEffects[i++] = AnimEffectFan =
394+ new AnimEffectInfo ("animationsim:Fan", openUsedFor,
395+ &createAnimation<FanAnim>);
396+
397+ animSimExtPluginInfo.effectOptions = &getOptions ();
398+
399+ AnimScreen *as = AnimScreen::get (::screen);
400+
401+ // Extends animation plugin with this set of animation effects.
402+ as->addExtension (&animSimExtPluginInfo);
403+}
404+
405+AnimSimScreen::AnimSimScreen (CompScreen *s) :
406+ //cScreen (CompositeScreen::get (s)),
407+ //gScreen (GLScreen::get (s)),
408+ //aScreen (as),
409+ PluginClassHandler <AnimSimScreen, CompScreen> (s),
410+ mOutput (s->fullscreenOutput ())
411+{
412+ initAnimationList ();
413+}
414+
415+AnimSimScreen::~AnimSimScreen ()
416+{
417+ AnimScreen *as = AnimScreen::get (::screen);
418+
419+ as->removeExtension (&animSimExtPluginInfo);
420+
421+ for (int i = 0; i < NUM_EFFECTS; i++)
422+ {
423+ delete animEffects[i];
424+ animEffects[i] = NULL;
425+ }
426+}
427+
428+AnimSimWindow::AnimSimWindow (CompWindow *w) :
429+ PluginClassHandler<AnimSimWindow, CompWindow> (w),
430+ mWindow (w),
431+ aWindow (AnimWindow::get (w))
432+{
433+}
434+
435+AnimSimWindow::~AnimSimWindow ()
436+{
437+ Animation *curAnim = aWindow->curAnimation ();
438+
439+ if (!curAnim)
440+ return;
441+
442+ // We need to interrupt and clean up the animation currently being played
443+ // by animationsim for this window (if any)
444+ if (curAnim->remainingTime () > 0 &&
445+ curAnim->getExtensionPluginInfo ()->name ==
446+ CompString ("animationsim"))
447+ {
448+ aWindow->postAnimationCleanUp ();
449+ }
450+}
451+
452+bool
453+AnimSimPluginVTable::init ()
454+{
455+ if (!CompPlugin::checkPluginABI ("core", CORE_ABIVERSION) |
456+ !CompPlugin::checkPluginABI ("composite", COMPIZ_COMPOSITE_ABI) |
457+ !CompPlugin::checkPluginABI ("opengl", COMPIZ_OPENGL_ABI) |
458+ !CompPlugin::checkPluginABI ("animation", ANIMATION_ABI))
459+ return false;
460+
461+ return true;
462+}
463
464=== added file 'plugins/simple-animations/src/animationsim.h'
465--- plugins/simple-animations/src/animationsim.h 1970-01-01 00:00:00 +0000
466+++ plugins/simple-animations/src/animationsim.h 2016-05-30 14:34:38 +0000
467@@ -0,0 +1,405 @@
468+#include <string.h>
469+#include <stdlib.h>
470+#include <math.h>
471+
472+#include <core/core.h>
473+#include <composite/composite.h>
474+#include <opengl/opengl.h>
475+#include <animation/animation.h>
476+
477+#include "animationsim_options.h"
478+
479+extern AnimEffect AnimEffectFlyIn;
480+extern AnimEffect AnimEffectBounce;
481+extern AnimEffect AnimEffectRotateIn;
482+extern AnimEffect AnimEffectSheet;
483+extern AnimEffect AnimEffectExpand;
484+extern AnimEffect AnimEffectExpandPW;
485+extern AnimEffect AnimEffectFan;
486+
487+// TODO Update this for each added animation effect! (total: 8)
488+#define NUM_EFFECTS 8
489+
490+// This must have the value of the first "effect setting" above
491+// in AnimAddonScreenOptions
492+#define NUM_NONEFFECT_OPTIONS AnimationsimOptions::FlyinDirection
493+
494+#define WIN_X(w) ((w)->x () - (w)->input ().left)
495+#define WIN_Y(w) ((w)->y () - (w)->input ().top)
496+#define WIN_W(w) ((w)->width () + (w)->input ().left + (w)->input ().right)
497+#define WIN_H(w) ((w)->height () + (w)->input ().top + (w)->input ().bottom)
498+
499+class ExtensionPluginAnimSim : public ExtensionPluginInfo
500+{
501+public:
502+ ExtensionPluginAnimSim (const CompString &name,
503+ unsigned int nEffects,
504+ AnimEffect *effects,
505+ CompOption::Vector *effectOptions,
506+ unsigned int firstEffectOptionIndex) :
507+ ExtensionPluginInfo (name, nEffects, effects, effectOptions,
508+ firstEffectOptionIndex) {}
509+ ~ExtensionPluginAnimSim () {}
510+
511+ const CompOutput *output () { return mOutput; }
512+
513+private:
514+ const CompOutput *mOutput;
515+};
516+
517+/// Base class for all polygon- and particle-based animations
518+class BaseSimAnim :
519+virtual public Animation
520+{
521+public:
522+ BaseSimAnim (CompWindow *w,
523+ WindowEvent curWindowEvent,
524+ float duration,
525+ const AnimEffect info,
526+ const CompRect &icon);
527+ ~BaseSimAnim () {}
528+
529+protected:
530+ /// Gets info about the extension plugin that implements this animation.
531+ ExtensionPluginInfo *getExtensionPluginInfo ();
532+
533+ CompositeScreen *mCScreen;
534+ GLScreen *mGScreen;
535+
536+};
537+
538+
539+class AnimSimScreen :
540+ public PluginClassHandler <AnimSimScreen, CompScreen>,
541+ public AnimationsimOptions
542+{
543+
544+public:
545+ AnimSimScreen (CompScreen *);
546+ ~AnimSimScreen ();
547+
548+protected:
549+ void initAnimationList ();
550+
551+ CompOutput &mOutput;
552+};
553+
554+class AnimSimWindow :
555+ public PluginClassHandler<AnimSimWindow, CompWindow>
556+{
557+public:
558+ AnimSimWindow (CompWindow *);
559+ ~AnimSimWindow ();
560+
561+protected:
562+ CompWindow *mWindow; ///< Window being animated.
563+ AnimWindow *aWindow;
564+};
565+
566+/*
567+typedef struct _WaveParam
568+{
569+ float halfWidth;
570+ float amp;
571+ float pos;
572+} WaveParam;
573+*/
574+
575+#define ANIMSIM_SCREEN(s) \
576+ AnimSimScreen *ass = AnimSimScreen::get (s);
577+
578+#define ANIMSIM_WINDOW(w) \
579+ AnimSimWindow *asw = AnimSimWindow::get (w);
580+
581+class FlyInAnim : public FadeAnim,
582+ virtual public BaseSimAnim,
583+ virtual public TransformAnim
584+{
585+ public:
586+
587+ FlyInAnim (CompWindow *w,
588+ WindowEvent curWindowEvent,
589+ float duration,
590+ const AnimEffect info,
591+ const CompRect &icon) :
592+ Animation::Animation (w, curWindowEvent, duration, info, icon),
593+ BaseSimAnim::BaseSimAnim (w, curWindowEvent, duration, info, icon),
594+ TransformAnim::TransformAnim (w, curWindowEvent, duration, info, icon),
595+ FadeAnim::FadeAnim (w, curWindowEvent, duration, info, icon) {}
596+
597+ protected:
598+ void step () { TransformAnim::step (); }
599+ bool updateBBUsed () { return true; }
600+ void updateBB (CompOutput &output) { TransformAnim::updateBB (output); }
601+ void applyTransform ();
602+ bool requiresTransformedWindow () const { return true; }
603+
604+ float getFadeProgress ()
605+ {
606+ return progressDecelerate (progressLinear ());
607+ }
608+};
609+
610+class RotateInAnim: public TransformAnim,
611+ virtual public BaseSimAnim
612+{
613+ public:
614+
615+ RotateInAnim (CompWindow *w,
616+ WindowEvent curWindowEvent,
617+ float duration,
618+ const AnimEffect info,
619+ const CompRect &icon) :
620+ Animation::Animation (w, curWindowEvent, duration, info, icon),
621+ BaseSimAnim::BaseSimAnim (w, curWindowEvent, duration, info, icon),
622+ TransformAnim::TransformAnim (w, curWindowEvent, duration, info, icon) {}
623+
624+ protected:
625+
626+ void step () { TransformAnim::step (); }
627+ bool updateBBUsed () { return true; }
628+ void updateBB (CompOutput &output) { TransformAnim::updateBB (output); }
629+ void applyTransform ();
630+ void prePaintWindow ();
631+ void postPaintWindow ();
632+
633+ inline float getProgress ()
634+ {
635+ return progressDecelerate (progressLinear ());
636+ }
637+};
638+
639+class ExpandAnim: public TransformAnim,
640+ virtual public BaseSimAnim
641+{
642+ public:
643+
644+ ExpandAnim (CompWindow *w,
645+ WindowEvent curWindowEvent,
646+ float duration,
647+ const AnimEffect info,
648+ const CompRect &icon) :
649+ Animation::Animation (w, curWindowEvent, duration, info, icon),
650+ BaseSimAnim::BaseSimAnim (w, curWindowEvent, duration, info, icon),
651+ TransformAnim::TransformAnim (w, curWindowEvent, duration, info, icon) {}
652+
653+ protected:
654+
655+ inline float getProgress ()
656+ {
657+ return progressDecelerate (progressLinear ());
658+ }
659+
660+ void applyTransform ();
661+ bool updateBBUsed () { return true; }
662+ void updateBB (CompOutput &output) { TransformAnim::updateBB (output); }
663+};
664+
665+class ExpandPWAnim: public TransformAnim,
666+ virtual public BaseSimAnim
667+{
668+ public:
669+
670+ ExpandPWAnim (CompWindow *w,
671+ WindowEvent curWindowEvent,
672+ float duration,
673+ const AnimEffect info,
674+ const CompRect &icon) :
675+ Animation::Animation (w, curWindowEvent, duration, info, icon),
676+ BaseSimAnim::BaseSimAnim (w, curWindowEvent, duration, info, icon),
677+ TransformAnim::TransformAnim (w, curWindowEvent, duration, info, icon)
678+ {
679+ }
680+
681+ protected:
682+
683+ inline float getProgress ()
684+ {
685+ return progressDecelerate (progressLinear ());
686+ }
687+
688+ void applyTransform ();
689+ bool updateBBUsed () { return true; }
690+ void updateBB (CompOutput &output) { TransformAnim::updateBB (output); }
691+};
692+
693+class BounceAnim: public FadeAnim,
694+ virtual public TransformAnim,
695+ virtual public BaseSimAnim
696+{
697+ public:
698+
699+ BounceAnim (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+ BaseSimAnim::BaseSimAnim (w, curWindowEvent, duration, info, icon),
707+ FadeAnim::FadeAnim (w, curWindowEvent, duration, info, icon)
708+ {
709+ ANIMSIM_SCREEN (screen);
710+
711+ bounceCount = ass->optionGetBounceNumber ();
712+ nBounce = 1;
713+ targetScale = ass->optionGetBounceMinSize ();
714+ currentScale = ass->optionGetBounceMaxSize ();
715+ bounceNeg = false;
716+ currBounceProgress = 0.0f;
717+ lastProgressMax = 0.0f;
718+ }
719+
720+ protected:
721+
722+ void step () { TransformAnim::step (); }
723+ void updateBB (CompOutput &output) { TransformAnim::updateBB (output); }
724+ bool updateBBUsed () { return true; }
725+ bool requiresTransformedWindow () const { return true; }
726+
727+ void applyTransform ();
728+
729+ float getProgress ();
730+ float getFadeProgress ()
731+ {
732+ return progressDecelerate (progressLinear ());
733+ }
734+
735+ int bounceCount;
736+ int nBounce;
737+ float targetScale;
738+ float currentScale;
739+ bool bounceNeg;
740+ float currBounceProgress;
741+ float lastProgressMax;
742+};
743+
744+class SheetAnim : public GridAnim,
745+ virtual public BaseSimAnim
746+{
747+ public:
748+
749+ SheetAnim (CompWindow *w,
750+ WindowEvent curWindowEvent,
751+ float duration,
752+ const AnimEffect info,
753+ const CompRect &icon);
754+
755+ class WaveParam
756+ {
757+ public:
758+ float halfWidth;
759+ float amp;
760+ float pos;
761+ };
762+
763+ protected:
764+
765+ void initGrid ()
766+ {
767+ mGridWidth = 30;
768+ mGridHeight = 30;
769+ }
770+
771+ void step ();
772+ void updateBB (CompOutput &output);
773+ bool updateBBUsed () { return true; }
774+ bool stepRegionUsed () { return true; }
775+
776+ int sheetsWaveCount;
777+ std::vector <WaveParam> sheetsWaves;
778+};
779+
780+class PulseSingleAnim : public TransformAnim,
781+ virtual public FadeAnim,
782+ virtual public BaseSimAnim
783+{
784+ public:
785+
786+ PulseSingleAnim (CompWindow *w,
787+ WindowEvent curWindowEvent,
788+ float duration,
789+ const AnimEffect info,
790+ const CompRect &icon) :
791+ Animation::Animation (w, curWindowEvent, duration, info, icon),
792+ FadeAnim::FadeAnim (w, curWindowEvent, duration, info, icon),
793+ BaseSimAnim::BaseSimAnim (w, curWindowEvent, duration, info, icon),
794+ TransformAnim::TransformAnim (w, curWindowEvent, duration, info, icon) {}
795+
796+ void step () { TransformAnim::step (); }
797+ void updateBB (CompOutput &output) { TransformAnim::updateBB (output); }
798+ bool updateBBUsed () { return true; }
799+
800+ float getProgress () { return progressLinear (); }
801+ float getFadeProgress ();
802+
803+ void applyTransform ();
804+
805+ protected:
806+
807+ bool requiresTransformedWindow () const { return true; }
808+};
809+
810+class PulseAnim : public MultiAnim <PulseSingleAnim, 2>
811+{
812+ public:
813+
814+ PulseAnim (CompWindow *w,
815+ WindowEvent curWindowEvent,
816+ float duration,
817+ const AnimEffect info,
818+ const CompRect &icon) :
819+ MultiAnim <PulseSingleAnim, 2>::MultiAnim
820+ (w, curWindowEvent, duration, info, icon) {}
821+
822+};
823+
824+class FanSingleAnim : public TransformAnim,
825+ virtual public FadeAnim,
826+ virtual public BaseSimAnim
827+{
828+ public:
829+
830+ FanSingleAnim (CompWindow *w,
831+ WindowEvent curWindowEvent,
832+ float duration,
833+ const AnimEffect info,
834+ const CompRect &icon) :
835+ Animation::Animation (w, curWindowEvent, duration, info, icon),
836+ FadeAnim::FadeAnim (w, curWindowEvent, duration, info, icon),
837+ BaseSimAnim::BaseSimAnim (w, curWindowEvent, duration, info, icon),
838+ TransformAnim::TransformAnim (w, curWindowEvent, duration, info, icon) {}
839+
840+ void step () { TransformAnim::step (); }
841+ void updateBB (CompOutput &output) { TransformAnim::updateBB (output); }
842+ bool updateBBUsed () { return true; }
843+
844+ float getProgress () { return progressLinear (); }
845+ float getFadeProgress ();
846+
847+ void applyTransform ();
848+
849+ protected:
850+
851+ bool requiresTransformedWindow () const { return true; }
852+};
853+
854+class FanAnim : public MultiAnim <FanSingleAnim, 6>
855+{
856+ public:
857+
858+ FanAnim (CompWindow *w,
859+ WindowEvent curWindowEvent,
860+ float duration,
861+ const AnimEffect info,
862+ const CompRect &icon) :
863+ MultiAnim <FanSingleAnim, 6>::MultiAnim
864+ (w, curWindowEvent, duration, info, icon) {}
865+};
866+
867+class AnimSimPluginVTable:
868+ public CompPlugin::VTableForScreenAndWindow <AnimSimScreen, AnimSimWindow>
869+{
870+ public:
871+ bool init ();
872+};
873
874=== added file 'plugins/simple-animations/src/bounce.cpp'
875--- plugins/simple-animations/src/bounce.cpp 1970-01-01 00:00:00 +0000
876+++ plugins/simple-animations/src/bounce.cpp 2016-05-30 14:34:38 +0000
877@@ -0,0 +1,76 @@
878+/*
879+ * Animation plugin for compiz/beryl
880+ *
881+ * animation.c
882+ *
883+ * Copyright : (C) 2006 Erkin Bahceci
884+ * E-mail : erkinbah@gmail.com
885+ *
886+ * Based on Wobbly and Minimize plugins by
887+ * : David Reveman
888+ * E-mail : davidr@novell.com>
889+ *
890+ * Particle system added by : (C) 2006 Dennis Kasprzyk
891+ * E-mail : onestone@beryl-project.org
892+ *
893+ * Beam-Up added by : Florencio Guimaraes
894+ * E-mail : florencio@nexcorp.com.br
895+ *
896+ * Hexagon tessellator added by : Mike Slegeir
897+ * E-mail : mikeslegeir@mail.utexas.edu>
898+ *
899+ * This program is free software; you can redistribute it and/or
900+ * modify it under the terms of the GNU General Public License
901+ * as published by the Free Software Foundation; either version 2
902+ * of the License, or (at your option) any later version.
903+ *
904+ * This program is distributed in the hope that it will be useful,
905+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
906+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
907+ * GNU General Public License for more details.
908+ *
909+ * You should have received a copy of the GNU General Public License
910+ * along with this program; if not, write to the Free Software
911+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
912+ */
913+
914+#include "animationsim.h"
915+
916+// ===================== Effect: Bounce =========================
917+
918+float
919+BounceAnim::getProgress ()
920+{
921+ return progressLinear ();
922+}
923+
924+void
925+BounceAnim::applyTransform ()
926+{
927+ float scale = 1.0f - (targetScale * (currBounceProgress) + currentScale * (1.0f - currBounceProgress));
928+ float forwardProgress = getProgress ();;
929+ float forwardProgressInc = 1.0f / bounceCount;
930+
931+ /* last bounce, enure we are going for 0.0 */
932+ currBounceProgress = (((1 - forwardProgress) - lastProgressMax) / forwardProgressInc);
933+
934+ if (currBounceProgress > 1.0f)
935+ {
936+ currentScale = targetScale;
937+ targetScale = -targetScale + targetScale / 2.0f;
938+ lastProgressMax = 1.0f - forwardProgress;
939+ currBounceProgress = 0.0f;
940+ nBounce++;
941+ }
942+
943+ GLMatrix *transform = &mTransform;
944+
945+ transform->translate (WIN_X (mWindow) + WIN_W (mWindow) / 2.0f,
946+ WIN_Y (mWindow) + WIN_H (mWindow) / 2.0f, 0.0f);
947+
948+ transform->scale (scale, scale, 1.0f);
949+
950+ transform->translate (-(WIN_X (mWindow) + WIN_W (mWindow) / 2.0f),
951+ -(WIN_Y (mWindow) + WIN_H (mWindow) / 2.0f), 0.0f);
952+
953+}
954
955=== added file 'plugins/simple-animations/src/expand-piecewise.cpp'
956--- plugins/simple-animations/src/expand-piecewise.cpp 1970-01-01 00:00:00 +0000
957+++ plugins/simple-animations/src/expand-piecewise.cpp 2016-05-30 14:34:38 +0000
958@@ -0,0 +1,90 @@
959+/*
960+ * Animation plugin for compiz/beryl
961+ *
962+ * animation.c
963+ *
964+ * Copyright : (C) 2006 Erkin Bahceci
965+ * E-mail : erkinbah@gmail.com
966+ *
967+ * Based on Wobbly and Minimize plugins by
968+ * : David Reveman
969+ * E-mail : davidr@novell.com>
970+ *
971+ * Particle system added by : (C) 2006 Dennis Kasprzyk
972+ * E-mail : onestone@beryl-project.org
973+ *
974+ * Beam-Up added by : Florencio Guimaraes
975+ * E-mail : florencio@nexcorp.com.br
976+ *
977+ * Hexagon tessellator added by : Mike Slegeir
978+ * E-mail : mikeslegeir@mail.utexas.edu>
979+ *
980+ * This program is free software; you can redistribute it and/or
981+ * modify it under the terms of the GNU General Public License
982+ * as published by the Free Software Foundation; either version 2
983+ * of the License, or (at your option) any later version.
984+ *
985+ * This program is distributed in the hope that it will be useful,
986+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
987+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
988+ * GNU General Public License for more details.
989+ *
990+ * You should have received a copy of the GNU General Public License
991+ * along with this program; if not, write to the Free Software
992+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
993+ */
994+
995+#include "animationsim.h"
996+#define DELTA 0.0001f
997+
998+// ===================== Effect: ExpandPW =========================
999+
1000+void
1001+ExpandPWAnim::applyTransform ()
1002+{
1003+ ANIMSIM_SCREEN (screen);
1004+
1005+ GLMatrix *transform = &mTransform;
1006+
1007+ float forwardProgress = 1.0f - getProgress ();
1008+
1009+ float initialXScale = ass->optionGetExpandpwInitialHoriz () / (float) mWindow->width ();
1010+ float initialYScale = ass->optionGetExpandpwInitialVert () / (float) mWindow->height ();
1011+
1012+ // animation movement
1013+ transform->translate (WIN_X (mWindow) + WIN_W (mWindow) / 2.0f,
1014+ WIN_Y (mWindow) + WIN_H (mWindow) / 2.0f,
1015+ 0.0f);
1016+
1017+ float xScale;
1018+ float yScale;
1019+ float switchPointP;
1020+ float switchPointN;
1021+ float delay = ass->optionGetExpandpwDelay ();
1022+
1023+ if (ass->optionGetExpandpwHorizFirst ())
1024+ {
1025+ switchPointP = mWindow->width () / (float) (mWindow->width () + mWindow->height ()) + mWindow->height () / (float) (mWindow->width () + mWindow->height ()) * delay;
1026+ switchPointN = mWindow->width () / (float) (mWindow->width () + mWindow->height ()) - mWindow->width () / (float) (mWindow->width () + mWindow->height ()) * delay;
1027+ if(switchPointP >= 1.0f) switchPointP = 1.0f - DELTA;
1028+ if(switchPointN <= 0.0f) switchPointN = 0.0f + DELTA;
1029+ xScale = initialXScale + (1.0f - initialXScale) * (forwardProgress < switchPointN ? 1.0f - (switchPointN - forwardProgress)/switchPointN : 1.0f);
1030+ yScale = initialYScale + (1.0f - initialYScale) * (forwardProgress > switchPointP ? (forwardProgress - switchPointP)/(1.0f-switchPointP) : 0.0f);
1031+ }
1032+ else
1033+ {
1034+ switchPointP = mWindow->height () / (float) (mWindow->width () + mWindow->height ()) + mWindow->width () / (float) (mWindow->width () + mWindow->height ()) * delay;
1035+ switchPointN = mWindow->height () / (float) (mWindow->width () + mWindow->height ()) - mWindow->height () / (float) (mWindow->width () + mWindow->height ()) * delay;
1036+ if(switchPointP >= 1.0f) switchPointP = 1.0f - DELTA;
1037+ if(switchPointN <= 0.0f) switchPointN = 0.0f + DELTA;
1038+ xScale = initialXScale + (1.0f - initialXScale) * (forwardProgress > switchPointP ? (forwardProgress - switchPointP)/(1.0f-switchPointP) : 0.0f);
1039+ yScale = initialYScale + (1.0f - initialYScale) * (forwardProgress < switchPointN ? 1.0f - (switchPointN - forwardProgress)/switchPointN : 1.0f);
1040+ }
1041+
1042+ transform->scale (xScale, yScale, 0.0f);
1043+
1044+ transform->translate (-(WIN_X (mWindow) + WIN_W (mWindow) / 2.0f),
1045+ -(WIN_Y (mWindow) + WIN_H (mWindow) / 2.0f),
1046+ 0.0f);
1047+
1048+}
1049
1050=== added file 'plugins/simple-animations/src/expand.cpp'
1051--- plugins/simple-animations/src/expand.cpp 1970-01-01 00:00:00 +0000
1052+++ plugins/simple-animations/src/expand.cpp 2016-05-30 14:34:38 +0000
1053@@ -0,0 +1,70 @@
1054+/*
1055+ * Animation plugin for compiz/beryl
1056+ *
1057+ * animation.c
1058+ *
1059+ * Copyright : (C) 2006 Erkin Bahceci
1060+ * E-mail : erkinbah@gmail.com
1061+ *
1062+ * Based on Wobbly and Minimize plugins by
1063+ * : David Reveman
1064+ * E-mail : davidr@novell.com>
1065+ *
1066+ * Particle system added by : (C) 2006 Dennis Kasprzyk
1067+ * E-mail : onestone@beryl-project.org
1068+ *
1069+ * Beam-Up added by : Florencio Guimaraes
1070+ * E-mail : florencio@nexcorp.com.br
1071+ *
1072+ * Hexagon tessellator added by : Mike Slegeir
1073+ * E-mail : mikeslegeir@mail.utexas.edu>
1074+ *
1075+ * This program is free software; you can redistribute it and/or
1076+ * modify it under the terms of the GNU General Public License
1077+ * as published by the Free Software Foundation; either version 2
1078+ * of the License, or (at your option) any later version.
1079+ *
1080+ * This program is distributed in the hope that it will be useful,
1081+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1082+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1083+ * GNU General Public License for more details.
1084+ *
1085+ * You should have received a copy of the GNU General Public License
1086+ * along with this program; if not, write to the Free Software
1087+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
1088+ */
1089+
1090+#include "animationsim.h"
1091+
1092+// ===================== Effect: Expand =========================
1093+
1094+void
1095+ExpandAnim::applyTransform ()
1096+{
1097+ GLMatrix *transform = &mTransform;
1098+ float defaultXScale = 0.3f;
1099+ float forwardProgress;
1100+ float expandProgress;
1101+ const float expandPhaseEnd = 0.5f;
1102+
1103+ forwardProgress = getProgress ();
1104+
1105+ if ((1 - forwardProgress) < expandPhaseEnd)
1106+ expandProgress = (1 - forwardProgress) / expandPhaseEnd;
1107+ else
1108+ expandProgress = 1.0f;
1109+
1110+ // animation movement
1111+ transform->translate (WIN_X (mWindow) + WIN_W (mWindow) / 2.0f,
1112+ WIN_Y (mWindow) + WIN_H (mWindow) / 2.0f,
1113+ 0.0f);
1114+
1115+ transform->scale (defaultXScale + (1.0f - defaultXScale) *
1116+ expandProgress,
1117+ (1 - forwardProgress), 0.0f);
1118+
1119+ transform->translate (-(WIN_X (mWindow) + WIN_W (mWindow) / 2.0f),
1120+ -(WIN_Y (mWindow) + WIN_H (mWindow) / 2.0f),
1121+ 0.0f);
1122+
1123+}
1124
1125=== added file 'plugins/simple-animations/src/fan.cpp'
1126--- plugins/simple-animations/src/fan.cpp 1970-01-01 00:00:00 +0000
1127+++ plugins/simple-animations/src/fan.cpp 2016-05-30 14:34:38 +0000
1128@@ -0,0 +1,51 @@
1129+#include "animationsim.h"
1130+
1131+float
1132+FanSingleAnim::getFadeProgress ()
1133+{
1134+ return getProgress ();
1135+};
1136+
1137+void
1138+FanSingleAnim::applyTransform ()
1139+{
1140+ /* Starting angle is as a percentage of whichever fan number we are
1141+ * closest to the center
1142+ */
1143+
1144+ ANIMSIM_SCREEN (screen);
1145+
1146+ int num = MultiAnim <FanSingleAnim, 6>::getCurrAnimNumber (mAWindow);
1147+
1148+ if (num > 2)
1149+ num += 1;
1150+
1151+ float div = (ass->optionGetFanAngle () * 2) / 6;
1152+ float startAng = -(ass->optionGetFanAngle ()) + (div * num);
1153+ float currAng = getProgress () * startAng;
1154+ float offset = (1 - getProgress ()) * (WIN_H (mWindow) / 2);
1155+
1156+ if (num > 3)
1157+ num += 1;
1158+
1159+ if (num > 3)
1160+ {
1161+ mTransform.translate (WIN_X (mWindow) + WIN_W (mWindow) - offset,
1162+ WIN_Y (mWindow) + WIN_H (mWindow),
1163+ 0.0f);
1164+ mTransform.rotate (currAng, 0.0f, 0.0f, 1.0f);
1165+ mTransform.translate (-(WIN_X (mWindow) + WIN_W (mWindow) - offset),
1166+ -(WIN_Y (mWindow) + WIN_H (mWindow)),
1167+ 0.0f);
1168+ }
1169+ else
1170+ {
1171+ mTransform.translate (WIN_X (mWindow) + offset,
1172+ WIN_Y (mWindow) + WIN_H (mWindow),
1173+ 0.0f);
1174+ mTransform.rotate (currAng, 0.0f, 0.0f, 1.0f);
1175+ mTransform.translate (-(WIN_X (mWindow) + offset),
1176+ -(WIN_Y (mWindow) + WIN_H (mWindow)),
1177+ 0.0f);
1178+ }
1179+}
1180
1181=== added file 'plugins/simple-animations/src/flyin.cpp'
1182--- plugins/simple-animations/src/flyin.cpp 1970-01-01 00:00:00 +0000
1183+++ plugins/simple-animations/src/flyin.cpp 2016-05-30 14:34:38 +0000
1184@@ -0,0 +1,86 @@
1185+/*
1186+ * Animation plugin for compiz/beryl
1187+ *
1188+ * animation.c
1189+ *
1190+ * Copyright : (C) 2006 Erkin Bahceci
1191+ * E-mail : erkinbah@gmail.com
1192+ *
1193+ * Based on Wobbly and Minimize plugins by
1194+ * : David Reveman
1195+ * E-mail : davidr@novell.com>
1196+ *
1197+ * Particle system added by : (C) 2006 Dennis Kasprzyk
1198+ * E-mail : onestone@beryl-project.org
1199+ *
1200+ * Beam-Up added by : Florencio Guimaraes
1201+ * E-mail : florencio@nexcorp.com.br
1202+ *
1203+ * Hexagon tessellator added by : Mike Slegeir
1204+ * E-mail : mikeslegeir@mail.utexas.edu>
1205+ *
1206+ * This program is free software; you can redistribute it and/or
1207+ * modify it under the terms of the GNU General Public License
1208+ * as published by the Free Software Foundation; either version 2
1209+ * of the License, or (at your option) any later version.
1210+ *
1211+ * This program is distributed in the hope that it will be useful,
1212+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1213+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1214+ * GNU General Public License for more details.
1215+ *
1216+ * You should have received a copy of the GNU General Public License
1217+ * along with this program; if not, write to the Free Software
1218+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
1219+ */
1220+
1221+#include "animationsim.h"
1222+
1223+// ===================== Effect: Flyin =========================
1224+
1225+void
1226+FlyInAnim::applyTransform ()
1227+{
1228+ GLMatrix *transform = &mTransform;
1229+ float offsetX = 0, offsetY = 0;
1230+ float xTrans, yTrans;
1231+ float forwardProgress;
1232+
1233+ ANIMSIM_SCREEN (screen);
1234+
1235+ int direction = ass->optionGetFlyinDirection ();
1236+ float distance = ass->optionGetFlyinDistance ();
1237+
1238+ switch (direction)
1239+ {
1240+ case 0:
1241+ offsetX = 0;
1242+ offsetY = distance;
1243+ break;
1244+ case 1:
1245+ offsetX = distance;
1246+ offsetY = 0;
1247+ break;
1248+ case 2:
1249+ offsetX = 0;
1250+ offsetY = -distance;
1251+ break;
1252+ case 3:
1253+ offsetX = -distance;
1254+ offsetY = 0;
1255+ break;
1256+ case 4:
1257+ offsetX = ass->optionGetFlyinDirectionX ();
1258+ offsetY = ass->optionGetFlyinDirectionY ();
1259+ break;
1260+ }
1261+
1262+ forwardProgress = progressLinear ();
1263+ xTrans = -(forwardProgress * offsetX);
1264+ yTrans = -(forwardProgress * offsetY);
1265+ Point3d translation = Point3d (xTrans, yTrans, 0);
1266+
1267+ // animation movement
1268+ transform->translate (translation.x (), translation.y (), translation.z ());
1269+
1270+}
1271
1272=== added file 'plugins/simple-animations/src/pulse.cpp'
1273--- plugins/simple-animations/src/pulse.cpp 1970-01-01 00:00:00 +0000
1274+++ plugins/simple-animations/src/pulse.cpp 2016-05-30 14:34:38 +0000
1275@@ -0,0 +1,50 @@
1276+#include "animationsim.h"
1277+
1278+/* Keep the "principal" window at 100% opacity, only fade out
1279+ * the window that is "pulsing" away
1280+ */
1281+
1282+float
1283+PulseSingleAnim::getFadeProgress ()
1284+{
1285+ int num = MultiAnim <PulseSingleAnim, 2>::getCurrAnimNumber (mAWindow);
1286+
1287+ if (num == 1)
1288+ return 1 - getProgress ();
1289+ else
1290+ return 0.0f;
1291+};
1292+
1293+void
1294+PulseSingleAnim::applyTransform ()
1295+{
1296+ float scale = 1.0f + (1- getProgress ());
1297+
1298+ /* Add a bit of a "kick" for open, close,
1299+ * minimize, unminimize, etc anims */
1300+
1301+ switch (mCurWindowEvent)
1302+ {
1303+ case WindowEventOpen:
1304+ case WindowEventClose:
1305+ case WindowEventMinimize:
1306+ case WindowEventUnminimize:
1307+ scale -= 0.2f;
1308+ default:
1309+ break;
1310+ }
1311+
1312+ if (MultiAnim <PulseSingleAnim, 2>::getCurrAnimNumber (mAWindow) == 0)
1313+ if (scale > 1.0f)
1314+ scale = 1.0f;
1315+
1316+ GLMatrix *transform = &mTransform;
1317+
1318+ transform->translate (WIN_X (mWindow) + WIN_W (mWindow) / 2.0f,
1319+ WIN_Y (mWindow) + WIN_H (mWindow) / 2.0f, 0.0f);
1320+
1321+ transform->scale (scale, scale, 1.0f);
1322+
1323+ transform->translate (-(WIN_X (mWindow) + WIN_W (mWindow) / 2.0f),
1324+ -(WIN_Y (mWindow) + WIN_H (mWindow) / 2.0f), 0.0f);
1325+}
1326\ No newline at end of file
1327
1328=== added file 'plugins/simple-animations/src/rotatein.cpp'
1329--- plugins/simple-animations/src/rotatein.cpp 1970-01-01 00:00:00 +0000
1330+++ plugins/simple-animations/src/rotatein.cpp 2016-05-30 14:34:38 +0000
1331@@ -0,0 +1,210 @@
1332+/*
1333+ * Animation plugin for compiz/beryl
1334+ *
1335+ * animation.c
1336+ *
1337+ * Copyright : (C) 2006 Erkin Bahceci
1338+ * E-mail : erkinbah@gmail.com
1339+ *
1340+ * Based on Wobbly and Minimize plugins by
1341+ * : David Reveman
1342+ * E-mail : davidr@novell.com>
1343+ *
1344+ * Particle system added by : (C) 2006 Dennis Kasprzyk
1345+ * E-mail : onestone@beryl-project.org
1346+ *
1347+ * Beam-Up added by : Florencio Guimaraes
1348+ * E-mail : florencio@nexcorp.com.br
1349+ *
1350+ * Hexagon tessellator added by : Mike Slegeir
1351+ * E-mail : mikeslegeir@mail.utexas.edu>
1352+ *
1353+ * This program is free software; you can redistribute it and/or
1354+ * modify it under the terms of the GNU General Public License
1355+ * as published by the Free Software Foundation; either version 2
1356+ * of the License, or (at your option) any later version.
1357+ *
1358+ * This program is distributed in the hope that it will be useful,
1359+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1360+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1361+ * GNU General Public License for more details.
1362+ *
1363+ * You should have received a copy of the GNU General Public License
1364+ * along with this program; if not, write to the Free Software
1365+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
1366+ */
1367+
1368+#include "animationsim.h"
1369+
1370+// ===================== Effect: RotateIn =========================
1371+
1372+void
1373+RotateInAnim::applyTransform ()
1374+{
1375+ ANIMSIM_SCREEN (screen);
1376+
1377+ GLMatrix *transform = &mTransform;
1378+ float xRot, yRot;
1379+ float angleX = 0, angleY = 0;
1380+ float originX = 0, originY = 0;
1381+ float forwardProgress;
1382+
1383+ int direction = ass->optionGetRotateinDirection ();
1384+
1385+ switch (direction)
1386+ {
1387+ case 1:
1388+ angleX = 0;
1389+ angleY = -ass->optionGetRotateinAngle ();
1390+ originX = WIN_X (mWindow);
1391+ originY = WIN_Y (mWindow) + WIN_H (mWindow);
1392+ break;
1393+ case 2:
1394+ angleX = ass->optionGetRotateinAngle ();
1395+ angleY = 0;
1396+ originX = WIN_X (mWindow);
1397+ originY = WIN_Y (mWindow);
1398+ break;
1399+ case 3:
1400+ angleX = 0;
1401+ angleY = ass->optionGetRotateinAngle ();
1402+ originX = WIN_X (mWindow);
1403+ originY = WIN_Y (mWindow);
1404+ break;
1405+ case 4:
1406+ angleX = -ass->optionGetRotateinAngle ();
1407+ angleY = 0;
1408+ originX = WIN_X (mWindow) + WIN_W (mWindow);
1409+ originY = WIN_Y (mWindow);
1410+ break;
1411+ }
1412+
1413+ forwardProgress = getProgress ();
1414+ xRot = (forwardProgress * angleX);
1415+ yRot = (forwardProgress * angleY);
1416+
1417+ transform->translate (WIN_X (mWindow) + WIN_W (mWindow) / 2.0f,
1418+ WIN_Y (mWindow) + WIN_H (mWindow) / 2.0f,
1419+ 0.0f);
1420+
1421+ perspectiveDistortAndResetZ (*transform);
1422+
1423+ transform->translate (-(WIN_X (mWindow) + WIN_W (mWindow) / 2.0f),
1424+ -(WIN_Y (mWindow) + WIN_H (mWindow) / 2.0f),
1425+ 0.0f);
1426+
1427+ // animation movement
1428+ transform->translate (originX, originY, 0.0f);
1429+
1430+ transform->rotate (yRot, 1.0f, 0.0f, 0.0f);
1431+ transform->rotate (xRot, 0.0f, 1.0f, 0.0f);
1432+
1433+ transform->translate (-originX, -originY, 0.0f);
1434+
1435+}
1436+
1437+void
1438+RotateInAnim::prePaintWindow ()
1439+{
1440+ float forwardProgress = getProgress ();
1441+ float xRot, yRot;
1442+ float angleX = 0, angleY = 0;
1443+ Bool xInvert = FALSE, yInvert = FALSE;
1444+ int currentCull, invertCull;
1445+
1446+ glGetIntegerv (GL_CULL_FACE_MODE, &currentCull);
1447+ invertCull = (currentCull == GL_BACK) ? GL_FRONT : GL_BACK;
1448+
1449+ ANIMSIM_SCREEN (screen);
1450+
1451+ int direction = ass->optionGetRotateinDirection ();
1452+
1453+ switch (direction)
1454+ {
1455+ case 1:
1456+ angleX = 0;
1457+ angleY = -ass->optionGetRotateinAngle ();
1458+ break;
1459+ case 2:
1460+ angleX = ass->optionGetRotateinAngle ();
1461+ angleY = 0;
1462+ break;
1463+ case 3:
1464+ angleX = 0;
1465+ angleY = ass->optionGetRotateinAngle ();
1466+ break;
1467+ case 4:
1468+ angleX = -ass->optionGetRotateinAngle ();
1469+ angleY = 0;
1470+ break;
1471+ }
1472+
1473+ /* FIXME: This could be fancy vectorial normal direction calculation */
1474+
1475+ xRot = fabs(fmodf(forwardProgress * angleX, 360.0f));
1476+ yRot = fabs(fmodf(forwardProgress * angleY, 360.0f));
1477+
1478+ if (xRot > 270.0f)
1479+ xInvert = TRUE;
1480+
1481+ if (yRot > 270.0f)
1482+ yInvert = TRUE;
1483+
1484+ if ((xInvert || yInvert) && !(xInvert && yInvert))
1485+ glCullFace (invertCull);
1486+}
1487+
1488+void
1489+RotateInAnim::postPaintWindow ()
1490+{
1491+ float forwardProgress = getProgress ();
1492+ float xRot, yRot;
1493+ float angleX = 0, angleY = 0;
1494+ Bool xInvert = FALSE, yInvert = FALSE;
1495+ int currentCull, invertCull;
1496+
1497+ glGetIntegerv (GL_CULL_FACE_MODE, &currentCull);
1498+ invertCull = (currentCull == GL_BACK) ? GL_FRONT : GL_BACK;
1499+
1500+ ANIMSIM_SCREEN (screen);
1501+
1502+ int direction = ass->optionGetRotateinDirection ();
1503+
1504+ switch (direction)
1505+ {
1506+ case 1:
1507+ angleX = 0;
1508+ angleY = -ass->optionGetRotateinAngle ();
1509+ break;
1510+ case 2:
1511+ angleX = ass->optionGetRotateinAngle ();
1512+ angleY = 0;
1513+ break;
1514+ case 3:
1515+ angleX = 0;
1516+ angleY = ass->optionGetRotateinAngle ();
1517+ break;
1518+ case 4:
1519+ angleX = -ass->optionGetRotateinAngle ();
1520+ angleY = 0;
1521+ break;
1522+ }
1523+
1524+ /* FIXME: This could be fancy vectorial normal direction calculation */
1525+
1526+ xRot = fabs(fmodf(forwardProgress * angleX, 360.0f));
1527+ yRot = fabs(fmodf(forwardProgress * angleY, 360.0f));
1528+
1529+ if (xRot > 270.0f)
1530+ xInvert = TRUE;
1531+
1532+ if (yRot > 270.0f)
1533+ yInvert = TRUE;
1534+
1535+ /* We have to assume that invertCull will be
1536+ * the actual inversion of our previous cull
1537+ */
1538+
1539+ if ((xInvert || yInvert) && !(xInvert && yInvert))
1540+ glCullFace (invertCull);
1541+}
1542
1543=== added file 'plugins/simple-animations/src/sheet.cpp'
1544--- plugins/simple-animations/src/sheet.cpp 1970-01-01 00:00:00 +0000
1545+++ plugins/simple-animations/src/sheet.cpp 2016-05-30 14:34:38 +0000
1546@@ -0,0 +1,275 @@
1547+/*
1548+ * Animation plugin for compiz/beryl
1549+ *
1550+ * animation.c
1551+ *
1552+ * Copyright : (C) 2006 Erkin Bahceci
1553+ * E-mail : erkinbah@gmail.com
1554+ *
1555+ * Based on Wobbly and Minimize plugins by
1556+ * : David Reveman
1557+ * E-mail : davidr@novell.com>
1558+ *
1559+ * Particle system added by : (C) 2006 Dennis Kasprzyk
1560+ * E-mail : onestone@beryl-project.org
1561+ *
1562+ * Beam-Up added by : Florencio Guimaraes
1563+ * E-mail : florencio@nexcorp.com.br
1564+ *
1565+ * Hexagon tessellator added by : Mike Slegeir
1566+ * E-mail : mikeslegeir@mail.utexas.edu>
1567+ *
1568+ * This program is free software; you can redistribute it and/or
1569+ * modify it under the terms of the GNU General Public License
1570+ * as published by the Free Software Foundation; either version 2
1571+ * of the License, or (at your option) any later version.
1572+ *
1573+ * This program is distributed in the hope that it will be useful,
1574+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1575+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1576+ * GNU General Public License for more details.
1577+ *
1578+ * You should have received a copy of the GNU General Public License
1579+ * along with this program; if not, write to the Free Software
1580+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
1581+ */
1582+
1583+#include "animationsim.h"
1584+
1585+SheetAnim::SheetAnim (CompWindow *w,
1586+ WindowEvent curWindowEvent,
1587+ float duration,
1588+ const AnimEffect info,
1589+ const CompRect &minIcon) :
1590+ Animation::Animation (w, curWindowEvent, duration, info, minIcon),
1591+ BaseSimAnim::BaseSimAnim (w, curWindowEvent, duration, info, minIcon),
1592+ GridAnim::GridAnim (w, curWindowEvent, duration, info, minIcon)
1593+{
1594+ int maxWaves;
1595+ float waveAmpMin, waveAmpMax;
1596+ CompWindow *parent = 0;
1597+ CompRect icon = minIcon;
1598+
1599+ foreach (parent, screen->windows ())
1600+ {
1601+ if (parent->transientFor () == w->id () && parent->id () != w->id ())
1602+ break;
1603+ }
1604+
1605+ if (parent)
1606+ {
1607+ icon.setX (WIN_X (parent) + WIN_W (parent) / 2.0f);
1608+ icon.setY (WIN_Y (parent));
1609+ icon.setWidth (WIN_W (w));
1610+ }
1611+ else
1612+ {
1613+ icon.setX (screen->width () / 2.0f);
1614+ icon.setY (0.0f);;
1615+ icon.setWidth (WIN_W (w));
1616+ }
1617+
1618+ maxWaves = 0;
1619+ waveAmpMin = 0.0f;
1620+ waveAmpMax = 0.0f;
1621+
1622+ if (maxWaves == 0)
1623+ {
1624+ sheetsWaveCount = 0;
1625+ }
1626+ else
1627+ {
1628+ // Initialize waves
1629+
1630+ float distance = WIN_Y(w) + WIN_H(w) - icon.y ();
1631+
1632+ sheetsWaveCount =
1633+ 1 + (float)maxWaves *distance;
1634+
1635+ if (sheetsWaves.empty ())
1636+ {
1637+ sheetsWaves.resize (sheetsWaveCount);
1638+ }
1639+ // Compute wave parameters
1640+
1641+ int ampDirection = (RAND_FLOAT() < 0.5 ? 1 : -1);
1642+ float minHalfWidth = 0.22f;
1643+ float maxHalfWidth = 0.38f;
1644+
1645+ for (unsigned int i = 0; i < sheetsWaves.size (); i++)
1646+ {
1647+ sheetsWaves[i].amp =
1648+ ampDirection * (waveAmpMax - waveAmpMin) *
1649+ rand() / RAND_MAX + ampDirection * waveAmpMin;
1650+ sheetsWaves[i].halfWidth =
1651+ RAND_FLOAT() * (maxHalfWidth -
1652+ minHalfWidth) + minHalfWidth;
1653+
1654+ // avoid offset at top and bottom part by added waves
1655+ float availPos = 1 - 2 * sheetsWaves[i].halfWidth;
1656+ float posInAvailSegment = 0;
1657+
1658+ if (i > 0)
1659+ posInAvailSegment =
1660+ (availPos / sheetsWaveCount) * rand() / RAND_MAX;
1661+
1662+ sheetsWaves[i].pos =
1663+ (posInAvailSegment +
1664+ i * availPos / sheetsWaveCount +
1665+ sheetsWaves[i].halfWidth);
1666+
1667+ // switch wave direction
1668+ ampDirection *= -1;
1669+ }
1670+ }
1671+}
1672+
1673+void
1674+SheetAnim::updateBB (CompOutput &output)
1675+{
1676+ // TODO: Just consider the corner objects
1677+
1678+ CompositeScreen::get (screen)->damageScreen (); // XXX: *COUGH!!!!*
1679+}
1680+
1681+void
1682+SheetAnim::step ()
1683+{
1684+ GridModel *model = mModel;
1685+ CompRect &icon = mIcon;
1686+ CompWindow *parent = 0;
1687+
1688+ foreach (parent, screen->windows ())
1689+ {
1690+ if (parent->transientFor () == mWindow->id () && parent->id () != mWindow->id ())
1691+ break;
1692+ }
1693+
1694+ if (parent)
1695+ {
1696+ icon.setX (WIN_X (parent) + WIN_W (parent) / 2.0f);
1697+ icon.setY (WIN_Y (parent));
1698+ icon.setWidth (WIN_W (mWindow));
1699+ }
1700+ else
1701+ {
1702+ icon.setX (screen->width () / 2.0f);
1703+ icon.setY (0.0f);;
1704+ icon.setWidth (WIN_W (mWindow));
1705+ }
1706+
1707+ float forwardProgress = progressLinear ();
1708+
1709+ if (sheetsWaveCount > 0 && sheetsWaves.empty ())
1710+ return;
1711+
1712+ float iconCloseEndY;
1713+ float iconFarEndY;
1714+ float winFarEndY;
1715+ float winVisibleCloseEndY;
1716+ float winw = WIN_W(mWindow);
1717+ float winh = WIN_H(mWindow);
1718+
1719+
1720+ iconFarEndY = icon.y ();
1721+ iconCloseEndY = icon.y () + icon.height ();
1722+ winFarEndY = WIN_Y(mWindow) + winh;
1723+ winVisibleCloseEndY = WIN_Y(mWindow);
1724+ if (winVisibleCloseEndY < iconCloseEndY)
1725+ winVisibleCloseEndY = iconCloseEndY;
1726+
1727+
1728+ float preShapePhaseEnd = 0.22f;
1729+ float preShapeProgress = 0;
1730+ float postStretchProgress = 0;
1731+ float stretchProgress = 0;
1732+ float stretchPhaseEnd =
1733+ preShapePhaseEnd + (1 - preShapePhaseEnd) *
1734+ (iconCloseEndY -
1735+ winVisibleCloseEndY) / ((iconCloseEndY - winFarEndY) +
1736+ (iconCloseEndY - winVisibleCloseEndY));
1737+ if (stretchPhaseEnd < preShapePhaseEnd + 0.1)
1738+ stretchPhaseEnd = preShapePhaseEnd + 0.1;
1739+
1740+ if (forwardProgress < preShapePhaseEnd)
1741+ {
1742+ preShapeProgress = forwardProgress / preShapePhaseEnd;
1743+
1744+ // Slow down "shaping" toward the end
1745+ preShapeProgress = 1 - progressDecelerate (1 - preShapeProgress);
1746+ }
1747+
1748+ if (forwardProgress < preShapePhaseEnd)
1749+ {
1750+ stretchProgress = forwardProgress / stretchPhaseEnd;
1751+ }
1752+ else
1753+ {
1754+ if (forwardProgress < stretchPhaseEnd)
1755+ {
1756+ stretchProgress = forwardProgress / stretchPhaseEnd;
1757+ }
1758+ else
1759+ {
1760+ postStretchProgress =
1761+ (forwardProgress - stretchPhaseEnd) / (1 - stretchPhaseEnd);
1762+ }
1763+ }
1764+
1765+ GridModel::GridObject *object = mModel->objects ();
1766+ unsigned int i;
1767+ for (i = 0; i < mModel->numObjects (); i++, object++)
1768+ {
1769+ float origx = mWindow->x () + (winw * object->gridPosition ().x () -
1770+ mWindow->output ().left) * model->scale ().x ();
1771+ float origy = mWindow->y () + (winh * object->gridPosition ().y () -
1772+ mWindow->output ().top) * model->scale ().y ();
1773+ float icony = icon.y () + icon.height ();
1774+
1775+ float stretchedPos;
1776+ Point3d &objPos = object->position ();
1777+ stretchedPos =
1778+ object->gridPosition ().y () * origy +
1779+ (1 - object->gridPosition ().y ()) * icony;
1780+
1781+ // Compute current y position
1782+ if (forwardProgress < preShapePhaseEnd)
1783+ {
1784+ objPos.setY ((1 - stretchProgress) * origy +
1785+ stretchProgress * stretchedPos);
1786+ }
1787+ else
1788+ {
1789+ if (forwardProgress < stretchPhaseEnd)
1790+ {
1791+ objPos.setY ((1 - stretchProgress) * origy +
1792+ stretchProgress * stretchedPos);
1793+ }
1794+ else
1795+ {
1796+ objPos.setY ((1 - postStretchProgress) *
1797+ stretchedPos +
1798+ postStretchProgress *
1799+ (stretchedPos + (iconCloseEndY - winFarEndY)));
1800+ }
1801+ }
1802+
1803+ // Compute "target shape" x position
1804+ float yProgress = (iconCloseEndY - object->position ().y () ) / (iconCloseEndY - winFarEndY);
1805+
1806+ float targetx = yProgress * (origx - icon.x ())
1807+ + icon.x () + icon.width () * (object->gridPosition ().x () - 0.5);
1808+
1809+ // Compute current x position
1810+ if (forwardProgress < preShapePhaseEnd)
1811+ objPos.setX ((1 - preShapeProgress) * origx + preShapeProgress * targetx);
1812+ else
1813+ objPos.setX (targetx);
1814+
1815+ if (object->position ().y () < iconFarEndY)
1816+ objPos.setY (iconFarEndY);
1817+
1818+ // No need to set object->position.z to 0, since they won't be used
1819+ // due to modelAnimIs3D being FALSE for magic lamp.
1820+ }
1821+}

Subscribers

People subscribed via source and target branches