Project

General

Profile

« Previous | Next » 

Revision 6db60be8

Added by Leszek Koltunski over 3 years ago

New 'JingPyraminx' object - improvements

View differences:

src/main/java/org/distorted/objects/MovementJing.java
25 25

  
26 26
class MovementJing extends Movement
27 27
{
28
  static final float DIST3D = SQ6/12;
29
  static final float DIST2D = SQ3/6;
28
  private static final float M = (1.0f/4);
29
  static final float DIST3D = (SQ6/12)*M;
30
  static final float DIST2D = (SQ3/ 6)*M;
30 31

  
31 32
  static final Static3D[] FACE_AXIS = new Static3D[]
32 33
         {
src/main/java/org/distorted/objects/TwistyJing.java
58 58
           COLOR_BLUE  , COLOR_RED
59 59
         };
60 60

  
61
  private static final int[] ROT_QUAT = {0,1,2,7,0,2,7,6,3,10,0,1,3,5};
62

  
61 63
  // computed with res/raw/compute_quats.c
62 64
  private static final Static4D[] QUATS = new Static4D[]
63 65
         {
......
77 79

  
78 80
  static final float[][] CENTERS = new float[][]
79 81
         {
80
           { 0.000f, -SQ2/4,  0.500f },
81
           { 0.000f, -SQ2/4, -0.500f },
82
           {-0.500f,  SQ2/4,  0.000f },
83
           { 0.500f,  SQ2/4,  0.000f },
82
           { 0.000f, -SQ2/4, 0.500f },
83
           { 0.000f, -SQ2/4,-0.500f },
84
           {-0.500f,  SQ2/4, 0.000f },
85
           { 0.500f,  SQ2/4, 0.000f },
84 86

  
85 87
           { 0.000f, -SQ2/4, 0.000f },
86 88
           {-0.250f, 0.000f, 0.250f },
......
101 103
  // GREEN 8 YELLOW 9 BLUE 10 RED 11
102 104
  private static final int[][] mFaceMap = new int[][]
103 105
         {
104
           {  2, 3, 1, 12, 12, 12 },
105
           {  0, 1, 3, 12, 12, 12 },
106
           {  0, 2, 1, 12, 12, 12 },
107
           {  0, 3, 2, 12, 12, 12 },
108

  
109
           {  7, 5, 12, 12, 12, 12 },
110
           {  6, 5, 12, 12, 12, 12 },
111
           {  7, 6, 12, 12, 12, 12 },
112
           {  4, 5, 12, 12, 12, 12 },
113
           {  7, 4, 12, 12, 12, 12 },
114
           {  6, 4, 12, 12, 12, 12 },
106
           {  0,  3,  2, 12, 12, 12 },
107
           {  1,  2,  3, 12, 12, 12 },
108
           {  1,  0,  2, 12, 12, 12 },
109
           {  1,  3,  0, 12, 12, 12 },
110

  
111
           {  7,  6, 12, 12, 12, 12 },
112
           {  4,  6, 12, 12, 12, 12 },
113
           {  7,  4, 12, 12, 12, 12 },
114
           {  5,  6, 12, 12, 12, 12 },
115
           {  7,  5, 12, 12, 12, 12 },
116
           {  4,  5, 12, 12, 12, 12 },
115 117

  
116
           { 10, 12, 12, 12, 12, 12 },
117 118
           {  8, 12, 12, 12, 12, 12 },
118 119
           {  9, 12, 12, 12, 12, 12 },
120
           { 10, 12, 12, 12, 12, 12 },
119 121
           { 11, 12, 12, 12, 12, 12 },
120 122
         };
121 123

  
......
272 274
    return mFaceMap[cubit][cubitface];
273 275
    }
274 276

  
275
///////////////////////////////////////////////////////////////////////////////////////////////////
276

  
277
  private int getQuat(int cubit)
278
    {
279
    switch(cubit)
280
      {
281
      case  0: return 0;
282
      case  1: return 1;
283
      case  2: return 2;
284
      case  3: return 7;
285

  
286
      case  4: return 0;
287
      case  5: return 2;
288
      case  6: return 7;
289
      case  7: return 6;
290
      case  8: return 3;
291
      case  9: return 10;
292

  
293
      case 10: return 0;
294
      case 11: return 1;
295
      case 12: return 3;
296
      case 13: return 5;
297
      }
298

  
299
    return 0;
300
    }
301

  
302 277
///////////////////////////////////////////////////////////////////////////////////////////////////
303 278

  
304 279
  MeshBase createCubitMesh(int cubit, int numLayers)
......
384 359
      mesh = mMeshes[2].copy(true);
385 360
      }
386 361

  
387
    MatrixEffectQuaternion quat = new MatrixEffectQuaternion( QUATS[getQuat(cubit)], new Static3D(0,0,0) );
362
    int q = ROT_QUAT[cubit];
363
    MatrixEffectQuaternion quat = new MatrixEffectQuaternion( QUATS[q], new Static3D(0,0,0) );
388 364
    mesh.apply(quat,0xffffffff,0);
389 365

  
390 366
    return mesh;
......
400 376

  
401 377
    switch(stickerType)
402 378
      {
403
      case 0:  R = 0.05f; S = 0.05f; break;
379
      case 0:  R = 0.05f; S = 0.06f; break;
404 380
      case 1:  R = 0.03f; S = 0.03f; break;
405
      default: R = 0.05f; S = 0.06f; break;
381
      default: R = 0.05f; S = 0.05f; break;
406 382
      }
407 383

  
408 384
    FactorySticker factory = FactorySticker.getInstance();

Also available in: Unified diff