1 |
bee1d997
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
2 |
|
|
// Copyright 2019 Leszek Koltunski //
|
3 |
|
|
// //
|
4 |
fdec60a3
|
Leszek Koltunski
|
// This file is part of Magic Cube. //
|
5 |
bee1d997
|
Leszek Koltunski
|
// //
|
6 |
fdec60a3
|
Leszek Koltunski
|
// Magic Cube is free software: you can redistribute it and/or modify //
|
7 |
bee1d997
|
Leszek Koltunski
|
// it under the terms of the GNU General Public License as published by //
|
8 |
|
|
// the Free Software Foundation, either version 2 of the License, or //
|
9 |
|
|
// (at your option) any later version. //
|
10 |
|
|
// //
|
11 |
fdec60a3
|
Leszek Koltunski
|
// Magic Cube is distributed in the hope that it will be useful, //
|
12 |
bee1d997
|
Leszek Koltunski
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
13 |
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
14 |
|
|
// GNU General Public License for more details. //
|
15 |
|
|
// //
|
16 |
|
|
// You should have received a copy of the GNU General Public License //
|
17 |
fdec60a3
|
Leszek Koltunski
|
// along with Magic Cube. If not, see <http://www.gnu.org/licenses/>. //
|
18 |
bee1d997
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
19 |
|
|
|
20 |
1f9772f3
|
Leszek Koltunski
|
package org.distorted.effects.win;
|
21 |
bee1d997
|
Leszek Koltunski
|
|
22 |
|
|
import org.distorted.library.effect.Effect;
|
23 |
3e7bb3fd
|
Leszek Koltunski
|
import org.distorted.library.effect.EffectQuality;
|
24 |
bee1d997
|
Leszek Koltunski
|
import org.distorted.library.effect.PostprocessEffectGlow;
|
25 |
|
|
import org.distorted.library.effect.VertexEffectSink;
|
26 |
|
|
import org.distorted.library.type.Dynamic1D;
|
27 |
d1016920
|
Leszek Koltunski
|
import org.distorted.library.type.Dynamic2D;
|
28 |
bee1d997
|
Leszek Koltunski
|
import org.distorted.library.type.Dynamic4D;
|
29 |
|
|
import org.distorted.library.type.Static1D;
|
30 |
d1016920
|
Leszek Koltunski
|
import org.distorted.library.type.Static2D;
|
31 |
bee1d997
|
Leszek Koltunski
|
import org.distorted.library.type.Static3D;
|
32 |
|
|
import org.distorted.library.type.Static4D;
|
33 |
|
|
|
34 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
35 |
|
|
|
36 |
|
|
public class WinEffectGlow extends WinEffect
|
37 |
|
|
{
|
38 |
|
|
private static final int[] colors = new int[] {0,0,1, 1,0,1, 1,0,0, 1,1,0, 0,1,0, 1,1,1}; // blue, pink, red, yellow, green, white
|
39 |
|
|
private static final int INDEX = 5;
|
40 |
|
|
|
41 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
42 |
|
|
|
43 |
|
|
public void createEffects(int duration)
|
44 |
|
|
{
|
45 |
|
|
mNodeEffectPosition = new int[] {-1, -1};
|
46 |
|
|
mNodeEffects = new Effect[mNodeEffectPosition.length];
|
47 |
|
|
|
48 |
d1016920
|
Leszek Koltunski
|
Dynamic2D haloRadiusDyn = new Dynamic2D(duration,1.0f);
|
49 |
|
|
haloRadiusDyn.add(new Static2D( 0, 0));
|
50 |
1335efec
|
Leszek Koltunski
|
haloRadiusDyn.add(new Static2D(15,50));
|
51 |
d1016920
|
Leszek Koltunski
|
haloRadiusDyn.add(new Static2D( 0, 0));
|
52 |
bee1d997
|
Leszek Koltunski
|
|
53 |
|
|
Dynamic4D color= new Dynamic4D(duration,1.0f);
|
54 |
|
|
Static4D P1 = new Static4D(colors[3*INDEX],colors[3*INDEX+1], colors[3*INDEX+2], 0.0f);
|
55 |
|
|
Static4D P2 = new Static4D(colors[3*INDEX],colors[3*INDEX+1], colors[3*INDEX+2], 0.5f);
|
56 |
|
|
color.add(P1);
|
57 |
|
|
color.add(P2);
|
58 |
|
|
color.add(P1);
|
59 |
|
|
|
60 |
3e7bb3fd
|
Leszek Koltunski
|
PostprocessEffectGlow glow = new PostprocessEffectGlow(haloRadiusDyn,color);
|
61 |
|
|
glow.setQuality(EffectQuality.MEDIUM);
|
62 |
|
|
|
63 |
|
|
mNodeEffects[0] = glow;
|
64 |
bee1d997
|
Leszek Koltunski
|
|
65 |
|
|
Dynamic1D degreeDyn= new Dynamic1D(duration,1.0f);
|
66 |
|
|
degreeDyn.add(new Static1D(1.0f));
|
67 |
2010c6f7
|
Leszek Koltunski
|
degreeDyn.add(new Static1D(1.5f));
|
68 |
bee1d997
|
Leszek Koltunski
|
degreeDyn.add(new Static1D(1.0f));
|
69 |
|
|
|
70 |
2010c6f7
|
Leszek Koltunski
|
mNodeEffects[1] = new VertexEffectSink(degreeDyn,new Static3D(0,0,0), new Static4D(0,0,0,0.5f) );
|
71 |
bee1d997
|
Leszek Koltunski
|
}
|
72 |
|
|
|
73 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
74 |
|
|
// Enable all effects used in this Effect. Called by reflection from the parent class.
|
75 |
|
|
|
76 |
|
|
@SuppressWarnings("unused")
|
77 |
|
|
static void enable()
|
78 |
|
|
{
|
79 |
|
|
PostprocessEffectGlow.enable();
|
80 |
|
|
VertexEffectSink.enable();
|
81 |
|
|
}
|
82 |
|
|
}
|