Project

General

Profile

« Previous | Next » 

Revision 42ec9110

Added by Leszek Koltunski over 3 years ago

Fixes for Deform and Moving Effects.

View differences:

src/main/java/org/distorted/examples/deform/DeformRenderer.java
52 52
   {
53 53
   private static final int NUM_VECTORS =  8;
54 54
   private static final int NUM_LINES   = 10;
55
   private static final float QUOT      = 0.6f;
55 56

  
56 57
   private GLSurfaceView mView;
57 58
   private DistortedTexture mTexture;
......
194 195
     mRegion.set3(mRadius);
195 196

  
196 197
     Canvas stretchCanvas;
197
     textureWidth = (int)(0.6f*width);
198
     textureHeight= (int)(0.6f*height);
198
     textureWidth = (int)(QUOT*width);
199
     textureHeight= (int)(QUOT*height);
199 200

  
200 201
     if( mMesh!=null ) mMesh.markForDeletion();
201 202
     mMesh = new MeshSquare(50,50*textureHeight/textureWidth);
......
246 247

  
247 248
   void down(int x, int y)
248 249
     {
249
     float xt = (float)x/scrWidth-0.5f;
250
     float yt = 0.5f-(float)y/scrHeight;
250
     float xt = (((float)x)/scrWidth-0.5f)/QUOT;
251
     float yt = (0.5f-((float)y)/scrHeight)/QUOT;
251 252

  
252 253
     switch(mMode)
253 254
       {
......
264 265
       case SHEAR  : vShear[0].set(0,0,0);
265 266
                     mEffects.apply(mMovingShear);
266 267
                     mLastEffect = mMovingShear.getID();
267
                     mTouchPoint.set(xt,yt,0);
268
                     mTouchPoint.set(textureWidth*xt,textureHeight*yt,0);
268 269
                     break;
269 270
       }
270 271
     }

Also available in: Unified diff