Project

General

Profile

« Previous | Next » 

Revision b30695c6

Added by Leszek Koltunski over 4 years ago

Do not forget the amount an Object has been changed in size when we switch between Objects.

View differences:

src/main/java/org/distorted/objects/RubikObject.java
76 76
  final int NUM_CUBITS;
77 77
  final float BASIC_STEP;
78 78

  
79
  private static float mInitScreenRatio,mObjectScreenRatio;
79
  private static float mInitScreenRatio;
80
  private static float mObjectScreenRatio = 1.0f;
80 81

  
81 82
  private final int mNodeSize;
82 83
  private int mRotRowBitmap;
......
120 121
    NUM_CUBITS  = mOrigPos.length;
121 122
    ROTATION_AXIS = getRotationAxis();
122 123
    NUM_AXIS = ROTATION_AXIS.length;
123
    mObjectScreenRatio = getScreenRatio();
124
    mInitScreenRatio = mObjectScreenRatio;
124
    mInitScreenRatio = getScreenRatio();
125 125
    NUM_FACES = getNumFaces();
126 126
    NUM_CUBIT_FACES = getNumCubitFaces();
127 127
    NUM_TEXTURES = getNumStickerTypes()*NUM_FACES;
128 128
    BASIC_STEP = getBasicStep();
129 129

  
130
    if( mObjectScreenRatio>MAX_SIZE_CHANGE) mObjectScreenRatio = MAX_SIZE_CHANGE;
131
    if( mObjectScreenRatio<MIN_SIZE_CHANGE) mObjectScreenRatio = MIN_SIZE_CHANGE;
132

  
130 133
    mSize = size;
131 134
    computeStartAndStep(mOrigPos);
132 135
    mNodeScale= new Static3D(1,NODE_RATIO,1);
......
142 145
    mRotationAngleMiddle = new Static1D(0);
143 146
    mRotationAngleFinal  = new Static1D(0);
144 147

  
145
    float scale  = mObjectScreenRatio*mNodeSize/mSize;
148
    float scale  = mObjectScreenRatio*mInitScreenRatio*mNodeSize/mSize;
146 149
    mObjectScale = new Static3D(scale,scale,scale);
147 150
    mScaleEffect = new MatrixEffectScale(mObjectScale);
148 151
    mQuatEffect  = new MatrixEffectQuaternion(quat, CENTER);
......
230 233
    {
231 234
    mObjectScreenRatio *= (1.0f+sizeChange)/2;
232 235

  
233
    if( mObjectScreenRatio > MAX_SIZE_CHANGE*mInitScreenRatio)
234
      {
235
      mObjectScreenRatio = MAX_SIZE_CHANGE*mInitScreenRatio;
236
      }
237
    if( mObjectScreenRatio < MIN_SIZE_CHANGE*mInitScreenRatio)
238
      {
239
      mObjectScreenRatio = MIN_SIZE_CHANGE*mInitScreenRatio;
240
      }
236
    if( mObjectScreenRatio>MAX_SIZE_CHANGE) mObjectScreenRatio = MAX_SIZE_CHANGE;
237
    if( mObjectScreenRatio<MIN_SIZE_CHANGE) mObjectScreenRatio = MIN_SIZE_CHANGE;
241 238

  
242
    float scale = mObjectScreenRatio*mNodeSize/mSize;
239
    float scale = mObjectScreenRatio*mInitScreenRatio*mNodeSize/mSize;
243 240
    mObjectScale.set(scale,scale,scale);
244 241
    }
245 242

  
......
247 244

  
248 245
  static float getObjectRatio()
249 246
    {
250
    return mObjectScreenRatio;
247
    return mObjectScreenRatio*mInitScreenRatio;
251 248
    }
252 249

  
253 250
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff