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/deform/DeformRenderer.java
23 23
import javax.microedition.khronos.opengles.GL10;
24 24

  
25 25
import org.distorted.library.Distorted;
26
import org.distorted.library.DistortedBitmap;
26
import org.distorted.library.DistortedObject;
27
import org.distorted.library.DistortedObjectGrid;
28
import org.distorted.library.DistortedBitmapGrid;
29

  
27 30
import org.distorted.library.EffectNames;
28 31
import org.distorted.library.EffectTypes;
29 32
import org.distorted.library.type.Dynamic3D;
......
41 44

  
42 45
class DeformRenderer implements GLSurfaceView.Renderer 
43 46
{
44
   private static final int NUM_VECTORS = 8;
45
   private static final int NUM_LINES = 10;
46
   private static final int NUM_FRAMES =10;
47
   private static final int NUM_VECTORS =  8;
48
   private static final int NUM_LINES   = 10;
49
   private static final int NUM_FRAMES  = 10;
47 50

  
48 51
   private GLSurfaceView mView;
49
   private DistortedBitmap fps;
50
   private DistortedBitmap stretch;
52
   private DistortedObject fps, stretch;
53
   private DistortedObjectGrid fpsGrid, stretchGrid;
51 54
   private Static3D touchPoint;
52 55

  
53 56
   private Dynamic3D mReleasedDistortDynamic;
......
169 172
    
170 173
      long time = System.currentTimeMillis();
171 174
      
172
      stretch.draw(time);
175
      stretch.draw(time,stretchGrid);
173 176
      
174 177
      mPaint.setColor(0xffffffff);
175 178
      fpsCanvas.drawRect(0, 0, fpsW, fpsH, mPaint);
176 179
      mPaint.setColor(0xff000000);
177 180
      fpsCanvas.drawText(fpsString, fpsW/2, 5*fpsH/6, mPaint);
178 181
      
179
      fps.setBitmap(fpsBitmap);
180
      fps.draw(time);
182
      fps.setTexture(fpsBitmap);
183
      fps.draw(time,fpsGrid);
181 184
      
182 185
      computeFPS(time);
183 186
      }
......
193 196

  
194 197
      Distorted.onSurfaceChanged(width, height);
195 198
      
196
      if( bitmapCreated==false )
199
      if( !bitmapCreated )
197 200
        {
198 201
        createBitmap(scrWidth/2,scrHeight/2);
199 202
        stretch.move( new Static3D(scrWidth/4,scrHeight/4,0) );
......
231 234
      Canvas stretchCanvas;   
232 235
      
233 236
      mPaint = new Paint();
234
      stretch = new DistortedBitmap(w,h, 50);   
237
      stretch = new DistortedObject(w,h,1);
238
      stretchGrid = new DistortedBitmapGrid(50,50*h/w);
235 239
      Bitmap stretchBitmap = Bitmap.createBitmap(w,h, Bitmap.Config.ARGB_8888);
236 240
      stretchCanvas = new Canvas(stretchBitmap);
237 241
      
......
254 258
        
255 259
      touchPoint= new Static3D(0,0,0);
256 260
        
257
      fps = new DistortedBitmap( fpsW, fpsH, 2);
261
      fps = new DistortedObject( fpsW, fpsH, 1);
262
      fpsGrid = new DistortedBitmapGrid(1,1);
263

  
258 264
      fpsBitmap = Bitmap.createBitmap(fpsW,fpsH, Bitmap.Config.ARGB_8888);
259 265
      fpsCanvas = new Canvas(fpsBitmap);
260 266
        
261
      stretch.setBitmap(stretchBitmap);
262
      fps.setBitmap(fpsBitmap);
267
      stretch.setTexture(stretchBitmap);
268
      fps.setTexture(fpsBitmap);
263 269
      }
264 270

  
265 271
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff