Project

General

Profile

« Previous | Next » 

Revision 8f53e513

Added by Leszek Koltunski almost 4 years ago

Progress with the Dino.

View differences:

src/main/java/org/distorted/objects/RubikObject.java
58 58
  private static final float MAX_SIZE_CHANGE = 1.3f;
59 59
  private static final float MIN_SIZE_CHANGE = 0.8f;
60 60

  
61
  private static boolean mCreateFromDMesh = true;
61
  private static boolean mCreateFromDMesh = false;
62 62

  
63 63
  private static final Static3D CENTER = new Static3D(0,0,0);
64 64
  static final int INTERIOR_COLOR = 0xff000000;
......
68 68
  final Static3D[] ROTATION_AXIS;
69 69
  final Static4D[] QUATS;
70 70
  final int NUM_FACES;
71
  final int NUM_CUBIT_FACES;
71 72

  
72 73
  private static float mInitScreenRatio,mObjectScreenRatio;
73 74

  
......
116 117
    mObjectScreenRatio = getScreenRatio();
117 118
    mInitScreenRatio = mObjectScreenRatio;
118 119
    NUM_FACES = getNumFaces();
120
    NUM_CUBIT_FACES = getNumCubitFaces();
119 121

  
120 122
    mSize = size;
121 123
    computeStartAndStep(mOrigPos);
......
494 496

  
495 497
    for(int cubit=0; cubit<NUM_CUBITS; cubit++)
496 498
      {
497
      final Static4D[] maps = new Static4D[NUM_FACES];
499
      final Static4D[] maps = new Static4D[NUM_CUBIT_FACES];
498 500

  
499 501
      if( 2*ROTATION_AXIS.length == NUM_FACES )  // i.e. there are faces on both ends of the axis (cube)
500 502
        {
501
        for(int i=0; i<NUM_FACES; i++)
503
        for(int i=0; i<NUM_CUBIT_FACES; i++)
502 504
          {
503 505
          belongs = isOnFace(cubit, i/2, i%2==0 ? mSize-1:0 );
504 506
          maps[i] = new Static4D( (belongs?i:NUM_FACES)*ratio, 0.0f, ratio, 1.0f);
......
506 508
        }
507 509
      else if( ROTATION_AXIS.length == NUM_FACES )  // just a single face on the right end of an axis (pyraminx)
508 510
        {
509
        for(int i=0; i<NUM_FACES; i++)
511
        for(int i=0; i<NUM_CUBIT_FACES; i++)
510 512
          {
511 513
          belongs = isOnFace(cubit, i, 0 );
512 514
          maps[i] = new Static4D( (belongs?i:NUM_FACES)*ratio, 0.0f, ratio, 1.0f);
513 515
          }
514 516
        }
517
      else if( 3*ROTATION_AXIS.length == 2*NUM_FACES ) // Dino  TODO
518
        {
519
        for(int i=0; i<NUM_CUBIT_FACES; i++)
520
          {
521
          belongs = true;//isOnFace(cubit, i, 0 );
522
          maps[i] = new Static4D( (belongs?i:NUM_FACES)*ratio, 0.0f, ratio, 1.0f);
523
          }
524
        }
515 525

  
516
      mMesh.setTextureMap(maps,NUM_FACES*cubit);
526
      mMesh.setTextureMap(maps,NUM_CUBIT_FACES*cubit);
517 527
      }
518 528
    }
519 529

  
......
522 532
  public void setTextureMap(int cubit, int face, int newColor)
523 533
    {
524 534
    final float ratio = 1.0f/(NUM_FACES+1);
525
    final Static4D[] maps = new Static4D[NUM_FACES];
535
    final Static4D[] maps = new Static4D[NUM_CUBIT_FACES];
526 536

  
527 537
    maps[face] = new Static4D( newColor*ratio, 0.0f, ratio, 1.0f);
528
    mMesh.setTextureMap(maps,NUM_FACES*cubit);
538
    mMesh.setTextureMap(maps,NUM_CUBIT_FACES*cubit);
529 539
    }
530 540

  
531 541
///////////////////////////////////////////////////////////////////////////////////////////////////
......
700 710
  abstract Static3D[] getCubitPositions(int size);
701 711
  abstract Static4D[] getQuats();
702 712
  abstract int getNumFaces();
713
  abstract int getNumCubitFaces();
703 714
  abstract MeshBase createCubitMesh(int cubit);
704 715
  abstract void createFaceTexture(Canvas canvas, Paint paint, int face, int left, int top, int side);
705 716
  public abstract Static3D[] getRotationAxis();

Also available in: Unified diff