Project

General

Profile

Download (3.97 KB) Statistics
| Branch: | Tag: | Revision:

magiccube / src / main / java / org / distorted / effects / win / WinEffectGlow.java @ 1335efec

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
import org.distorted.library.effect.PostprocessEffectGlow;
24
import org.distorted.library.effect.VertexEffectSink;
25
import org.distorted.library.type.Dynamic1D;
26 d1016920 Leszek Koltunski
import org.distorted.library.type.Dynamic2D;
27 bee1d997 Leszek Koltunski
import org.distorted.library.type.Dynamic4D;
28
import org.distorted.library.type.Static1D;
29 d1016920 Leszek Koltunski
import org.distorted.library.type.Static2D;
30 bee1d997 Leszek Koltunski
import org.distorted.library.type.Static3D;
31
import org.distorted.library.type.Static4D;
32
33
///////////////////////////////////////////////////////////////////////////////////////////////////
34
35
public class WinEffectGlow extends WinEffect
36
  {
37
  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
38
  private static final int INDEX = 5;
39
40
///////////////////////////////////////////////////////////////////////////////////////////////////
41
42
  public void createEffects(int duration)
43
    {
44
    mNodeEffectPosition = new int[] {-1, -1};
45
    mNodeEffects        = new Effect[mNodeEffectPosition.length];
46
47 d1016920 Leszek Koltunski
    Dynamic2D haloRadiusDyn = new Dynamic2D(duration,1.0f);
48
    haloRadiusDyn.add(new Static2D( 0, 0));
49 1335efec Leszek Koltunski
    haloRadiusDyn.add(new Static2D(15,50));
50 d1016920 Leszek Koltunski
    haloRadiusDyn.add(new Static2D( 0, 0));
51 bee1d997 Leszek Koltunski
52
    Dynamic4D color= new Dynamic4D(duration,1.0f);
53
    Static4D P1    = new Static4D(colors[3*INDEX],colors[3*INDEX+1], colors[3*INDEX+2], 0.0f);
54
    Static4D P2    = new Static4D(colors[3*INDEX],colors[3*INDEX+1], colors[3*INDEX+2], 0.5f);
55
    color.add(P1);
56
    color.add(P2);
57
    color.add(P1);
58
59 d1016920 Leszek Koltunski
    mNodeEffects[0] = new PostprocessEffectGlow(haloRadiusDyn,color);
60 bee1d997 Leszek Koltunski
61
    Dynamic1D degreeDyn= new Dynamic1D(duration,1.0f);
62
    degreeDyn.add(new Static1D(1.0f));
63 2010c6f7 Leszek Koltunski
    degreeDyn.add(new Static1D(1.5f));
64 bee1d997 Leszek Koltunski
    degreeDyn.add(new Static1D(1.0f));
65
66 2010c6f7 Leszek Koltunski
    mNodeEffects[1] = new VertexEffectSink(degreeDyn,new Static3D(0,0,0), new Static4D(0,0,0,0.5f) );
67 bee1d997 Leszek Koltunski
    }
68
69
///////////////////////////////////////////////////////////////////////////////////////////////////
70
// Enable all effects used in this Effect. Called by reflection from the parent class.
71
72
  @SuppressWarnings("unused")
73
  static void enable()
74
    {
75
    PostprocessEffectGlow.enable();
76
    VertexEffectSink.enable();
77
    }
78
  }