Project

General

Profile

« Previous | Next » 

Revision 0a48b96c

Added by Leszek Koltunski over 2 years ago

Trajber's Octahedron: progress.

View differences:

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

  
290 290
    private void createMesh()
291 291
      {
292
      int mode            =20;
292
      int mode            =18;
293 293
      int numComponents   = 0;
294 294
      float[][] vertices  = null;
295 295
      int[][] vertIndexes = null;
......
1298 1298
      else if( mode==18 )
1299 1299
        {
1300 1300
        final float CUT = 1.0f/6;
1301
        final float LEN = 3*SQ2/2;
1301
        final float LEN = 1.5f;
1302 1302

  
1303
        final float A = CUT*LEN;
1304
        final float B = A-LEN;
1303
        final float A = SQ2*CUT*LEN;
1304
        final float B =   2*CUT*LEN;
1305 1305

  
1306 1306
        vertices = new float[][]
1307 1307
          {
1308
             {    0,    0,    0},
1309
             {    0,    A,   -A},
1310
             {    0,   -A,   -A},
1311
             {    A,    0,   -A},
1312
             {   -A,    0,   -A},
1313
             {    A,    A, -2*A},
1314
             {    A,   -A, -2*A},
1315
             {   -A,    A, -2*A},
1316
             {   -A,   -A, -2*A},
1317
             {    A,    A,    B},
1318
             {    A,   -A,    B},
1319
             {   -A,    A,    B},
1320
             {   -A,   -A,    B}
1308
             {    0.01f,    0.01f,    0},
1309
             {    A,    A,   -A},
1310
             {    A,   -A,   -A},
1311
             {    B,    0,    0},
1312
             {    0,    0,   -B},
1313
             {  A+B,    A,   -A},
1314
             {  A+B,   -A,   -A},
1315
             {    A,    A, -A-B},
1316
             {    A,   -A, -A-B},
1317

  
1318
             {  LEN      ,    A, SQ2*A-LEN},
1319
             {  LEN      ,   -A, SQ2*A-LEN},
1320
             {  LEN-SQ2*A,    A,      -LEN},
1321
             {  LEN-SQ2*A,   -A,      -LEN}
1321 1322
          };
1322 1323

  
1323 1324
        vertIndexes = new int[][]
......
1337 1338
         bandIndexes   = new int[] { 0,0,0,0,1,1,1,1,1 };
1338 1339
         corners       = new float[][] { {0.03f,0.10f} };
1339 1340
         cornerIndexes = new int[] { 0,-1,-1,-1,-1,0,0,0,0,-1,-1,-1,-1 };
1340
         centers       = new float[][] { {0.0f, 0.0f, -LEN/2} };
1341
         centers       = new float[][] { { LEN/2, 0.0f, -LEN/2} };
1341 1342
         centerIndexes = new int[] { 0,-1,-1,-1,-1,0,0,0,0,-1,-1,-1,-1 };
1342 1343

  
1343 1344
         numComponents = 9;
......
1348 1349
      else if( mode==19 )
1349 1350
        {
1350 1351
        final float CUT = 1.0f/6;
1351
        final float LEN = 3*SQ2/2;
1352
        final float LEN = 1.5f;
1352 1353

  
1353
        final float A = CUT*LEN;
1354
        final float B = A-LEN;
1354
        final float A = SQ2*CUT*LEN;
1355
        final float C = LEN-2*LEN*CUT;
1355 1356

  
1356 1357
        vertices = new float[][]
1357 1358
          {
1358
             {    A-LEN/2,    0,   -A+LEN/2},
1359
             {    A-LEN/2,    A, -2*A+LEN/2},
1360
             {    A-LEN/2,   -A, -2*A+LEN/2},
1361
             {   -B-LEN/2,    0,    B+LEN/2},
1362
             { -B-A-LEN/2,    A,    B+LEN/2},
1363
             { -B-A-LEN/2,   -A,    B+LEN/2},
1364
             {    A-LEN/2,    A,    B+LEN/2},
1365
             {    A-LEN/2,   -A,    B+LEN/2},
1359
             {    -C,    0,   0},
1360
             {  -C+A,    A,  -A},
1361
             {  -C+A,   -A,  -A},
1362
             {     C,    0,   0},
1363
             {   C-A,    A,  -A},
1364
             {   C-A,   -A,  -A},
1365
             {     0,    A,  -C},
1366
             {     0,   -A,  -C},
1366 1367
          };
1367 1368

  
1368 1369
        vertIndexes = new int[][]
......
1379 1380
        bandIndexes  = new int[] { 0,0,1,1,1,1 };
1380 1381
        corners      = new float[][] { {0.02f,0.10f} };
1381 1382
        cornerIndexes= new int[] { 0,0,0,0,0,0,-1,-1 };
1382
        centers      = new float[][] { {-LEN/4, 0, -LEN/4} };
1383
        centers      = new float[][] { { 0, 0, -LEN/2} };
1383 1384
        centerIndexes= new int[] { 0,0,0,0,0,0,-1,-1 };
1384 1385

  
1385 1386
        numComponents = 9;
......
1390 1391
      else if( mode==20 )
1391 1392
        {
1392 1393
        final float CUT = 1.0f/6;
1393
        final float LEN = 3*SQ2/2;
1394
        final float LEN = 1.5f;
1394 1395

  
1395
        final float A = CUT*LEN;
1396
        final float B = A-LEN;
1396
        final float A = SQ2*CUT*LEN;
1397
        final float C = LEN-2*LEN*CUT;
1398
        final float L = C-A;
1397 1399

  
1398 1400
        vertices = new float[][]
1399 1401
          {
1400
             {   A-LEN/3,   A-LEN/3, -2*A+2*LEN/3},
1401
             {-B-A-LEN/3,   A-LEN/3,    B+2*LEN/3},
1402
             {   A-LEN/3,-B-A-LEN/3,    B+2*LEN/3},
1403
             {   A-LEN/3,   A-LEN/3,    B+2*LEN/3},
1402
             { -L, -(SQ2/3)*L,   L/3 },
1403
             {  L, -(SQ2/3)*L,   L/3 },
1404
             {  0,(2*SQ2/3)*L,-2*L/3 },
1405
             {  0, -(SQ2/3)*L,-2*L/3 },
1404 1406
          };
1405 1407

  
1406 1408
        vertIndexes = new int[][]
......
1415 1417
        bandIndexes  = new int[] { 0,1,1,1 };
1416 1418
        corners      = new float[][] { {0.02f,0.10f} };
1417 1419
        cornerIndexes= new int[] { 0,0,0,-1 };
1418
        centers      = new float[][] { {(A-LEN/3)/2 , (A-LEN/3)/2 , (B-LEN/3)/2} };
1420
        centers      = new float[][] { {0, -(SQ2/3)*L,-2*L/3} };
1419 1421
        centerIndexes= new int[] { 0,0,0,-1 };
1420 1422

  
1421 1423
        numComponents = 9;

Also available in: Unified diff