Project

General

Profile

« Previous | Next » 

Revision 68ce0d53

Added by Leszek Koltunski about 3 years ago

Simplify the 'bandaged' class API.

View differences:

src/main/java/org/distorted/objects/TwistyBandagedEvil.java
33 33

  
34 34
class TwistyBandagedEvil extends TwistyBandagedAbstract
35 35
{
36
  TwistyBandagedEvil(int size, Static4D quat, DistortedTexture texture, MeshSquare mesh,
37
                     DistortedEffects effects, int[][] moves, Resources res, int scrWidth)
38
    {
39
    super(size, quat, texture, mesh, effects, moves, ObjectList.BAN4, res, scrWidth);
40
    }
41

  
42
///////////////////////////////////////////////////////////////////////////////////////////////////
43

  
44
  int getCubitVariant(int cubit)
45
    {
46
    switch(cubit)
36
  private static final float[][] POSITIONS = new float[][]
47 37
      {
48
      case 0: return 0;
49
      case 1: return 3;
50
      }
51

  
52
    return 1;
53
    }
38
        { 1.0f,  1.0f, -1.0f},
39
        {-1.0f, -1.0f,  0.0f, -1.0f,  0.0f,  0.0f, 0.0f, -1.0f,  0.0f,  0.0f,  0.0f,  0.0f},
40
        {-1.0f,  1.0f, -1.0f,  0.0f,  1.0f, -1.0f},
41
        {-1.0f,  0.0f, -1.0f,  0.0f,  0.0f, -1.0f},
42
        {-1.0f, -1.0f, -1.0f,  0.0f, -1.0f, -1.0f},
43
        {-1.0f,  1.0f,  0.0f, -1.0f,  1.0f,  1.0f},
44
        { 0.0f,  1.0f,  0.0f,  0.0f,  1.0f,  1.0f},
45
        { 1.0f,  1.0f,  0.0f,  1.0f,  1.0f,  1.0f},
46
        {-1.0f, -1.0f,  1.0f, -1.0f,  0.0f,  1.0f},
47
        { 0.0f, -1.0f,  1.0f,  0.0f,  0.0f,  1.0f},
48
        { 1.0f, -1.0f,  1.0f,  1.0f,  0.0f,  1.0f},
49
        { 1.0f, -1.0f,  0.0f,  1.0f,  0.0f,  0.0f},
50
        { 1.0f, -1.0f, -1.0f,  1.0f,  0.0f, -1.0f}
51
      };
52

  
53
  private static final int[] QUAT_INDICES = new int[]
54
      { 0, 1, 0, 0, 0, 2, 2, 2, 3, 3, 3, 3, 3 };
54 55

  
55 56
///////////////////////////////////////////////////////////////////////////////////////////////////
56 57

  
57
  int getNumCubits()
58
  TwistyBandagedEvil(int size, Static4D quat, DistortedTexture texture, MeshSquare mesh,
59
                     DistortedEffects effects, int[][] moves, Resources res, int scrWidth)
58 60
    {
59
    return 13;
61
    super(size, quat, texture, mesh, effects, moves, ObjectList.BAN4, res, scrWidth);
60 62
    }
61 63

  
62 64
///////////////////////////////////////////////////////////////////////////////////////////////////
63 65

  
64
  float[] getCubitPosition(int cubit)
66
  float[][] getPositions()
65 67
    {
66
    switch(cubit)
67
      {
68
      case  0: return new float[] { 1.0f,  1.0f, -1.0f};
69
      case  1: return new float[] {-1.0f, -1.0f,  0.0f,
70
                                   -1.0f,  0.0f,  0.0f,
71
                                    0.0f, -1.0f,  0.0f,
72
                                    0.0f,  0.0f,  0.0f};
73
      case  2: return new float[] {-1.0f,  1.0f, -1.0f,
74
                                    0.0f,  1.0f, -1.0f};
75
      case  3: return new float[] {-1.0f,  0.0f, -1.0f,
76
                                    0.0f,  0.0f, -1.0f};
77
      case  4: return new float[] {-1.0f, -1.0f, -1.0f,
78
                                    0.0f, -1.0f, -1.0f};
79
      case  5: return new float[] {-1.0f,  1.0f,  0.0f,
80
                                   -1.0f,  1.0f,  1.0f};
81
      case  6: return new float[] { 0.0f,  1.0f,  0.0f,
82
                                    0.0f,  1.0f,  1.0f};
83
      case  7: return new float[] { 1.0f,  1.0f,  0.0f,
84
                                    1.0f,  1.0f,  1.0f};
85
      case  8: return new float[] {-1.0f, -1.0f,  1.0f,
86
                                   -1.0f,  0.0f,  1.0f};
87
      case  9: return new float[] { 0.0f, -1.0f,  1.0f,
88
                                    0.0f,  0.0f,  1.0f};
89
      case 10: return new float[] { 1.0f, -1.0f,  1.0f,
90
                                    1.0f,  0.0f,  1.0f};
91
      case 11: return new float[] { 1.0f, -1.0f,  0.0f,
92
                                    1.0f,  0.0f,  0.0f};
93
      case 12: return new float[] { 1.0f, -1.0f, -1.0f,
94
                                    1.0f,  0.0f, -1.0f};
95
      }
96

  
97
    return null;
68
    return POSITIONS;
98 69
    }
99 70

  
100 71
///////////////////////////////////////////////////////////////////////////////////////////////////
101 72

  
102
  int getQuatIndex(int cubit)
73
  int[] getQuatIndices()
103 74
    {
104
    switch(cubit)
105
      {
106
      case 1: return 1;
107
      case 0:
108
      case 2:
109
      case 3:
110
      case 4: return 0;
111
      case 5:
112
      case 6:
113
      case 7: return 2;
114
      default:return 3;
115
      }
75
    return QUAT_INDICES;
116 76
    }
117 77

  
118 78
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff