Project

General

Profile

« Previous | Next » 

Revision 3ee1d662

Added by Leszek Koltunski over 2 years ago

Split ObjectShape into ObjectShape and ObjectFaceShape

View differences:

src/main/java/org/distorted/objectlib/objects/TwistyDiamond.java
27 27
import org.distorted.library.type.Static3D;
28 28
import org.distorted.library.type.Static4D;
29 29

  
30
import org.distorted.objectlib.helpers.ObjectFaceShape;
30 31
import org.distorted.objectlib.touchcontrol.TouchControlOctahedron;
31 32
import org.distorted.objectlib.main.ObjectControl;
32 33
import org.distorted.objectlib.main.ObjectType;
......
372 373

  
373 374
  public ObjectShape getObjectShape(int variant)
374 375
    {
375
    int numL = getNumLayers()[0];
376
    int N = numL>3 ? 5:6;
377
    int E = numL>2 ? (numL>3 ? 0:1):2;
378

  
379 376
    if( variant==0 )
380 377
      {
381 378
      float[][] vertices = new float[][]
......
400 397
             {5,3,2}
401 398
          };
402 399

  
400
      return new ObjectShape(vertices, vert_indices, getNumCubitFaces(), 1);
401
      }
402
    else
403
      {
404
      float[][] vertices  = new float[][] { {-0.5f, SQ2/4, 0.0f}, { 0.5f, SQ2/4, 0.0f}, { 0.0f,-SQ2/4, 0.5f}, { 0.0f,-SQ2/4,-0.5f} };
405
      int[][] vert_indices= new int[][]  { {2,1,0}, {2,3,1}, {3,2,0}, {3,0,1} };
406
      return new ObjectShape(vertices,vert_indices, getNumCubitFaces(), 1);
407
      }
408
    }
409

  
410
///////////////////////////////////////////////////////////////////////////////////////////////////
411

  
412
  public ObjectFaceShape getObjectFaceShape(int variant)
413
    {
414
    int numL = getNumLayers()[0];
415
    int N = numL>3 ? 5:6;
416
    int E = numL>2 ? (numL>3 ? 0:1):2;
417

  
418
    if( variant==0 )
419
      {
403 420
      float[][] bands     = new float[][] { {0.05f,35,0.5f,0.8f,N,E,E} };
404 421
      int[] bandIndices   = new int[] { 0,0,0,0,0,0,0,0 };
405 422
      float[][] corners   = new float[][] { {0.04f,0.20f} };
406 423
      int[] cornerIndices = new int[] { 0,0,0,0,0,0 };
407 424
      float[][] centers   = new float[][] { {0.0f, 0.0f, 0.0f} };
408 425
      int[] centerIndices = new int[] { 0,0,0,0,0,0 };
409
      return new ObjectShape(vertices,vert_indices,bands,bandIndices,corners,cornerIndices,centers,centerIndices,getNumCubitFaces(), null, 1);
426
      return new ObjectFaceShape(bands,bandIndices,corners,cornerIndices,centers,centerIndices,null);
410 427
      }
411 428
    else
412 429
      {
413
      float[][] vertices  = new float[][] { {-0.5f, SQ2/4, 0.0f}, { 0.5f, SQ2/4, 0.0f}, { 0.0f,-SQ2/4, 0.5f}, { 0.0f,-SQ2/4,-0.5f} };
414
      int[][] vert_indices= new int[][]  { {2,1,0}, {2,3,1}, {3,2,0}, {3,0,1} };
415 430
      float[][] bands     = new float[][] { {0.05f,35,0.5f,0.8f,N,E,E} };
416 431
      int[] bandIndices   = new int[] { 0,0,0,0 };
417 432
      float[][] corners   = new float[][] { {0.08f,0.15f} };
418 433
      int[] cornerIndices = new int[] { 0,0,0,0 };
419 434
      float[][] centers   = new float[][] { {0.0f, 0.0f, 0.0f} };
420 435
      int[] centerIndices = new int[] { 0,0,0,0 };
421
      return new ObjectShape(vertices,vert_indices,bands,bandIndices,corners,cornerIndices,centers,centerIndices,getNumCubitFaces(), null, 1);
436
      return new ObjectFaceShape(bands,bandIndices,corners,cornerIndices,centers,centerIndices,null);
422 437
      }
423 438
    }
424 439

  

Also available in: Unified diff