Project

General

Profile

« Previous | Next » 

Revision 6161fe9a

Added by Leszek Koltunski almost 8 years ago

Improve the Deform app

View differences:

src/main/java/org/distorted/examples/deform/DeformRenderer.java
60 60
   private Dynamic3D mMovingShearDynamic;
61 61
   private Static3D[] vShear;
62 62

  
63
   private Static4D dr;
63
   private Static4D mRegion;
64 64
   private Canvas fpsCanvas;
65 65
   private Bitmap fpsBitmap;
66 66
   private int scrHeight, scrWidth;
......
81 81
      { 
82 82
      mView = view;
83 83
      
84
      dr = new Static4D(0,0,0,0);
84
      mRegion = new Static4D(0,0,0,0);
85 85

  
86 86
      durations = new long[NUM_FRAMES+1];
87 87
      currDuration = 0;
......
151 151

  
152 152
   void setRegionRadius(int r)
153 153
      {
154
      dr.set3( r==100 ? 100*scrWidth : r*scrWidth/100.0f);
154
      mRegion.set3( r==100 ? 100*scrWidth : r*scrWidth/100.0f);
155 155
      }
156 156

  
157 157
///////////////////////////////////////////////////////////////////////////////////////////////////
......
188 188
      { 
189 189
      scrHeight = height;
190 190
      scrWidth  = width;
191
      
191

  
192
      setRegionRadius(50);
193

  
192 194
      Distorted.onSurfaceChanged(width, height);
193 195
      
194 196
      if( bitmapCreated==false )
......
277 279
      switch(mMode)
278 280
        {
279 281
        case DISTORT: vDistort[0].set(0,0,0);
280
                      mLastEffect = stretch.distort( mMovingDistortDynamic, touchPoint, dr);
282
                      mLastEffect = stretch.distort( mMovingDistortDynamic, touchPoint, mRegion);
281 283
                      break;
282 284
        case DEFORM : vDeform[0].set(0,0,0);
283
                      mLastEffect = stretch.deform( mMovingDeformDynamic, touchPoint, dr);
285
                      mLastEffect = stretch.deform( mMovingDeformDynamic, touchPoint, mRegion);
284 286
                      break;
285 287
        case SHEAR  : vShear[0].set(0,0,0);
286 288
                      mLastEffect = stretch.shear(mMovingShearDynamic, touchPoint);
......
318 320
                        vDistort[i].set( vDistort[i-1].getX()*damp, vDistort[i-1].getY()*damp );
319 321
                        }
320 322
                      vDistort[NUM_VECTORS-1].set(0,0);
321
                      stretch.distort( mReleasedDistortDynamic, touchPoint, dr);
323
                      stretch.distort( mReleasedDistortDynamic, touchPoint, mRegion);
322 324
                      break;
323 325
        case DEFORM : for(int i=1; i<NUM_VECTORS-1; i++)
324 326
                        {
325 327
                        vDeform[i].set( vDeform[i-1].getX()*damp, vDeform[i-1].getY()*damp );
326 328
                        }
327 329
                      vDeform[NUM_VECTORS-1].set(0,0);
328
                      stretch.deform( mReleasedDeformDynamic, touchPoint, dr);
330
                      stretch.deform( mReleasedDeformDynamic, touchPoint, mRegion);
329 331
                      break;
330 332
        case SHEAR  : for(int i=1; i<NUM_VECTORS-1; i++)
331 333
                        {

Also available in: Unified diff