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/TwistyBandaged2Bar.java
33 33

  
34 34
class TwistyBandaged2Bar extends TwistyBandagedAbstract
35 35
{
36
  TwistyBandaged2Bar(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.BAN2, res, scrWidth);
40
    }
41

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

  
44
  int getCubitVariant(int cubit)
45
    {
46
    return cubit<=1 ? 2:0;
47
    }
36
  private static final float[][] POSITIONS = new float[][]
37
      {
38
       { 0.0f, +1.0f,  1.0f, 0.0f, +1.0f,  0.0f, 0.0f, +1.0f, -1.0f},
39
       {-1.0f, -1.0f,  0.0f, 0.0f, -1.0f,  0.0f, 1.0f, -1.0f,  0.0f},
40
       {-1.0f, +1.0f, +1.0f},
41
       {-1.0f, +1.0f,  0.0f},
42
       {-1.0f, +1.0f, -1.0f},
43
       {-1.0f,  0.0f, +1.0f},
44
       {-1.0f,  0.0f,  0.0f},
45
       {-1.0f,  0.0f, -1.0f},
46
       {-1.0f, -1.0f, +1.0f},
47
       {-1.0f, -1.0f, -1.0f},
48
       {+1.0f, +1.0f, +1.0f},
49
       {+1.0f, +1.0f,  0.0f},
50
       {+1.0f, +1.0f, -1.0f},
51
       {+1.0f,  0.0f, +1.0f},
52
       {+1.0f,  0.0f,  0.0f},
53
       {+1.0f,  0.0f, -1.0f},
54
       {+1.0f, -1.0f, +1.0f},
55
       {+1.0f, -1.0f, -1.0f},
56
       { 0.0f,  0.0f, +1.0f},
57
       { 0.0f, -1.0f, +1.0f},
58
       { 0.0f,  0.0f, -1.0f},
59
       { 0.0f, -1.0f, -1.0f}
60
      };
61

  
62
  private static final int[] QUAT_INDICES = new int[] { 2 };
48 63

  
49 64
///////////////////////////////////////////////////////////////////////////////////////////////////
50 65

  
51
  int getNumCubits()
66
  TwistyBandaged2Bar(int size, Static4D quat, DistortedTexture texture, MeshSquare mesh,
67
                     DistortedEffects effects, int[][] moves, Resources res, int scrWidth)
52 68
    {
53
    return 22;
69
    super(size, quat, texture, mesh, effects, moves, ObjectList.BAN2, res, scrWidth);
54 70
    }
55 71

  
56 72
///////////////////////////////////////////////////////////////////////////////////////////////////
57 73

  
58
  float[] getCubitPosition(int cubit)
74
  float[][] getPositions()
59 75
    {
60
    switch(cubit)
61
      {
62
      case  0: return new float[] { 0.0f, +1.0f,  1.0f,
63
                                    0.0f, +1.0f,  0.0f,
64
                                    0.0f, +1.0f, -1.0f};
65
      case  1: return new float[] {-1.0f, -1.0f,  0.0f,
66
                                    0.0f, -1.0f,  0.0f,
67
                                    1.0f, -1.0f,  0.0f};
68
      case  2: return new float[] {-1.0f, +1.0f, +1.0f};
69
      case  3: return new float[] {-1.0f, +1.0f,  0.0f};
70
      case  4: return new float[] {-1.0f, +1.0f, -1.0f};
71
      case  5: return new float[] {-1.0f,  0.0f, +1.0f};
72
      case  6: return new float[] {-1.0f,  0.0f,  0.0f};
73
      case  7: return new float[] {-1.0f,  0.0f, -1.0f};
74
      case  8: return new float[] {-1.0f, -1.0f, +1.0f};
75
      case  9: return new float[] {-1.0f, -1.0f, -1.0f};
76
      case 10: return new float[] {+1.0f, +1.0f, +1.0f};
77
      case 11: return new float[] {+1.0f, +1.0f,  0.0f};
78
      case 12: return new float[] {+1.0f, +1.0f, -1.0f};
79
      case 13: return new float[] {+1.0f,  0.0f, +1.0f};
80
      case 14: return new float[] {+1.0f,  0.0f,  0.0f};
81
      case 15: return new float[] {+1.0f,  0.0f, -1.0f};
82
      case 16: return new float[] {+1.0f, -1.0f, +1.0f};
83
      case 17: return new float[] {+1.0f, -1.0f, -1.0f};
84
      case 18: return new float[] { 0.0f,  0.0f, +1.0f};
85
      case 19: return new float[] { 0.0f, -1.0f, +1.0f};
86
      case 20: return new float[] { 0.0f,  0.0f, -1.0f};
87
      case 21: return new float[] { 0.0f, -1.0f, -1.0f};
88
      }
89

  
90
    return null;
76
    return POSITIONS;
91 77
    }
92 78

  
93 79
///////////////////////////////////////////////////////////////////////////////////////////////////
94 80

  
95
  int getQuatIndex(int cubit)
81
  int[] getQuatIndices()
96 82
    {
97
    return cubit==0 ? 2 : 0;
83
    return QUAT_INDICES;
98 84
    }
99 85

  
100 86
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff