Project

General

Profile

« Previous | Next » 

Revision 91786be2

Added by Leszek Koltunski almost 8 years ago

DEFORM: add support for Regions

View differences:

src/main/java/org/distorted/examples/deform/DeformActivity.java
127 127
        {
128 128
        case R.id.deformSeekRadius: DeformSurfaceView view = (DeformSurfaceView) this.findViewById(R.id.deformSurfaceView);
129 129
                                    view.getRenderer().setRegionRadius(progress);
130
                                    textR.setText("Radius: "+progress);
130
                                    textR.setText("Radius: "+(progress<100 ? progress: "Infinity"));
131 131
                                    break;
132 132
        }
133 133
      }
src/main/java/org/distorted/examples/deform/DeformRenderer.java
151 151

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

  
157 157
///////////////////////////////////////////////////////////////////////////////////////////////////
......
280 280
                      mLastEffect = stretch.distort( mMovingDistortDynamic, touchPoint, dr);
281 281
                      break;
282 282
        case DEFORM : vDeform[0].set(0,0,0);
283
                      mLastEffect = stretch.deform( mMovingDeformDynamic, touchPoint);
283
                      mLastEffect = stretch.deform( mMovingDeformDynamic, touchPoint, dr);
284 284
                      break;
285 285
        case SHEAR  : vShear[0].set(0,0,0);
286 286
                      mLastEffect = stretch.shear(mMovingShearDynamic, touchPoint);
......
325 325
                        vDeform[i].set( vDeform[i-1].getX()*damp, vDeform[i-1].getY()*damp );
326 326
                        }
327 327
                      vDeform[NUM_VECTORS-1].set(0,0);
328
                      stretch.deform( mReleasedDeformDynamic, touchPoint);
328
                      stretch.deform( mReleasedDeformDynamic, touchPoint, dr);
329 329
                      break;
330 330
        case SHEAR  : for(int i=1; i<NUM_VECTORS-1; i++)
331 331
                        {
src/main/java/org/distorted/examples/effects3d/Effects3DEffect.java
88 88
      case SHEAR            : mId = object.shear     (mDyn3, mCenterDyn); break;
89 89

  
90 90
      case DISTORT          : mId = object.distort   (mDyn3, mCenterDyn, mRegionDyn); break;
91
      case DEFORM           : mId = object.deform    (mDyn3, mCenterDyn            ); break;
91
      case DEFORM           : mId = object.deform    (mDyn3, mCenterDyn, mRegionDyn); break;
92 92
      case SINK             : mId = object.sink      (mDyn1, mCenterDyn, mRegionDyn); break;
93 93
      case PINCH            : mId = object.pinch     (mDyn2, mCenterDyn, mRegionDyn); break;
94 94
      case SWIRL            : mId = object.swirl     (mDyn1, mCenterDyn, mRegionDyn); break;
src/main/java/org/distorted/examples/matrix3d/Matrix3DEffect.java
88 88
      case SHEAR            : mId = object.shear     (mDyn3, mCenterDyn); break;
89 89

  
90 90
      case DISTORT          : mId = object.distort   (mDyn3, mCenterDyn, mRegionDyn); break;
91
      case DEFORM           : mId = object.deform    (mDyn3, mCenterDyn            ); break;
91
      case DEFORM           : mId = object.deform    (mDyn3, mCenterDyn, mRegionDyn); break;
92 92
      case SINK             : mId = object.sink      (mDyn1, mCenterDyn, mRegionDyn); break;
93 93
      case PINCH            : mId = object.pinch     (mDyn2, mCenterDyn, mRegionDyn); break;
94 94
      case SWIRL            : mId = object.swirl     (mDyn1, mCenterDyn, mRegionDyn); break;

Also available in: Unified diff