Project

General

Profile

« Previous | Next » 

Revision d79a56d3

Added by Leszek Koltunski about 7 years ago

Major refactoring: convert the Matrix Effects to be independent of the resolution of the surface we render to.

Re-write the first 15 apps to work with this.

View differences:

src/main/java/org/distorted/examples/deform/DeformRenderer.java
100 100
      fpsTexture.setTexture(fpsBitmap);
101 101
      fpsCanvas = new Canvas(fpsBitmap);
102 102
      fpsEffects = new DistortedEffects();
103
      fpsEffects.move( new Static3D(5,5,0) );
104 103

  
105 104
      mPaint = new Paint();
106 105
      mPaint.setAntiAlias(true);
......
108 107
      mPaint.setTextSize(0.7f*fpsH);
109 108

  
110 109
      stretchEffects = new DistortedEffects();
110
      stretchEffects.scale(0.5f);
111 111

  
112 112
      mRegion = new Static4D(0,0,0,0);
113 113

  
......
205 205
     scrHeight = height;
206 206
     scrWidth  = width;
207 207

  
208
     fpsEffects.abortAllEffects();
209
     fpsEffects.move(  new Static3D( -0.5f + (fpsW/2 + 5.0f)/width, -0.5f + (fpsH/2 + 5.0f)/height,0.0f) );
210
     fpsEffects.scale( new Static3D( (float)fpsW/width, (float)fpsH/height, 1.0f) );
211

  
208 212
     mRegion.set3(mRadius*scrWidth);
209 213

  
210 214
     Canvas stretchCanvas;
......
231 235
     if( stretchTexture==null ) stretchTexture = new DistortedTexture(w,h);
232 236
     stretchTexture.setTexture(stretchBitmap);
233 237

  
234
     stretchEffects.abortAllEffects();
235
     stretchEffects.move( new Static3D(scrWidth/4,scrHeight/4,0) );
236

  
237 238
     mScreen.detachAll();
238 239
     mScreen.attach(stretchTexture,stretchEffects,stretchMesh);
239 240
     mScreen.attach(fpsTexture,fpsEffects,fpsMesh);
......
269 270
     if( xt>scrWidth/2 ) xt=scrWidth/2;
270 271
     if( yt<0 ) yt=0;
271 272
     if( yt>scrHeight/2 ) yt=scrHeight/2;
272
      
273
     touchPoint.set(xt,yt,0);
274 273

  
275 274
     switch(mMode)
276 275
       {
277 276
       case DISTORT: vDistort[0].set(0,0,0);
277
                     touchPoint.set(xt,yt,0);
278 278
                     mLastEffect = stretchEffects.distort( mMovingDistortDynamic, touchPoint, mRegion);
279 279
                     break;
280 280
       case DEFORM : vDeform[0].set(0,0,0);
281
                     touchPoint.set(xt,yt,0);
281 282
                     mLastEffect = stretchEffects.deform( mMovingDeformDynamic, touchPoint, mRegion);
282 283
                     break;
283 284
       case SHEAR  : vShear[0].set(0,0,0);
285
                     touchPoint.set( (float)xt/scrWidth, (float)yt/scrHeight,0);
284 286
                     mLastEffect = stretchEffects.shear(mMovingShearDynamic, touchPoint);
285 287
                     break;
286 288
       }

Also available in: Unified diff