Project

General

Profile

« Previous | Next » 

Revision 4dcfb7a9

Added by Leszek Koltunski over 1 year ago

Introduce individual ScreenRatios for each BandagedObject.

View differences:

src/main/java/org/distorted/bandaged/BandagedCreatorRenderer.java
55 55
   private static final int RESET_DURATION = 1000;
56 56
   private static final float MAX_SIZE_CHANGE = 1.70f;
57 57
   private static final float MIN_SIZE_CHANGE = 0.50f;
58
   private static final float INIT_RATIO = 0.5f;
59 58

  
60 59
   private final BandagedCreatorView mView;
61 60
   private final Resources mResources;
......
63 62
   private final Static3D mScale;
64 63
   private final Static4D mQuatT, mQuatA;
65 64
   private final BandagedObject mObject;
65
   private final float mInitRatio;
66 66

  
67 67
   private boolean mInitialPhase;
68 68
   private long mStartTime;
......
94 94
     mCreatingCubits   = false;
95 95
     mRescaling        = false;
96 96

  
97
     mObjectScreenRatio= INIT_RATIO;
98 97
     mSaveIcon = -1;
99 98

  
100 99
     mScreen = new DistortedScreen();
101 100
     mScreen.glClearColor(BRIGHTNESS, BRIGHTNESS, BRIGHTNESS, 1.0f);
102 101
     mScale = new Static3D(1,1,1);
103 102
     mObject = new BandagedObjectPyraminx(mScreen);
103

  
104
     mInitRatio = mObject.getScreenRatio();
105
     mObjectScreenRatio= mInitRatio;
104 106
     }
105 107

  
106 108
///////////////////////////////////////////////////////////////////////////////////////////////////
......
416 418
     {
417 419
     mObjectScreenRatio *= ratio;
418 420

  
419
     if( mObjectScreenRatio>MAX_SIZE_CHANGE*INIT_RATIO) mObjectScreenRatio = MAX_SIZE_CHANGE*INIT_RATIO;
420
     if( mObjectScreenRatio<MIN_SIZE_CHANGE*INIT_RATIO) mObjectScreenRatio = MIN_SIZE_CHANGE*INIT_RATIO;
421
     if( mObjectScreenRatio>MAX_SIZE_CHANGE*mInitRatio) mObjectScreenRatio = MAX_SIZE_CHANGE*mInitRatio;
422
     if( mObjectScreenRatio<MIN_SIZE_CHANGE*mInitRatio) mObjectScreenRatio = MIN_SIZE_CHANGE*mInitRatio;
421 423

  
422 424
     mRescaling = true;
423 425
     }
src/main/java/org/distorted/bandaged/BandagedCreatorTouchControl.java
153 153

  
154 154
  public BandagedCreatorTouchControl(float ratio, float fov, BandagedObject object)
155 155
    {
156
    mObject = object;
157
    mPoint = new float[3];
158
    mCamera= new float[3];
159
    mTouch = new float[3];
156
    mPoint   = new float[3];
157
    mCamera  = new float[3];
158
    mTouch   = new float[3];
160 159
    mPoint2D = new float[2];
161 160
    mDist3D  = new float[6];
161

  
162
    mObject   = object;
162 163
    mFaceAxis = mObject.getFaceAxis();
163
    mObjectRatio = ratio;
164 164
    mNumFaces = mFaceAxis.length;
165
    mObjectRatio = ratio;
165 166

  
166 167
    double halfFOV = fov * (Math.PI/360);
167 168
    float tanHalf = (float)Math.tan(halfFOV);

Also available in: Unified diff