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/TwistyBandaged3Plate.java
159 159

  
160 160
///////////////////////////////////////////////////////////////////////////////////////////////////
161 161

  
162
  TwistyBandaged3Plate(int size, Static4D quat, DistortedTexture texture, MeshSquare mesh,
163
                       DistortedEffects effects, int[][] moves, Resources res, int scrWidth)
164
    {
165
    super(size, quat, texture, mesh, effects, moves, ObjectList.BAN3, res, scrWidth);
166
    }
167

  
168
///////////////////////////////////////////////////////////////////////////////////////////////////
162
  private static final float[][] POSITIONS = new float[][]
163
      {
164
       {-1.0f,  1.0f,  1.0f, -1.0f,  0.0f,  1.0f,  0.0f,  1.0f,  1.0f,  0.0f,  0.0f,  1.0f},
165
       { 1.0f,  0.0f, -1.0f,  1.0f,  0.0f,  0.0f,  1.0f,  1.0f, -1.0f,  1.0f,  1.0f,  0.0f},
166
       {-1.0f, -1.0f, -1.0f, -1.0f, -1.0f,  0.0f,  0.0f, -1.0f, -1.0f,  0.0f, -1.0f,  0.0f},
167
       { 1.0f,  1.0f,  1.0f},
168
       { 1.0f,  0.0f,  1.0f},
169
       { 1.0f, -1.0f,  1.0f},
170
       {-1.0f, -1.0f,  1.0f},
171
       { 0.0f, -1.0f,  1.0f},
172
       { 1.0f, -1.0f,  0.0f},
173
       { 1.0f, -1.0f, -1.0f},
174
       {-1.0f,  1.0f, -1.0f},
175
       {-1.0f,  1.0f,  0.0f},
176
       { 0.0f,  1.0f, -1.0f},
177
       { 0.0f,  1.0f,  0.0f},
178
       {-1.0f,  0.0f, -1.0f},
179
       {-1.0f,  0.0f,  0.0f},
180
       { 0.0f,  0.0f, -1.0f}
181
      };
169 182

  
170
  int getCubitVariant(int cubit)
171
    {
172
    return cubit<=2 ? 3:0;
173
    }
183
  private static final int[] QUAT_INDICES = new int[] { 1, 3 };
174 184

  
175 185
///////////////////////////////////////////////////////////////////////////////////////////////////
176 186

  
177
  int getNumCubits()
187
  TwistyBandaged3Plate(int size, Static4D quat, DistortedTexture texture, MeshSquare mesh,
188
                       DistortedEffects effects, int[][] moves, Resources res, int scrWidth)
178 189
    {
179
    return 17;
190
    super(size, quat, texture, mesh, effects, moves, ObjectList.BAN3, res, scrWidth);
180 191
    }
181 192

  
182 193
///////////////////////////////////////////////////////////////////////////////////////////////////
183 194

  
184
  float[] getCubitPosition(int cubit)
195
  float[][] getPositions()
185 196
    {
186
    switch(cubit)
187
      {
188
      case  0: return new float[] {-1.0f,  1.0f,  1.0f,
189
                                   -1.0f,  0.0f,  1.0f,
190
                                    0.0f,  1.0f,  1.0f,
191
                                    0.0f,  0.0f,  1.0f};
192
      case  1: return new float[] { 1.0f,  0.0f, -1.0f,
193
                                    1.0f,  0.0f,  0.0f,
194
                                    1.0f,  1.0f, -1.0f,
195
                                    1.0f,  1.0f,  0.0f};
196
      case  2: return new float[] {-1.0f, -1.0f, -1.0f,
197
                                   -1.0f, -1.0f,  0.0f,
198
                                    0.0f, -1.0f, -1.0f,
199
                                    0.0f, -1.0f,  0.0f};
200
      case  3: return new float[] { 1.0f,  1.0f,  1.0f};
201
      case  4: return new float[] { 1.0f,  0.0f,  1.0f};
202
      case  5: return new float[] { 1.0f, -1.0f,  1.0f};
203
      case  6: return new float[] {-1.0f, -1.0f,  1.0f};
204
      case  7: return new float[] { 0.0f, -1.0f,  1.0f};
205
      case  8: return new float[] { 1.0f, -1.0f,  0.0f};
206
      case  9: return new float[] { 1.0f, -1.0f, -1.0f};
207
      case 10: return new float[] {-1.0f,  1.0f, -1.0f};
208
      case 11: return new float[] {-1.0f,  1.0f,  0.0f};
209
      case 12: return new float[] { 0.0f,  1.0f, -1.0f};
210
      case 13: return new float[] { 0.0f,  1.0f,  0.0f};
211
      case 14: return new float[] {-1.0f,  0.0f, -1.0f};
212
      case 15: return new float[] {-1.0f,  0.0f,  0.0f};
213
      case 16: return new float[] { 0.0f,  0.0f, -1.0f};
214
      }
215

  
216
    return null;
197
    return POSITIONS;
217 198
    }
218 199

  
219 200
///////////////////////////////////////////////////////////////////////////////////////////////////
220 201

  
221
  int getQuatIndex(int cubit)
202
  int[] getQuatIndices()
222 203
    {
223
    switch(cubit)
224
      {
225
      case 0: return 1;
226
      case 1: return 3;
227
      }
228

  
229
    return 0;
204
    return QUAT_INDICES;
230 205
    }
231 206

  
232 207
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff