Project

General

Profile

« Previous | Next » 

Revision d75b7581

Added by Leszek Koltunski almost 2 years ago

Circle 2x2: mesh, jsons.

View differences:

src/main/java/org/distorted/objectlib/objects/TwistyCrazy2x2.java
43 43
  public static final int CIRCLE = 0x29;
44 44

  
45 45
  private static final float DIAMETER_RATIO = 0.60f;
46
  private static final float DIFF = 1.0f;
46 47
  private static final int NUMBER_CORNER_SEGMENTS = 4;
47 48

  
48 49
  static final Static3D[] ROT_AXIS = new Static3D[]
......
74 75
    final float A = 0.50000f;
75 76
    final float B = 0.45424f;
76 77
    final float C = 0.11830f;
77
    final float D = 0.01000f;
78 78

  
79 79
    mStickerCoords = new float[][]
80 80
      {
81 81
        {  B, A,-A, A,-A,-B,-C,-B, B, C },
82
        { -A, A,-A,-A, A,-A },
83
        { -D,-D, D,-D, D, D }
82
        { -A, A,-A,-A, A,-A }
84 83
      };
85 84
    }
86 85

  
......
89 88
  @Override
90 89
  public int getCubitRotationType(int cubit)
91 90
    {
92
    return cubit<8 ? Cubit.TYPE_NORMAL : ( cubit<32 ? Cubit.TYPE_FOLLOWER : Cubit.TYPE_DECIDER );
91
    return cubit<8 ? Cubit.TYPE_NORMAL : ( cubit<11 ? Cubit.TYPE_DECIDER : Cubit.TYPE_FOLLOWER);
93 92
    }
94 93

  
95 94
///////////////////////////////////////////////////////////////////////////////////////////////////
......
107 106
        {
108 107
        switch(i)
109 108
          {
110
          case 32: mOffsets[i] = new float[] {1,0,0}; break;
111
          case 33: mOffsets[i] = new float[] {0,1,0}; break;
112
          case 34: mOffsets[i] = new float[] {0,0,-1};break;
109
          case  8: mOffsets[i] = new float[] { 1,0,0}; break;
110
          case  9: mOffsets[i] = new float[] {0, 1,0}; break;
111
          case 10: mOffsets[i] = new float[] {0,0,-1}; break;
113 112
          default: mOffsets[i] = tmp;
114 113
          }
115 114
        }
......
198 197
    {
199 198
    if( mPositions==null )
200 199
      {
201
      final float D = 1.02f;
202
      final float E = 0.50f;
200
      final float E = -DIFF+0.5f;
203 201

  
204 202
      mPositions = new float[][]
205 203
         {
......
212 210
             {-0.5f,-0.5f, 0.5f},
213 211
             {-0.5f,-0.5f,-0.5f},
214 212

  
213
             { E, 0.5f,-0.5f}, //
214
             { 0.5f, E,-0.5f}, // Deciders first
215
             { 0.5f, 0.5f,-E}, //
216

  
215 217
             { 0.5f, 0.5f, E},
216
             { 0.5f, 0.5f,-E},
218

  
217 219
             { 0.5f,-0.5f, E},
218 220
             { 0.5f,-0.5f,-E},
219 221
             {-0.5f, 0.5f, E},
......
222 224
             {-0.5f,-0.5f,-E},
223 225
             { 0.5f, E, 0.5f},
224 226
             { 0.5f,-E, 0.5f},
225
             { 0.5f, E,-0.5f},
227

  
226 228
             { 0.5f,-E,-0.5f},
227 229
             {-0.5f, E, 0.5f},
228 230
             {-0.5f,-E, 0.5f},
......
230 232
             {-0.5f,-E,-0.5f},
231 233
             { E, 0.5f, 0.5f},
232 234
             {-E, 0.5f, 0.5f},
233
             { E, 0.5f,-0.5f},
235

  
234 236
             {-E, 0.5f,-0.5f},
235 237
             { E,-0.5f, 0.5f},
236 238
             {-E,-0.5f, 0.5f},
237 239
             { E,-0.5f,-0.5f},
238 240
             {-E,-0.5f,-0.5f},
239

  
240
             {-D   ,-0.5f, 0.5f},
241
             {-0.5f,   -D, 0.5f},
242
             {-0.5f,-0.5f,    D}
243 241
         };
244 242
      }
245 243

  
......
251 249
  public Static4D getCubitQuats(int cubit, int[] numLayers)
252 250
    {
253 251
    if( mQuatIndex==null ) mQuatIndex = new int[] { 0,1,17,22,4,5,8,19,
254
                                                    0,18,7,2, 9,5,8,19, 13,3,1,22, 14,23,15,11, 21,4,6,10, 17,20,12,16,
255
                                                    0, 0, 0 };
252
                                                    6,1,18,
253
                                                    0,7,2, 9,5,8,19, 13,3,22, 14,23,15,11, 21,4,10, 17,20,12,16 };
256 254
    return mObjectQuats[mQuatIndex[cubit]];
257 255
    }
258 256

  
......
410 408

  
411 409
  private ObjectShape getSmallCircleShape()
412 410
    {
413
    final float D = 0.02f;
411
    final float D = DIFF+0.02f;
414 412
    final float H = DIAMETER_RATIO-0.5f;
415 413
    final float INIT_ALPHA = 0;
416 414
    final float STEP_CORNER= (float)((Math.PI/2)/NUMBER_CORNER_SEGMENTS);
......
469 467
    return new ObjectShape(vertices,indices);
470 468
    }
471 469

  
472
///////////////////////////////////////////////////////////////////////////////////////////////////
473

  
474
  private ObjectShape getDeciderShape()
475
    {
476
    final float A = 0.5f;
477
    float[][] vertices = new float[][] { {-A,-A,0},{A,-A,0},{A,A,0} };
478
    int[][] indices = new int[][] { {0,1,2} };
479

  
480
    return new ObjectShape(vertices,indices);
481
    }
482

  
483 470
///////////////////////////////////////////////////////////////////////////////////////////////////
484 471

  
485 472
  public ObjectShape getObjectShape(int variant)
......
488 475
      {
489 476
      case 0: return getCornerShape();
490 477
      case 1: return getSmallCircleShape();
491
      case 2: return getDeciderShape();
492 478
      }
493 479

  
494 480
    return null;
......
502 488
      {
503 489
      float h1 = isInIconMode() ? 0.001f : 0.04f;
504 490
      float h2 = 0.001f;
505
      float[][] bands   = { {h1,45,0.3f,0.7f,5,0,0}, {h2,5,0.3f,0.2f,5,0,0} };
491
      float[][] bands   = { {h1,45,0.3f,0.7f,5,0,0}, {h2,5,0.3f,0.2f,5,0,0}, {h2,5,0.3f,0.2f,2,0,0} };
506 492
      final int NUM_BANDS = 6+3*NUMBER_CORNER_SEGMENTS;
507 493
      int[] bandIndices = new int[NUM_BANDS];
508 494
      bandIndices[0] = bandIndices[1] = bandIndices[2] = 0;
509
      for(int i=3; i<NUM_BANDS; i++) bandIndices[i] = 1;
495
      bandIndices[3] = bandIndices[4] = bandIndices[5] = 0;
496
      for(int i=6; i<NUM_BANDS; i++) bandIndices[i] = 2;
510 497
      float[][] corners = { {0.02f,0.09f} };
511 498
      float[][] centers = { { 0.0f, 0.0f, 0.0f } };
512 499
      final int SINGLE_ARC = NUMBER_CORNER_SEGMENTS+1;
......
517 504
      for(int i=4; i<NUM_VERTICES; i++) indices[i] = -1;
518 505
      return new ObjectFaceShape(bands,bandIndices,corners,indices,centers,indices,null);
519 506
      }
520
    else if( variant==1 )
507
    else
521 508
      {
522
      float h1 = isInIconMode() ? 0.001f : 0.02f;
509
      float h1 = isInIconMode() ? 0.001f : 0.03f;
523 510
      float[][] bands   = { {h1,45,0.2f,0.4f,5,0,0}, {0.001f,1,0.3f,0.5f,3,0,0}, {0.001f,1,0.3f,0.5f,2,0,0} };
524 511
      final int NUM_BANDS = 4 + NUMBER_CORNER_SEGMENTS;
525 512
      int[] bandIndices = new int[NUM_BANDS];
......
535 522
      indices[0] = indices[1] = indices[2] = 0;
536 523
      return new ObjectFaceShape(bands,bandIndices,corners,indices,centers,indices,null);
537 524
      }
538
    else
539
      {
540
      float h1 = 0.001f;
541
      float[][] bands   = { {h1,1,0.2f,0.4f,2,0,0} };
542
      int[] bandIndices = new int[] {0};
543
      float[][] corners = { {0.02f,0.09f} };
544
      float[][] centers = { { 0.0f, 0.0f, 0.0f } };
545
      int[] indices = new int[] {-1,-1,-1};
546
      return new ObjectFaceShape(bands,bandIndices,corners,indices,centers,indices,null);
547
      }
548 525
    }
549 526

  
550 527
///////////////////////////////////////////////////////////////////////////////////////////////////
551 528

  
552 529
  public int getNumCubitVariants(int[] numLayers)
553 530
    {
554
    return 3;
531
    return 2;
555 532
    }
556 533

  
557 534
///////////////////////////////////////////////////////////////////////////////////////////////////
558 535

  
559 536
  public int getCubitVariant(int cubit, int[] numLayers)
560 537
    {
561
    return cubit<8 ? 0 : (cubit<32 ? 1:2);
538
    return cubit<8?0:1;
562 539
    }
563 540

  
564 541
///////////////////////////////////////////////////////////////////////////////////////////////////
......
580 557
  public float[][] getStickerAngles()
581 558
    {
582 559
    float D = (float)(Math.PI/4);
583
    return new float[][] { { 0,0,0,-D,0 },{ 0,0,D },{0,0,0} };
560
    return new float[][] { { 0,0,0,-D,0 },{ 0,0,D } };
584 561
    }
585 562

  
586 563
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff