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