Project

General

Profile

« Previous | Next » 

Revision 5e254115

Added by Leszek Koltunski over 2 years ago

auto-compute the bandaged status from dimension of the CENTERS. Make 'computeBitmapFromRow' generic for bandageed and not bandaged objects.

View differences:

src/main/java/org/distorted/objects/TwistyObject.java
116 116
  private final DistortedTexture mTexture;
117 117
  private final float mInitScreenRatio;
118 118
  private final int mSolvedFunctionIndex;
119
  private final boolean mIsBandaged;
119 120
  private float mObjectScreenRatio;
120 121
  private int[][] mSolvedQuats;
121 122
  private int[][] mQuatMult;
......
163 164
    NUM_TEXTURES = getNumStickerTypes(mNumLayers)*NUM_FACES;
164 165
    NUM_AXIS = mAxis.length;
165 166

  
167
    boolean bandaged=false;
168

  
169
    for(int c=0; c<NUM_CUBITS; c++)
170
      {
171
      if( mOrigPos[c].length>3 )
172
        {
173
        bandaged=true;
174
        break;
175
        }
176
      }
177

  
178
    mIsBandaged = bandaged;
179

  
166 180
    mQuatDebug = new int[NUM_CUBITS];
167 181

  
168 182
    if( mObjectScreenRatio>MAX_SIZE_CHANGE) mObjectScreenRatio = MAX_SIZE_CHANGE;
......
655 669
    }
656 670

  
657 671
///////////////////////////////////////////////////////////////////////////////////////////////////
658
// normal, not bandaged, object.
659 672

  
660 673
  int computeBitmapFromRow(int rowBitmap, int axis)
661 674
    {
675
    if( mIsBandaged )
676
      {
677
      int bitmap, initBitmap=0;
678

  
679
      while( initBitmap!=rowBitmap )
680
        {
681
        initBitmap = rowBitmap;
682

  
683
        for(int cubit=0; cubit<NUM_CUBITS; cubit++)
684
          {
685
          bitmap = CUBITS[cubit].mRotationRow[axis];
686
          if( (rowBitmap & bitmap) != 0 ) rowBitmap |= bitmap;
687
          }
688
        }
689
      }
690

  
662 691
    return rowBitmap;
663 692
    }
664 693

  

Also available in: Unified diff