Project

General

Profile

« Previous | Next » 

Revision 332e1fb0

Added by Leszek Koltunski over 2 years ago

Make the meshAssociation of the Rotate effect independent of the global MAX_SIZE of any implemented object.
Now only the NUM_OF_AXIS*MAX_NUM_OF_LAYERS of any individual object needs to be <=32 - before the second factor was global, which - because of the recent introduction of the Cube6 - screwed the Gigaminx (!) where NUM_OF_AXIS=6 and GLOBAL_MAX_NUM_LAYERS = 6 now, so 6*6>32 !

View differences:

src/main/java/org/distorted/objectlib/main/Cubit.java
155 155
    for(int axis=0; axis<mNumAxis; axis++)
156 156
      {
157 157
      result += (mRotationRow[axis]<<accumulativeShift);
158
      accumulativeShift += ObjectType.MAX_OBJECT_SIZE;
158
      accumulativeShift += mParent.SHIFT;
159 159
      }
160 160

  
161 161
    return result;
src/main/java/org/distorted/objectlib/main/TwistyObject.java
100 100
  int NUM_CUBITS;
101 101
  int NUM_AXIS;
102 102
  int NUM_QUATS;
103
  int SHIFT;
103 104

  
104 105
  private int mNumCubitFaces;
105 106
  private Static3D[] mAxis;
......
174 175
    mNumCubitFaces = getNumCubitFaces();
175 176
    mSolvedFunctionIndex = getSolvedFunctionIndex();
176 177

  
178
    int numAxis = mAxis.length;
179
    SHIFT = -1;
180

  
177 181
    mCuts = getCuts(mNumLayers);
178
    mNumCuts = new int[mAxis.length];
179
    for(int i=0; i<mAxis.length; i++)
182
    mNumCuts = new int[numAxis];
183
    for(int i=0; i<numAxis; i++)
180 184
      {
185
      if( SHIFT<mNumLayers[i] ) SHIFT = mNumLayers[i];
181 186
      mNumCuts[i] = (mCuts==null || mCuts[i]==null ? 0 : mCuts[i].length);
182 187
      }
183 188

  
......
956 961
      mRotationAngle.resetToBeginning();
957 962
      mRotationAngle.add(new Static1D(0));
958 963
      mRotationAngle.add(new Static1D(angle));
959
      mRotateEffect.setMeshAssociation( mRotRowBitmap<<(axis*ObjectType.MAX_OBJECT_SIZE) , -1);
964
      mRotateEffect.setMeshAssociation( mRotRowBitmap<<(axis*SHIFT) , -1);
960 965
      mRotateEffect.notifyWhenFinished(listener);
961 966

  
962 967
      return mRotateEffect.getID();
......
992 997
    mRotationAngleStatic.set0(0.0f);
993 998
    mRotationAxis.set( mAxis[axis] );
994 999
    mRotationAngle.add(mRotationAngleStatic);
995
    mRotateEffect.setMeshAssociation( mRotRowBitmap<<(axis*ObjectType.MAX_OBJECT_SIZE) , -1);
1000
    mRotateEffect.setMeshAssociation( mRotRowBitmap<<(axis*SHIFT) , -1);
996 1001
    }
997 1002

  
998 1003
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff