Project

General

Profile

« Previous | Next » 

Revision f18e8fae

Added by Leszek Koltunski over 3 years ago

Simplify drawing textures.

View differences:

src/main/java/org/distorted/objects/TwistyObject.java
73 73
  private static final Static3D CENTER = new Static3D(0,0,0);
74 74
  static final int INTERIOR_COLOR = 0xff000000;
75 75
  private static final int POST_ROTATION_MILLISEC = 500;
76
  private static final int TEXTURE_HEIGHT = 256;
76
  static final int TEXTURE_HEIGHT = 256;
77 77

  
78 78
  final Static3D[] ROTATION_AXIS;
79 79
  final Static4D[] QUATS;
......
340 340
    }
341 341

  
342 342
///////////////////////////////////////////////////////////////////////////////////////////////////
343
// we cannot use belongsToRotation for deciding if to texture a face. Counterexample: the 'rotated'
344
// tetrahedrons of Pyraminx nearby the edge: they belong to rotation but their face which is rotated
345
// away from the face of the Pyraminx shouldn't be textured.
346 343

  
347
  boolean isOnFace( int cubit, int axis, int row)
344
  void drawRoundedPolygon()
348 345
    {
349
    final float MAX_ERROR = 0.0001f;
350
    float diff = CUBITS[cubit].mRotationRow[axis] - row;
351
    return diff*diff < MAX_ERROR;
346

  
352 347
    }
353 348

  
354 349
///////////////////////////////////////////////////////////////////////////////////////////////////
......
409 404

  
410 405
    for(int i=0; i<NUM_TEXTURES; i++)
411 406
      {
412
      createFaceTexture(canvas, paint, i, i*TEXTURE_HEIGHT, 0, TEXTURE_HEIGHT);
407
      createFaceTexture(canvas, paint, i, i*TEXTURE_HEIGHT);
413 408
      }
414 409

  
415 410
    mTexture.setTexture(bitmap);
......
438 433

  
439 434
///////////////////////////////////////////////////////////////////////////////////////////////////
440 435

  
441
  public void recomputeScaleFactor(int scrWidth, int scrHeight)
436
  public void recomputeScaleFactor(int scrWidth)
442 437
    {
443 438
    mNodeScale.set(scrWidth,NODE_RATIO*scrWidth,scrWidth);
444 439
    }
......
700 695
  abstract int getNumStickerTypes();
701 696
  abstract int getNumCubitFaces();
702 697
  abstract MeshBase createCubitMesh(int cubit);
703
  abstract void createFaceTexture(Canvas canvas, Paint paint, int face, int left, int top, int side);
698
  abstract void createFaceTexture(Canvas canvas, Paint paint, int face, int left);
704 699
  abstract int getFaceColor(int cubit, int cubitface, int size);
705 700
  abstract float returnMultiplier();
706 701
  abstract float[] getRowChances();

Also available in: Unified diff