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
     }
src/main/java/org/distorted/examples/movingeffects/MovingEffectsSurfaceView.java
206 206
        {
207 207
        mRenderer.apply(null);
208 208
        mCenter.removeAll();
209
        mCenter.resetToBeginning();
209 210
        mCurrEffect = EFFECT_POINTS;
210 211
        mRenderer.setRefresh();
211 212
        }
......
233 234
            c.drawCircle( (drawCoord[0]+0.5f)*mScrWidth, 0.5f*mScrHeight-drawCoord[1]*mScrWidth, mSize1, mPaint );
234 235
            }
235 236
          }
236
     
237

  
237 238
        mPaint.setColor(0xffff0000);
238 239
      
239 240
        for(int curr=0; curr<len; curr++)

Also available in: Unified diff