Project

General

Profile

« Previous | Next » 

Revision 3083fab8

Added by Leszek Koltunski about 3 years ago

Cubit creation: properly cener the textures. Add Kilominx edge.

View differences:

src/main/java/org/distorted/examples/meshfile/MeshFileRenderer.java
252 252

  
253 253
    private void createMesh()
254 254
      {
255
      int mode = 0;
255
      int mode = 4;
256 256
      double[][] vertices = null;
257 257
      int[][] vertIndexes = null;
258 258
      float[][] bands     = null;
......
413 413
        cornerIndexes = new int[] { 0,0,0,0,0,0 };
414 414
        }
415 415

  
416
      ///// KILOMINX EDGE ////////////////////////////////////////////////////////////////////////
417

  
418
      else if( mode==4 )
419
        {
420
        double SQ5  = Math.sqrt(5);
421
        double SIN18= (SQ5-1)/4;
422
        double COS18= 0.25*Math.sqrt(10.0+2.0*SQ5);
423
        double H = 1.0;
424
        double L = 2.0;
425
        double X = H*Math.sqrt((5+SQ5)/10);
426
        double Y = H*Math.sqrt((5-SQ5)/10);
427
        double D = H*SIN18/COS18;
428

  
429
        vertices = new double[][]
430
          {
431
              { 0.0,   Y, L/2},
432
              {   X, 0.0, L/2},
433
              { 0.0,  -Y, L/2},
434
              {  -X, 0.0, L/2},
435
              { 0.0,  Y, -L/2 +D},
436
              {   X, 0.0,-L/2   },
437
              { 0.0, -Y, -L/2-D },
438
              {  -X, 0.0,-L/2   }
439
          };
440

  
441
        vertIndexes = new int[][]
442
          {
443
              {3,2,1,0},   // counterclockwise!
444
              {0,1,5,4},
445
              {3,0,4,7},
446
              {2,1,5,6},
447
              {3,2,6,7},
448
              {4,5,6,7}
449
          };
450

  
451
        bands = new float[][]
452
          {
453
             {0.04f,13,(float)(L/3),(float)L/8, 5,2,3},
454
             {0.00f, 0,(float)(L/2),(float)L/4, 5,2,3}
455
          };
456

  
457
        bandIndexes = new int[] { 1,0,0,1,1,1 };
458

  
459
        corners = new float[][]
460
          {
461
              { 0.01f, 0.12f },
462
              { 0.00f, 0.00f }
463
          };
464

  
465
        cornerIndexes = new int[] { 0,1,1,1,0,1,1,1 };
466
        }
467

  
416 468
      FactoryCubit factory = FactoryCubit.getInstance();
417 469
      mMesh = factory.createRoundedSolid(vertices, vertIndexes, bands, bandIndexes, corners, cornerIndexes);
418 470

  

Also available in: Unified diff