Project

General

Profile

« Previous | Next » 

Revision a8aa49dc

Added by Leszek Koltunski over 2 years ago

Bandaged: progress.

View differences:

src/main/java/org/distorted/bandaged/BandagedCreatorRenderer.java
61 61
{
62 62
   public static final float BRIGHTNESS = 0.333f;
63 63
   private static final int DURATION = 1000;
64

  
65 64
   static final float SCREEN_RATIO = 0.5f;
66
   static final float OBJECT_SIZE  = 3.0f;
67 65

  
68 66
   private final BandagedCreatorView mView;
69 67
   private final DistortedScreen mScreen;
......
82 80
   private DistortedFramebuffer mFramebuffer;
83 81
   private String mPath;
84 82
   private boolean mCubitsCreated;
83
   private int mWidth, mHeight;
85 84

  
86 85
///////////////////////////////////////////////////////////////////////////////////////////////////
87 86

  
......
245 244
   @Override
246 245
   public void onSurfaceChanged(GL10 glUnused, int width, int height)
247 246
      {
248
      final float Q = SCREEN_RATIO/OBJECT_SIZE;
249
      mScaleValue = width<height ? Q*width : Q*height;
247
      mWidth = width;
248
      mHeight= height;
249
      rescaleObject();
250 250

  
251 251
      mScreen.detachAll();
252 252
      int touched = mView.getTouched();
......
261 261
          mScreen.attach(node);
262 262
          }
263 263

  
264
      mScale.set( mScaleValue,mScaleValue,mScaleValue );
265 264
      mView.setScreenSize(width,height);
266 265
      mScreen.resize(width,height);
267 266
      }
......
516 515
     mSaveIcon = -1;
517 516
     }
518 517

  
518
///////////////////////////////////////////////////////////////////////////////////////////////////
519

  
520
   private void rescaleObject()
521
     {
522
     final int size = mX>mY ? Math.max(mX, mZ) : Math.max(mY, mZ);
523
     final float Q = SCREEN_RATIO/size;
524
     mScaleValue = mWidth<mHeight ? Q*mWidth : Q*mHeight;
525
     mScale.set( mScaleValue,mScaleValue,mScaleValue );
526
     }
527

  
519 528
///////////////////////////////////////////////////////////////////////////////////////////////////
520 529

  
521 530
   public void changeObject(int x, int y, int z)
......
527 536
       mX = x;
528 537
       mY = y;
529 538
       mZ = z;
539

  
540
       rescaleObject();
541

  
530 542
       mNumCubits = computeNumCubits(mX,mY,mZ);
531 543

  
532 544
       if( mCubitsCreated )

Also available in: Unified diff