Project

General

Profile

« Previous | Next » 

Revision c75ab933

Added by Leszek Koltunski over 3 years ago

COnvert the last object, the Rex cube, to the new cubit creation scheme. Provide the new Rex mesh.

View differences:

src/main/java/org/distorted/objects/TwistyRex.java
24 24
import org.distorted.helpers.FactoryCubit;
25 25
import org.distorted.helpers.ObjectSticker;
26 26
import org.distorted.library.effect.MatrixEffectQuaternion;
27
import org.distorted.library.effect.VertexEffect;
28
import org.distorted.library.effect.VertexEffectMove;
29
import org.distorted.library.effect.VertexEffectRotate;
30
import org.distorted.library.effect.VertexEffectScale;
31 27
import org.distorted.library.main.DistortedEffects;
32 28
import org.distorted.library.main.DistortedTexture;
33 29
import org.distorted.library.mesh.MeshBase;
34
import org.distorted.library.mesh.MeshJoined;
35
import org.distorted.library.mesh.MeshPolygon;
36 30
import org.distorted.library.mesh.MeshSquare;
37
import org.distorted.library.type.Static1D;
38 31
import org.distorted.library.type.Static3D;
39 32
import org.distorted.library.type.Static4D;
40 33
import org.distorted.main.R;
......
135 128

  
136 129
  private static MeshBase mCornerMesh, mFaceMesh, mEdgeMesh;
137 130

  
138
  private static final int NUM_STICKERS = 3;
139 131
  private static final ObjectSticker[] mStickers;
140 132

  
133
  private static final float[][] STICKERS = new float[][]
134
          {
135
             { -0.5f, 0.1428f, -0.1428f, 0.5f, 0.32f, -0.32f },
136
             { -0.5f, 0.0f, 0.0f, -0.5f, 0.5f, 0.0f, 0.0f, 0.5f },
137
             { -0.5f, 0.1f, 0.5f, 0.1f, 0.0f, -0.2f  }
138
          };
139
  private static final int NUM_STICKERS = STICKERS.length;
140

  
141 141
  static
142 142
    {
143 143
    mStickers = new ObjectSticker[NUM_STICKERS];
144 144

  
145
    final float A = REX_D*SQ2;
146
    final float B = (1-REX_D)*SQ2/2;
147
    final float C = 1.0f;
148
    final float D = 0.5f-REX_D;
149
    final float E = (float)(Math.PI/15);
150 145
    final float F = (float)(Math.PI/20);
151 146
    final float R1= 0.02f;
152
    final float R2= 0.04f;
147
    final float R2= 0.09f;
153 148
    final float R3= 0.06f;
154
    final float[][] coords = { {A/2,-B/3,-A/2,-B/3,0,2*B/3},{-REX_D,0,0,-REX_D,+REX_D,0,0,+REX_D},{-C/2,D/3,C/2,D/3,0,-2*D/3} };
155
    final float[][] angles = { { -E/2,E,E },null,{ F/10,-F,-F } };
149
    final float[][] angles = { { -F/2,F,F },null,{ F/10,-F,-F } };
156 150
    final float[][] radii  = { {R1,R1,R1},{R2,R2,R2,R2},{0,0,R3} };
157
    final float[] strokes = { 0.05f, 0.035f, 0.045f };
151
    final float[] strokes = { 0.06f, 0.07f, 0.04f };
158 152

  
159 153
    for(int s=0; s<NUM_STICKERS; s++)
160 154
      {
161
      mStickers[s] = new ObjectSticker(coords[s],angles[s],radii[s],strokes[s]);
155
      mStickers[s] = new ObjectSticker(STICKERS[s],angles[s],radii[s],strokes[s]);
162 156
      }
163 157
    }
164 158

  
......
209 203

  
210 204
  float[][] getCuts(int numLayers)
211 205
    {
212
    float[] cut = new float[] {-SQ3*0.15f,+SQ3*0.15f}; // bit less than 1/6 of the length of the main diagonal
206
    float C = SQ3*0.15f; // bit less than 1/6 of the length of the main diagonal
207
    float[] cut = new float[] {-C,+C};
213 208
    return new float[][] { cut,cut,cut,cut };
214 209
    }
215 210

  
......
224 219

  
225 220
  float[][] getCubitPositions(int numLayers)
226 221
    {
227
    final float DIST = 0.50f;
222
    final float DIST1= 0.50f;
228 223
    final float DIST2= (1+2*REX_D)/6;
229

  
230
    final float[][] CENTERS = new float[42][];
231

  
232
    CENTERS[ 0] = new float[] { +DIST , +DIST2, +DIST2};
233
    CENTERS[ 1] = new float[] { +DIST , +DIST2, -DIST2};
234
    CENTERS[ 2] = new float[] { +DIST , -DIST2, -DIST2};
235
    CENTERS[ 3] = new float[] { +DIST , -DIST2, +DIST2};
236
    CENTERS[ 4] = new float[] { -DIST , +DIST2, +DIST2};
237
    CENTERS[ 5] = new float[] { -DIST , +DIST2, -DIST2};
238
    CENTERS[ 6] = new float[] { -DIST , -DIST2, -DIST2};
239
    CENTERS[ 7] = new float[] { -DIST , -DIST2, +DIST2};
240
    CENTERS[ 8] = new float[] { +DIST2, +DIST , +DIST2};
241
    CENTERS[ 9] = new float[] { +DIST2, +DIST , -DIST2};
242
    CENTERS[10] = new float[] { -DIST2, +DIST , -DIST2};
243
    CENTERS[11] = new float[] { -DIST2, +DIST , +DIST2};
244
    CENTERS[12] = new float[] { +DIST2, -DIST , +DIST2};
245
    CENTERS[13] = new float[] { +DIST2, -DIST , -DIST2};
246
    CENTERS[14] = new float[] { -DIST2, -DIST , -DIST2};
247
    CENTERS[15] = new float[] { -DIST2, -DIST , +DIST2};
248
    CENTERS[16] = new float[] { +DIST2, +DIST2, +DIST };
249
    CENTERS[17] = new float[] { +DIST2, -DIST2, +DIST };
250
    CENTERS[18] = new float[] { -DIST2, -DIST2, +DIST };
251
    CENTERS[19] = new float[] { -DIST2, +DIST2, +DIST };
252
    CENTERS[20] = new float[] { +DIST2, +DIST2, -DIST };
253
    CENTERS[21] = new float[] { +DIST2, -DIST2, -DIST };
254
    CENTERS[22] = new float[] { -DIST2, -DIST2, -DIST };
255
    CENTERS[23] = new float[] { -DIST2, +DIST2, -DIST };
256

  
257
    CENTERS[24] = new float[] { +DIST , +0.00f, +0.00f};
258
    CENTERS[25] = new float[] { -DIST , +0.00f, +0.00f};
259
    CENTERS[26] = new float[] { +0.00f, +DIST , +0.00f};
260
    CENTERS[27] = new float[] { +0.00f, -DIST , +0.00f};
261
    CENTERS[28] = new float[] { +0.00f, +0.00f, +DIST };
262
    CENTERS[29] = new float[] { +0.00f, +0.00f, -DIST };
263

  
264
    CENTERS[30] = new float[] { +0.00f, +DIST , +DIST };
265
    CENTERS[31] = new float[] { +DIST , +0.00f, +DIST };
266
    CENTERS[32] = new float[] { +0.00f, -DIST , +DIST };
267
    CENTERS[33] = new float[] { -DIST , +0.00f, +DIST };
268
    CENTERS[34] = new float[] { +DIST , +DIST , +0.00f};
269
    CENTERS[35] = new float[] { +DIST , -DIST , +0.00f};
270
    CENTERS[36] = new float[] { -DIST , -DIST , +0.00f};
271
    CENTERS[37] = new float[] { -DIST , +DIST , +0.00f};
272
    CENTERS[38] = new float[] { +0.00f, +DIST , -DIST };
273
    CENTERS[39] = new float[] { +DIST , +0.00f, -DIST };
274
    CENTERS[40] = new float[] { +0.00f, -DIST , -DIST };
275
    CENTERS[41] = new float[] { -DIST , +0.00f, -DIST };
224
    final float DIST3= 0.51f;
225

  
226
    final float[][] CENTERS = new float[24+6+12][];
227

  
228
    CENTERS[ 0] = new float[] { +DIST3, +DIST2, +DIST2};
229
    CENTERS[ 1] = new float[] { +DIST3, +DIST2, -DIST2};
230
    CENTERS[ 2] = new float[] { +DIST3, -DIST2, -DIST2};
231
    CENTERS[ 3] = new float[] { +DIST3, -DIST2, +DIST2};
232
    CENTERS[ 4] = new float[] { -DIST3, +DIST2, +DIST2};
233
    CENTERS[ 5] = new float[] { -DIST3, +DIST2, -DIST2};
234
    CENTERS[ 6] = new float[] { -DIST3, -DIST2, -DIST2};
235
    CENTERS[ 7] = new float[] { -DIST3, -DIST2, +DIST2};
236
    CENTERS[ 8] = new float[] { +DIST2, +DIST3, +DIST2};
237
    CENTERS[ 9] = new float[] { +DIST2, +DIST3, -DIST2};
238
    CENTERS[10] = new float[] { -DIST2, +DIST3, -DIST2};
239
    CENTERS[11] = new float[] { -DIST2, +DIST3, +DIST2};
240
    CENTERS[12] = new float[] { +DIST2, -DIST3, +DIST2};
241
    CENTERS[13] = new float[] { +DIST2, -DIST3, -DIST2};
242
    CENTERS[14] = new float[] { -DIST2, -DIST3, -DIST2};
243
    CENTERS[15] = new float[] { -DIST2, -DIST3, +DIST2};
244
    CENTERS[16] = new float[] { +DIST2, +DIST2, +DIST3};
245
    CENTERS[17] = new float[] { +DIST2, -DIST2, +DIST3};
246
    CENTERS[18] = new float[] { -DIST2, -DIST2, +DIST3};
247
    CENTERS[19] = new float[] { -DIST2, +DIST2, +DIST3};
248
    CENTERS[20] = new float[] { +DIST2, +DIST2, -DIST3};
249
    CENTERS[21] = new float[] { +DIST2, -DIST2, -DIST3};
250
    CENTERS[22] = new float[] { -DIST2, -DIST2, -DIST3};
251
    CENTERS[23] = new float[] { -DIST2, +DIST2, -DIST3};
252

  
253
    CENTERS[24] = new float[] { +DIST3, +0.00f, +0.00f};
254
    CENTERS[25] = new float[] { -DIST3, +0.00f, +0.00f};
255
    CENTERS[26] = new float[] { +0.00f, +DIST3, +0.00f};
256
    CENTERS[27] = new float[] { +0.00f, -DIST3, +0.00f};
257
    CENTERS[28] = new float[] { +0.00f, +0.00f, +DIST3};
258
    CENTERS[29] = new float[] { +0.00f, +0.00f, -DIST3};
259

  
260
    CENTERS[30] = new float[] { +0.00f, +DIST1, +DIST1};
261
    CENTERS[31] = new float[] { +DIST1, +0.00f, +DIST1};
262
    CENTERS[32] = new float[] { +0.00f, -DIST1, +DIST1};
263
    CENTERS[33] = new float[] { -DIST1, +0.00f, +DIST1};
264
    CENTERS[34] = new float[] { +DIST1, +DIST1, +0.00f};
265
    CENTERS[35] = new float[] { +DIST1, -DIST1, +0.00f};
266
    CENTERS[36] = new float[] { -DIST1, -DIST1, +0.00f};
267
    CENTERS[37] = new float[] { -DIST1, +DIST1, +0.00f};
268
    CENTERS[38] = new float[] { +0.00f, +DIST1, -DIST1};
269
    CENTERS[39] = new float[] { +DIST1, +0.00f, -DIST1};
270
    CENTERS[40] = new float[] { +0.00f, -DIST1, -DIST1};
271
    CENTERS[41] = new float[] { -DIST1, +0.00f, -DIST1};
276 272

  
277 273
    return CENTERS;
278 274
    }
......
332 328
    return QUATS[0];
333 329
    }
334 330

  
335
///////////////////////////////////////////////////////////////////////////////////////////////////
336

  
337
  MeshBase createFacesRexCorner()
338
    {
339
    MeshBase[] meshes = new MeshBase[2];
340

  
341
    float F = REX_D*SQ2;
342
    float G = (1-REX_D)*SQ2/2;
343
    float H = 0.1f;
344
    float J = +2*G/3 - H*G;
345

  
346
    float[] vertices = { -F/2, -G/3, +F/2, -G/3, H*F/2, J, -H*F/2, J};
347

  
348
    FactoryCubit factory = FactoryCubit.getInstance();
349
    float[] bands0 = factory.computeBands(+0.016f,10,G/3,0.5f,5);
350
    float[] bands1 = factory.computeBands(-0.230f,45,G/3,0.0f,2);
351

  
352
    meshes[0] = new MeshPolygon(vertices,bands0,1,1);
353
    meshes[0].setEffectAssociation(0,1,0);
354
    meshes[1] = new MeshPolygon(vertices,bands1,0,0);
355
    meshes[1].setEffectAssociation(0,2,0);
356

  
357
    return new MeshJoined(meshes);
358
    }
359

  
360
///////////////////////////////////////////////////////////////////////////////////////////////////
361

  
362
  MeshBase createFacesRexFace()
363
    {
364
    MeshBase[] meshes = new MeshBase[2];
365

  
366
    float[] vertices = { -REX_D,0.0f, 0.0f, -REX_D, +REX_D, 0.0f, 0.0f, +REX_D};
367

  
368
    FactoryCubit factory = FactoryCubit.getInstance();
369
    float[] bands0 = factory.computeBands(0.016f,10,REX_D/2,0.5f,5);
370
    float[] bands1 = factory.computeBands(0.000f,45,REX_D/2,0.0f,2);
371

  
372
    meshes[0] = new MeshPolygon(vertices,bands0,0,0);
373
    meshes[0].setEffectAssociation(0,1,0);
374
    meshes[1] = new MeshPolygon(vertices,bands1,0,0);
375
    meshes[1].setEffectAssociation(0,2,0);
376

  
377
    return new MeshJoined(meshes);
378
    }
379

  
380
///////////////////////////////////////////////////////////////////////////////////////////////////
381

  
382
  MeshBase createFacesRexEdge()
383
    {
384
    MeshBase[] meshes = new MeshPolygon[6];
385
    FactoryCubit factory = FactoryCubit.getInstance();
386

  
387
    float E = 0.5f - REX_D;
388
    float F = 0.5f;
389
    float[] vertices0 = { -F,E/3, 0,-2*E/3, +F,E/3 };
390
    float[] bands0 = factory.computeBands(0.03f,27,F/3,0.8f,5);
391

  
392
    meshes[0] = new MeshPolygon(vertices0, bands0, 2, 3);
393
    meshes[0].setEffectAssociation(0,1,0);
394
    meshes[1] = meshes[0].copy(true);
395
    meshes[1].setEffectAssociation(0,2,0);
396

  
397
    float G = (float)Math.sqrt(E*E+F*F);
398
    float[] vertices1 = { -2*G/3, -E/3, G/3, -E/3, G/3, 2*E/3 };
399
    float[] bands1 = factory.computeBands(0.00f,45,G/3,0.2f,3);
400

  
401
    meshes[2] = new MeshPolygon(vertices1, bands1, 1, 2);
402
    meshes[2].setEffectAssociation(0,4,0);
403
    meshes[3] = meshes[2].copy(true);
404
    meshes[3].setEffectAssociation(0,8,0);
405
    meshes[4] = meshes[2].copy(true);
406
    meshes[4].setEffectAssociation(0,16,0);
407
    meshes[5] = meshes[2].copy(true);
408
    meshes[5].setEffectAssociation(0,32,0);
409

  
410
    return new MeshJoined(meshes);
411
    }
412

  
413
///////////////////////////////////////////////////////////////////////////////////////////////////
414

  
415
  private VertexEffect[] createVertexEffectsRexEdge()
416
    {
417
    float E = 0.5f - REX_D;
418
    float F = 0.5f;
419
    float G = (float)Math.sqrt(E*E+F*F);
420
    float A = (float)((180/Math.PI)*Math.asin(E/G));
421

  
422
    Static3D move1 = new Static3D(    0.0f, -E/3, 0.0f);
423
    Static3D move2 = new Static3D(2*G/3 -F, +E/3, 0.0f);
424

  
425
    Static3D center0= new Static3D(0.0f, 0.0f, 0.0f);
426
    Static3D center1= new Static3D(  -F, 0.0f, 0.0f);
427
    Static3D center2= new Static3D(  +F, 0.0f, 0.0f);
428
    Static3D axisX  = new Static3D(1.0f, 0.0f, 0.0f);
429
    Static3D axisY  = new Static3D(0.0f, 1.0f, 0.0f);
430
    Static3D axisZ  = new Static3D(0.0f, 0.0f, 1.0f);
431

  
432
    Static1D angle180 = new Static1D(180);
433
    Static1D angle90  = new Static1D( 90);
434
    Static1D angle270 = new Static1D(270);
435
    Static1D angle1   = new Static1D(+A);
436
    Static1D angle2   = new Static1D(-A);
437

  
438
    VertexEffect[] effect = new VertexEffect[12];
439

  
440
    effect[0] = new VertexEffectMove(move1);
441
    effect[1] = new VertexEffectMove(move2);
442
    effect[2] = new VertexEffectRotate(  angle90, axisX, center0 );
443
    effect[3] = new VertexEffectRotate( angle270, axisX, center0 );
444
    effect[4] = new VertexEffectRotate( angle180, axisX, center0 );
445
    effect[5] = new VertexEffectRotate( angle180, axisY, center0 );
446
    effect[6] = new VertexEffectScale( new Static3D(-1, 1, 1) );
447
    effect[7] = new VertexEffectScale ( new Static3D( 1,-1, 1) );
448
    effect[8] = new VertexEffectRotate(   angle1, axisY, center1);
449
    effect[9] = new VertexEffectRotate(   angle2, axisY, center2);
450
    effect[10]= new VertexEffectRotate(   angle2, axisZ, center1);
451
    effect[11]= new VertexEffectRotate(   angle1, axisZ, center2);
452

  
453
    effect[0].setMeshAssociation( 3,-1);  // meshes 0 & 1
454
    effect[1].setMeshAssociation(60,-1);  // meshes 2,3,4,5
455
    effect[2].setMeshAssociation( 2,-1);  // meshes 1
456
    effect[3].setMeshAssociation(12,-1);  // meshes 2,3
457
    effect[4].setMeshAssociation(48,-1);  // meshes 4,5
458
    effect[5].setMeshAssociation(32,-1);  // mesh 5
459
    effect[6].setMeshAssociation( 8,-1);  // apply to mesh 3
460
    effect[7].setMeshAssociation( 2,-1);  // apply to mesh 1
461
    effect[8].setMeshAssociation(16,-1);  // apply to mesh 4
462
    effect[9].setMeshAssociation(32,-1);  // apply to mesh 5
463
    effect[10].setMeshAssociation(4,-1);  // apply to mesh 2
464
    effect[11].setMeshAssociation(8,-1);  // apply to mesh 3
465

  
466
    return effect;
467
    }
468

  
469
///////////////////////////////////////////////////////////////////////////////////////////////////
470

  
471
  private VertexEffect[] createVertexEffectsRexCorner()
472
    {
473
    Static3D center= new Static3D(0.0f, 0.0f, 0.0f);
474
    Static3D axisZ = new Static3D(0.0f, 0.0f, 1.0f);
475
    Static1D angle = new Static1D(225);
476

  
477
    VertexEffect[] effect = new VertexEffect[1];
478
    effect[0] = new VertexEffectRotate(angle, axisZ, center);
479

  
480
    return effect;
481
    }
482

  
483
///////////////////////////////////////////////////////////////////////////////////////////////////
484

  
485
  private MeshBase createRexCornerMesh()
486
    {
487
    MeshBase mesh = createFacesRexCorner();
488
    VertexEffect[] effects = createVertexEffectsRexCorner();
489
    for( VertexEffect effect : effects ) mesh.apply(effect);
490

  
491
    final float G = (1-REX_D)/3;
492
    Static3D center = new Static3D(0.0f,0.0f,-G*SQ2/2);
493
    Static3D[] vertices = new Static3D[1];
494
    vertices[0] = new Static3D(+G,-G,+0.0f);
495
    FactoryCubit.getInstance().roundCorners(mesh,center,vertices,0.10f,0.10f);
496

  
497
    mesh.mergeEffComponents();
498
    mesh.addEmptyTexComponent();
499
    mesh.addEmptyTexComponent();
500
    mesh.addEmptyTexComponent();
501
    mesh.addEmptyTexComponent();
502

  
503
    return mesh;
504
    }
505

  
506
///////////////////////////////////////////////////////////////////////////////////////////////////
507

  
508
  private MeshBase createRexFaceMesh()
509
    {
510
    MeshBase mesh = createFacesRexFace();
511

  
512
    mesh.mergeEffComponents();
513
    mesh.addEmptyTexComponent();
514
    mesh.addEmptyTexComponent();
515
    mesh.addEmptyTexComponent();
516
    mesh.addEmptyTexComponent();
517

  
518
    return mesh;
519
    }
520

  
521
///////////////////////////////////////////////////////////////////////////////////////////////////
522

  
523
  private MeshBase createRexEdgeMesh()
524
    {
525
    MeshBase mesh = createFacesRexEdge();
526
    VertexEffect[] effects = createVertexEffectsRexEdge();
527
    for( VertexEffect effect : effects ) mesh.apply(effect);
528

  
529
    Static3D center = new Static3D(0.0f,-0.5f,-0.5f);
530
    Static3D[] vertices = new Static3D[2];
531
    vertices[0] = new Static3D(+0.5f,+0.0f,+0.0f);
532
    vertices[1] = new Static3D(-0.5f,+0.0f,+0.0f);
533
    FactoryCubit.getInstance().roundCorners(mesh,center,vertices,0.06f,0.10f);
534

  
535
    mesh.mergeEffComponents();
536

  
537
    return mesh;
538
    }
539

  
540 331
///////////////////////////////////////////////////////////////////////////////////////////////////
541 332

  
542 333
  MeshBase createCubitMesh(int cubit, int numLayers)
......
545 336

  
546 337
    if( cubit<24 )
547 338
      {
548
      if( mCornerMesh==null ) mCornerMesh = createRexCornerMesh();
339
      if( mCornerMesh==null )
340
        {
341
        float G = (1-REX_D)*SQ2/2;
342

  
343
        double[][] vertices =
344
           {
345
             {  -0.033333f, 0.23333f, 0.0f },
346
             {  -0.233333f, 0.03333f, 0.0f },
347
             {  +0.216666f,-0.23666f, 0.0f },
348
             {  +0.236666f,-0.21666f, 0.0f }
349
           };
350

  
351
        int[][] vertIndexes =
352
           {
353
             {0,1,2,3},
354
             {3,2,1,0}
355
           };
356

  
357
        float[][] centers= new float[][] { {0.0f,0.0f,-G/3} };
358
        float[][] corners= new float[][] { {0.03f,0.10f} };
359
        int[] indexes= {-1,-1,0,0};
360

  
361
        int[] bandIndexes= new int[] { 0,1 };
362

  
363
        float[][] bands =
364
          {
365
               {+0.016f,10,G/3,0.5f,5,1,1},
366
               {+0.230f,45,G/3,0.0f,2,0,0}
367
          };
368

  
369
        FactoryCubit factory = FactoryCubit.getInstance();
370
        factory.createNewFaceTransform(vertices,vertIndexes);
371
        mCornerMesh = factory.createRoundedSolid(vertices, vertIndexes,
372
                                                 bands, bandIndexes,
373
                                                 corners, indexes,
374
                                                 centers, indexes,
375
                                                 getNumCubitFaces(), null );
376
        }
549 377
      mesh = mCornerMesh.copy(true);
550 378
      }
551 379
    else if( cubit<30 )
552 380
      {
553
      if( mFaceMesh==null ) mFaceMesh = createRexFaceMesh();
381
      if( mFaceMesh==null )
382
        {
383
        double[][] vertices =
384
          {
385
            { -REX_D,   0.0f, 0.0f },
386
            {   0.0f, -REX_D, 0.0f },
387
            { +REX_D,   0.0f, 0.0f },
388
            {   0.0f, +REX_D, 0.0f }
389
          };
390

  
391
        int[][] vertIndexes=
392
          {
393
            {0,1,2,3},
394
            {3,2,1,0}
395
          };
396

  
397
        float[][] bands =
398
          {
399
            {0.025f,10,REX_D/2,0.5f,5,0,0},
400
            {0.000f,45,REX_D/2,0.0f,2,0,0}
401
          };
402

  
403
        int[] indexes= {-1,-1,-1,-1};
404
        int[] bandIndexes= new int[] { 0,1 };
405

  
406
        FactoryCubit factory = FactoryCubit.getInstance();
407
        factory.createNewFaceTransform(vertices,vertIndexes);
408
        mFaceMesh = factory.createRoundedSolid(vertices, vertIndexes,
409
                                               bands, bandIndexes,
410
                                               null, indexes,
411
                                               null, indexes,
412
                                               getNumCubitFaces(), null );
413
        }
554 414
      mesh = mFaceMesh.copy(true);
555 415
      }
556 416
    else
557 417
      {
558
      if( mEdgeMesh==null ) mEdgeMesh = createRexEdgeMesh();
418
      if( mEdgeMesh==null )
419
        {
420
        float E = 0.5f - REX_D;
421
        float F = 0.5f;
422
        float G = (float)Math.sqrt(E*E+F*F);
423

  
424
        double[][] vertices =
425
           {
426
             { -F, 0, 0 },
427
             {  0,-E, 0 },
428
             { +F, 0, 0 },
429
             {  0, 0,-E },
430
           };
431

  
432
        int[][] vertIndexes =
433
           {
434
             {0,1,2},
435
             {0,2,3},
436
             {0,3,1},
437
             {1,3,2}
438
           };
439

  
440
        float[][] centers= new float[][] { {0.0f,-0.5f,-0.5f} };
441
        float[][] corners= new float[][] { {0.06f,0.10f} };
442
        int[] indexes= {0,-1,0,-1};
443

  
444
        int[] bandIndexes= new int[] { 0,0,1,1 };
445

  
446
        float[][] bands =
447
          {
448
               {0.03f,27,F/3,0.8f,5,2,3},
449
               {0.01f,45,G/3,0.2f,3,1,2}
450
          };
451

  
452
        FactoryCubit factory = FactoryCubit.getInstance();
453
        factory.createNewFaceTransform(vertices,vertIndexes);
454
        mEdgeMesh = factory.createRoundedSolid(vertices, vertIndexes,
455
                                               bands, bandIndexes,
456
                                               corners, indexes,
457
                                               centers, indexes,
458
                                               getNumCubitFaces(), null );
459
        }
559 460
      mesh = mEdgeMesh.copy(true);
560 461
      }
561 462

  

Also available in: Unified diff