Project

General

Profile

« Previous | Next » 

Revision 227e8c1f

Added by Leszek Koltunski over 2 years ago

Bandaged: progress.

View differences:

src/main/java/org/distorted/bandaged/BandagedCreatorRenderer.java
74 74
   private float mScaleValue;
75 75
   private float mQuatX, mQuatY, mQuatZ, mQuatW;
76 76
   private int mX, mY, mZ, mNumCubits;
77
   private boolean mResetQuats, mSetQuatT, mResettingObject, mConnectingCubits;
77
   private boolean mResetQuats, mSetQuatT, mResettingObject, mConnectingCubits, mCreatingCubits;
78 78
   private int mIndex1, mIndex2;
79 79
   private int mSaveIcon;
80 80
   private DistortedFramebuffer mFramebuffer;
......
96 96
     mResettingObject  = false;
97 97
     mConnectingCubits = false;
98 98
     mCubitsCreated    = false;
99
     mCreatingCubits   = false;
99 100

  
100 101
     mSaveIcon = -1;
101 102

  
......
135 136

  
136 137
   private void createCubits()
137 138
     {
138
     android.util.Log.e("D", "creating cubits : "+mX+" "+mY+" "+mZ);
139

  
140 139
     mCubits = new BandagedCubit[mNumCubits];
141 140
     int c=0;
142 141

  
......
237 236
       mConnectingCubits = false;
238 237
       tryConnectingCubits(mIndex1,mIndex2);
239 238
       }
239

  
240
     if( mCreatingCubits )
241
       {
242
       mCreatingCubits = false;
243

  
244
       rescaleObject();
245

  
246
       if( mCubitsCreated )
247
         {
248
         createCubits();
249

  
250
         mScreen.detachAll();
251
         mView.resetCubits();
252

  
253
         for(int i=0; i<mNumCubits; i++)
254
           {
255
           mCubits[i].scaleMove(mScaleValue);
256
           DistortedNode node = mCubits[i].getNode();
257
           mScreen.attach(node);
258
           }
259
         }
260
       }
240 261
     }
241 262

  
242 263
///////////////////////////////////////////////////////////////////////////////////////////////////
......
519 540

  
520 541
   private void rescaleObject()
521 542
     {
543
     //final int min = mX<mY ? Math.min(mX, mZ) : Math.min(mY, mZ);
544
     //final int size= (mX+mY+mZ-min)/2;
522 545
     final int size = mX>mY ? Math.max(mX, mZ) : Math.max(mY, mZ);
523 546
     final float Q = SCREEN_RATIO/size;
524 547
     mScaleValue = mWidth<mHeight ? Q*mWidth : Q*mHeight;
......
531 554
     {
532 555
     if( mX!=x || mY!=y || mZ!=z )
533 556
       {
534
       android.util.Log.e("D", "really changing object to : "+x+" "+y+" "+z);
535

  
536 557
       mX = x;
537 558
       mY = y;
538 559
       mZ = z;
539 560

  
540
       rescaleObject();
541

  
542 561
       mNumCubits = computeNumCubits(mX,mY,mZ);
543 562

  
544
       if( mCubitsCreated )
545
         {
546
         createCubits();
547

  
548
         mScreen.detachAll();
549
         mView.resetCubits();
550

  
551
         for(int i=0; i<mNumCubits; i++)
552
           {
553
           mCubits[i].scaleMove(mScaleValue);
554
           DistortedNode node = mCubits[i].getNode();
555
           mScreen.attach(node);
556
           }
557
         }
563
       mCreatingCubits = true;
558 564
       }
559 565
     }
560 566

  

Also available in: Unified diff