Project

General

Profile

« Previous | Next » 

Revision cadc79fe

Added by Leszek Koltunski 12 months ago

Progress with Ancient Coin Cube.

View differences:

src/main/java/org/distorted/objectlib/main/ObjectType.java
109 109
  DINO_3 ( TwistyDino6.class          , 10, R.drawable.dino_3, true,     0, new InitData(new int[] {3,3,3,3})),
110 110
  DIN4_3 ( TwistyDino4.class          ,  9, R.drawable.din4_3, true,    30, new InitData(new int[] {3,3,3,3})),
111 111

  
112
  TINS_5 ( TwistyTins.class           , 28, R.drawable.coin_3, true,   60, new InitData(new int[] {5,5,5,5})),
112
  COIH_3 ( TwistyCoinHexahedron.class , 25, R.drawable.coin_3, true,   50, new InitData(new int[] {3,3,3,3,3,3,3})),
113 113

  
114 114
  COIN_3 ( TwistyCoinTetrahedron.class, 15, R.drawable.coin_3, false,   40, new InitData(new int[] {3,3,3,3})),
115

  
115
  TINS_5 ( TwistyTins.class           , 28, R.drawable.coin_3, false,    60, new InitData(new int[] {5,5,5,5})),
116 116
  ;
117 117

  
118 118
  public static int NUM_OBJECTS;
src/main/java/org/distorted/objectlib/objects/TwistyCoinHexahedron.java
16 16
import org.distorted.library.type.Static3D;
17 17
import org.distorted.library.type.Static4D;
18 18
import org.distorted.objectlib.helpers.FactoryCubit;
19
import org.distorted.objectlib.helpers.FactorySticker;
20 19
import org.distorted.objectlib.helpers.ObjectFaceShape;
21 20
import org.distorted.objectlib.helpers.ObjectShape;
22 21
import org.distorted.objectlib.helpers.ObjectSignature;
......
59 58
  public TwistyCoinHexahedron(int meshState, int iconMode, Static4D quat, Static3D move, float scale, InitData data, InitAssets asset)
60 59
    {
61 60
    super(meshState, iconMode, data.getNumLayers()[0], quat, move, scale, data, asset);
62

  
63

  
64 61
    }
65 62

  
66 63
///////////////////////////////////////////////////////////////////////////////////////////////////
......
145 142
    if( mPosition==null )
146 143
      {
147 144
      final float A = 1.5f-C;
145
      final float B = 1.52f;
148 146
      final float E = 0.75f*D;
149 147

  
150 148
      mPosition = new float[][]
......
158 156
             {-A,-A, A},
159 157
             {-A,-A,-A},
160 158

  
161
             { 0.00f, 0.00f, 1.50f},
162
             { 0.00f, 0.00f,-1.50f},
163
             { 0.00f, 1.50f, 0.00f},
164
             { 0.00f,-1.50f, 0.00f},
165
             { 1.50f, 0.00f, 0.00f},
166
             {-1.50f, 0.00f, 0.00f},
167

  
168
             {     E,     E, 1.50f},
169
             {     E,    -E, 1.50f},
170
             {    -E,     E, 1.50f},
171
             {    -E,    -E, 1.50f},
172
             {     E,     E,-1.50f},
173
             {     E,    -E,-1.50f},
174
             {    -E,     E,-1.50f},
175
             {    -E,    -E,-1.50f},
176
             {     E, 1.50f,     E},
177
             {     E, 1.50f,    -E},
178
             {    -E, 1.50f,     E},
179
             {    -E, 1.50f,    -E},
180
             {     E,-1.50f,     E},
181
             {     E,-1.50f,    -E},
182
             {    -E,-1.50f,     E},
183
             {    -E,-1.50f,    -E},
184
             { 1.50f,     E,     E},
185
             { 1.50f,     E,    -E},
186
             { 1.50f,    -E,     E},
187
             { 1.50f,    -E,    -E},
188
             {-1.50f,     E,     E},
189
             {-1.50f,     E,    -E},
190
             {-1.50f,    -E,     E},
191
             {-1.50f,    -E,    -E},
159
             { 0, 0, B },
160
             { 0, 0,-B },
161
             { 0, B, 0 },
162
             { 0,-B, 0 },
163
             { B, 0, 0 },
164
             {-B, 0, 0 },
165

  
166
             { E, E, B},
167
             { E,-E, B},
168
             {-E, E, B},
169
             {-E,-E, B},
170
             { E, E,-B},
171
             { E,-E,-B},
172
             {-E, E,-B},
173
             {-E,-E,-B},
174
             { E, B, E},
175
             { E, B,-E},
176
             {-E, B, E},
177
             {-E, B,-E},
178
             { E,-B, E},
179
             { E,-B,-E},
180
             {-E,-B, E},
181
             {-E,-B,-E},
182
             { B, E, E},
183
             { B, E,-E},
184
             { B,-E, E},
185
             { B,-E,-E},
186
             {-B, E, E},
187
             {-B, E,-E},
188
             {-B,-E, E},
189
             {-B,-E,-E},
192 190
         };
193 191
      }
194 192

  
......
233 231
    final int N3 = N2 + N + 1;
234 232
    float[][] vertices= new float[3*N+8][3];
235 233

  
236
    vertices[3*(N+1)+4][0] = -A;
237
    vertices[3*(N+1)+4][1] = -A;
238
    vertices[3*(N+1)+4][2] = -A;
234
    vertices[3*N+7][0] = -A;
235
    vertices[3*N+7][1] = -A;
236
    vertices[3*N+7][2] = -A;
239 237

  
240 238
    vertices[0][0] = 0;
241 239
    vertices[0][1] = 0;
......
353 351

  
354 352
  private int[][] produceCornerShape()
355 353
    {
356
    int[][] indices = new int[3*N+3][];
354
    int[][] indices = new int[3*N+9][];
357 355

  
358 356
    indices[0] = new int[N+4];
359 357
    indices[1] = new int[N+4];
......
382 380

  
383 381
    for(int i=0; i<N; i++)
384 382
      {
385
      indices[3*i+3] = new int[] { N1+i+1, N1+i, 3*(N+1)+4 };
386
      indices[3*i+4] = new int[] { N2+i+1, N2+i, 3*(N+1)+4 };
387
      indices[3*i+5] = new int[] { N3+i+1, N3+i, 3*(N+1)+4 };
383
      indices[3*i+3] = new int[] { N1+i+1, N1+i, 3*N+7 };
384
      indices[3*i+4] = new int[] { N2+i+1, N2+i, 3*N+7 };
385
      indices[3*i+5] = new int[] { N3+i+1, N3+i, 3*N+7 };
388 386
      }
389 387

  
388
    indices[3*N+3] = new int[] { 2    , 4+  N, 3*N+7 };
389
    indices[3*N+4] = new int[] { 5  +N, 2    , 3*N+7 };
390
    indices[3*N+5] = new int[] { 5+2*N, 3    , 3*N+7 };
391
    indices[3*N+6] = new int[] { 3    , 6+2*N, 3*N+7 };
392
    indices[3*N+7] = new int[] { 1    , 6+3*N, 3*N+7 };
393
    indices[3*N+8] = new int[] { 4    , 1    , 3*N+7 };
394

  
390 395
    return indices;
391 396
    }
392 397

  
......
483 488
      float h1 = isInIconMode() ? 0.0001f : 0.03f;
484 489
      float h2 = isInIconMode() ? 0.0001f : 0.01f;
485 490
      float[][] bands = { {h1,35,0.2f,0.4f,5,2,1}, {h2,35,0.2f,0.4f,2,0,0} };
486
      int num = 3*N+3;
491
      int num = 3*N+9;
487 492
      int[] indices = new int[num];
488 493
      for(int i=3; i<num; i++) indices[i] = 1;
489 494
      float S = 1-SQ2/2 - C;
......
574 579
    }
575 580

  
576 581
///////////////////////////////////////////////////////////////////////////////////////////////////
582
// ditto, manually provide the sticker coordinates.
577 583

  
578 584
  @Override
579 585
  public void adjustStickerCoords()
580 586
    {
581
    float L = 0.02f;
582
    float Z = 0.06422593f - 0.25f*L;
583
    float X = 0.5f - L;
584

  
585
    float K = 1.45f;
586
    float A = K*0.50f;
587
    float B = K*0.25f;
588
    float C = K*0.43301257f;
589

  
590
    float D = 0.3580885f;
591
    float E = 0.12022744f;
592
    float F = 0.32227963f - 0.015f;
593
    float G = 0.14090173f + 0.01f;
587
    float A = 0.38f;
588
    float B = 0.24f;
594 589

  
595 590
    mStickerCoords = new float[][]
596 591
          {
597
            { -D, E, 0.0f, -0.5f, D, E, F, G, -F, G },
598
            { -C, B, C, B, 0.0f, -A },
599
            { -X, Z, X, Z }
592
            { A,-0.5f, A, A, -0.5f, A, -0.5f, B, B, -0.5f },
593
            { 0.5f, 0.0f, 0.0f, 0.5f, -0.5f, 0.0f, 0.0f, -0.5f },
594
            { 0.5f, -0.5f, -0.5f, 0.5f }
600 595
          };
601 596
    }
602 597

  
......
604 599

  
605 600
  public float[][] getStickerAngles()
606 601
    {
607
    float D1 = (float)(Math.PI/3);
608
    float D2 = (float)(Math.PI/6);
609

  
610
    return new float[][] { { 0,0,0,-D1,0 },{-D2,-D2,-D2,-D2},{D2,D2} };
602
    float D = (float)(Math.PI/4);
603
    return new float[][] { { 0,0,0,-D,0 },{-D,-D,-D,-D},{D,D} };
611 604
    }
612 605

  
613 606
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff