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

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

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

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

  
67
  private static final int[] QUAT_INDICES = new int[] { 0 };
48 68

  
49 69
///////////////////////////////////////////////////////////////////////////////////////////////////
50 70

  
51
  int getNumCubits()
71
  TwistyBandagedFused(int size, Static4D quat, DistortedTexture texture, MeshSquare mesh,
72
                      DistortedEffects effects, int[][] moves, Resources res, int scrWidth)
52 73
    {
53
    return 20;
74
    super(size, quat, texture, mesh, effects, moves, ObjectList.BAN1, res, scrWidth);
54 75
    }
55 76

  
56 77
///////////////////////////////////////////////////////////////////////////////////////////////////
57 78

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

  
91
    return null;
81
    return POSITIONS;
92 82
    }
93 83

  
94 84
///////////////////////////////////////////////////////////////////////////////////////////////////
95 85

  
96
  int getQuatIndex(int cubit)
86
  int[] getQuatIndices()
97 87
    {
98
    return 0;
88
    return QUAT_INDICES;
99 89
    }
100 90

  
101 91
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff