Project

General

Profile

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

magiccube / src / main / java / org / distorted / effect / win / WinEffectGlow.java @ 5ba13c05

1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2019 Leszek Koltunski                                                               //
3
//                                                                                               //
4
// This file is part of Magic Cube.                                                              //
5
//                                                                                               //
6
// Magic Cube is free software: you can redistribute it and/or modify                            //
7
// 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
// Magic Cube is distributed in the hope that it will be useful,                                 //
12
// 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
// along with Magic Cube.  If not, see <http://www.gnu.org/licenses/>.                           //
18
///////////////////////////////////////////////////////////////////////////////////////////////////
19

    
20
package org.distorted.effect.win;
21

    
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
import org.distorted.library.type.Dynamic4D;
27
import org.distorted.library.type.Static1D;
28
import org.distorted.library.type.Static3D;
29
import org.distorted.library.type.Static4D;
30

    
31
import static org.distorted.magic.RubikRenderer.NODE_MESH_SIZE;
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
    Dynamic1D radiusDyn = new Dynamic1D(duration,1.0f);
48
    radiusDyn.add(new Static1D( 0));
49
    radiusDyn.add(new Static1D(50));
50
    radiusDyn.add(new Static1D( 0));
51

    
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
    mNodeEffects[0] = new PostprocessEffectGlow(radiusDyn,color);
60

    
61
    Dynamic1D degreeDyn= new Dynamic1D(duration,1.0f);
62
    degreeDyn.add(new Static1D(1.0f));
63
    degreeDyn.add(new Static1D(2.5f));
64
    degreeDyn.add(new Static1D(1.0f));
65

    
66
    Static3D center = new Static3D(0,0,NODE_MESH_SIZE *0.5f);
67
    mNodeEffects[1] = new VertexEffectSink(degreeDyn,center);
68
    }
69

    
70
///////////////////////////////////////////////////////////////////////////////////////////////////
71
// Enable all effects used in this Effect. Called by reflection from the parent class.
72

    
73
  @SuppressWarnings("unused")
74
  static void enable()
75
    {
76
    PostprocessEffectGlow.enable();
77
    VertexEffectSink.enable();
78
    }
79
  }
(2-2/3)