Project

General

Profile

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

magiccube / src / main / java / org / distorted / effect / SolveEffectSpin.java @ 42772cff

1 a7012218 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2019 Leszek Koltunski                                                               //
3
//                                                                                               //
4
// This file is part of Distorted.                                                               //
5
//                                                                                               //
6
// Distorted 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
// Distorted 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 Distorted.  If not, see <http://www.gnu.org/licenses/>.                            //
18
///////////////////////////////////////////////////////////////////////////////////////////////////
19
20
package org.distorted.effect;
21
22
///////////////////////////////////////////////////////////////////////////////////////////////////
23
24 584f7954 Leszek Koltunski
import org.distorted.library.effect.Effect;
25 ff065f8f Leszek Koltunski
import org.distorted.library.effect.MatrixEffectRotate;
26
import org.distorted.library.type.Dynamic;
27
import org.distorted.library.type.Dynamic1D;
28
import org.distorted.library.type.Static1D;
29 584f7954 Leszek Koltunski
import org.distorted.library.type.Static3D;
30
31 2ecf0c21 Leszek Koltunski
public class SolveEffectSpin extends SolveEffect
32 a7012218 Leszek Koltunski
  {
33 086a24d0 Leszek Koltunski
  public void createEffectsPhase0(int duration)
34 584f7954 Leszek Koltunski
    {
35 ff065f8f Leszek Koltunski
    mCubeEffectPosition[0] = new int[] {3};
36 086a24d0 Leszek Koltunski
    mCubeEffects[0]        = new Effect[mCubeEffectPosition[0].length];
37 584f7954 Leszek Koltunski
38 ff065f8f Leszek Koltunski
    Static3D axis  = new Static3D(1,0,0);
39
    Static3D center= new Static3D(0,0,0);
40
41
    Dynamic1D d0 = new Dynamic1D(duration/2, 1.0f);
42
    d0.setMode(Dynamic.MODE_JUMP);
43 6e3cb7dd Leszek Koltunski
    d0.setConvexity(0.0f);          // otherwise speed of the rotation would be strangely uneven
44 ff065f8f Leszek Koltunski
    d0.add(new Static1D( 0*36));
45
    d0.add(new Static1D( 1*36));
46
    d0.add(new Static1D( 3*36));
47
    d0.add(new Static1D( 6*36));
48
    d0.add(new Static1D(10*36));
49
    mCubeEffects[0][0] = new MatrixEffectRotate(d0,axis,center);
50 086a24d0 Leszek Koltunski
    }
51
52
///////////////////////////////////////////////////////////////////////////////////////////////////
53 584f7954 Leszek Koltunski
54 086a24d0 Leszek Koltunski
  public void createEffectsPhase1(int duration)
55
    {
56 ff065f8f Leszek Koltunski
    mCubeEffectPosition[1] = new int[] {3};
57 086a24d0 Leszek Koltunski
    mCubeEffects[1]        = new Effect[mCubeEffectPosition[1].length];
58 584f7954 Leszek Koltunski
59 ff065f8f Leszek Koltunski
    Static3D axis  = new Static3D(1,0,0);
60
    Static3D center= new Static3D(0,0,0);
61
62
    Dynamic1D d1 = new Dynamic1D(duration/2, 1.0f);
63
    d1.setMode(Dynamic.MODE_JUMP);
64 6e3cb7dd Leszek Koltunski
    d1.setConvexity(0.0f);
65 ff065f8f Leszek Koltunski
    d1.add(new Static1D( 0*36));
66
    d1.add(new Static1D( 4*36));
67
    d1.add(new Static1D( 7*36));
68
    d1.add(new Static1D( 9*36));
69
    d1.add(new Static1D(10*36));
70
    mCubeEffects[1][0] = new MatrixEffectRotate(d1,axis,center);
71 584f7954 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 a7012218 Leszek Koltunski
80 584f7954 Leszek Koltunski
    }
81 a7012218 Leszek Koltunski
  }