Project

General

Profile

« Previous | Next » 

Revision e8b6aa95

Added by Leszek Koltunski over 7 years ago

Major change in API: separate the GRID from DistortedObject; completely remove classes derived from DistortedObject.

View differences:

src/main/java/org/distorted/examples/plainmonalisa/RenderThread.java
31 31
import android.view.SurfaceView;
32 32

  
33 33
import org.distorted.library.Distorted;
34
import org.distorted.library.DistortedBitmap;
34
import org.distorted.library.DistortedBitmapGrid;
35
import org.distorted.library.DistortedObject;
35 36
import org.distorted.library.EffectTypes;
36 37
import org.distorted.library.type.Dynamic3D;
37
import org.distorted.library.type.Static2D;
38 38
import org.distorted.library.type.Static3D;
39 39
import org.distorted.library.type.Static4D;
40 40
import org.distorted.examples.R;
......
60 60
  private EglCore eglCore;
61 61
  private EGLSurface eglSurface;
62 62

  
63
  private DistortedBitmap monaLisa;
63
  private DistortedObject monaLisa;
64
  private DistortedBitmapGrid mGrid;
64 65
  private int bmpHeight, bmpWidth;
65 66

  
66 67
  private Static3D pLeft, pRight;
......
189 190
      catch(IOException io) {}
190 191
      }
191 192

  
192
    monaLisa = new DistortedBitmap(bmp, 9);
193
    bmpHeight = bmp.getHeight();
194
    bmpWidth  = bmp.getWidth();
195

  
196
    monaLisa = new DistortedObject(bmpWidth,bmpHeight,1);
193 197
    monaLisa.distort( dLeft, pLeft , rLeft );
194 198
    monaLisa.distort(dRight, pRight, rRight);
199
    monaLisa.setTexture(bmp);
195 200

  
196
    bmpHeight = bmp.getHeight();
197
    bmpWidth  = bmp.getWidth();
201
    mGrid= new DistortedBitmapGrid(9,9*bmpHeight/bmpWidth);  // more-or-less square Grid with 9 columns.
198 202

  
199 203
    try
200 204
      {
......
247 251
    eglCore.makeCurrent(eglSurface);
248 252

  
249 253
    GLES20.glClear( GLES20.GL_DEPTH_BUFFER_BIT | GLES20.GL_COLOR_BUFFER_BIT);
250
    monaLisa.draw(System.currentTimeMillis());
254
    monaLisa.draw(System.currentTimeMillis(), mGrid);
251 255

  
252 256
    eglCore.swapBuffers(eglSurface);
253 257
    }

Also available in: Unified diff