Project

General

Profile

« Previous | Next » 

Revision a56bc359

Added by Leszek Koltunski about 8 years ago

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

View differences:

src/main/java/org/distorted/library/Distorted.java
379 379
 */
380 380
  public static void onDestroy()
381 381
    {
382
    DistortedGridFactory.release();
383 382
    DistortedObject.release();
384 383
    DistortedFramebuffer.release();
385 384
    DistortedNode.release();
src/main/java/org/distorted/library/DistortedBitmap.java
1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2016 Leszek Koltunski                                                               //
3
//                                                                                               //
4
// This file is part of Distorted.                                                               //
5
//                                                                                               //
6
// Distorted is free software: you can redistribute it and/or modify                             //
7
// it under the terms of the GNU General Public License as published by                          //
8
// the Free Software Foundation, either version 2 of the License, or                             //
9
// (at your option) any later version.                                                           //
10
//                                                                                               //
11
// Distorted is distributed in the hope that it will be useful,                                  //
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of                                //
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                 //
14
// GNU General Public License for more details.                                                  //
15
//                                                                                               //
16
// You should have received a copy of the GNU General Public License                             //
17
// along with Distorted.  If not, see <http://www.gnu.org/licenses/>.                            //
18
///////////////////////////////////////////////////////////////////////////////////////////////////
19

  
20
package org.distorted.library;
21

  
22
import android.graphics.Bitmap;
23

  
24
///////////////////////////////////////////////////////////////////////////////////////////////////
25
/**
26
 * DistortedObject descendant - with a Grid of flat rectangles.
27
 */
28
public class DistortedBitmap extends DistortedObject
29
   {
30
   
31
///////////////////////////////////////////////////////////////////////////////////////////////////
32
// PUBLIC API
33
///////////////////////////////////////////////////////////////////////////////////////////////////  
34
/**
35
 * Default constructor: creates a DistortedBitmap (width,height) pixels in size, with the distortion
36
 * grid of 'cols' and does not fill it up with any Bitmap data just yet.
37
 * <p>
38
 * Distortion grid is a grid of rectangles the Bitmap is split to. The vertices of this grid are then 
39
 * moved around by the Vertex Shader to create various Vertex Effects.
40
 * <p>
41
 * Size parameter describes the horizontal size, i.e. the number of rectangles the top (or bottom) edge
42
 * is split to. So when size=1, the whole Bitmap is just one giant rectangle. When size=10, the Bitmap
43
 * is split into a grid of 10x10 rectangles.
44
 * <p>
45
 * The higher the size, the better Vertex Effects look; on the other hand too high size will slow things 
46
 * down.  
47
 *       
48
 * @param width  width of the DistortedBitmap, in pixels.
49
 * @param height height of the DistortedBitmap, in pixels.
50
 * @param cols   Number of columns in the distortion grid. 2<=size&lt;256.
51
 *               Number of rows gets calculated with 'rows = cols*height/width'.
52
 */
53
   public DistortedBitmap(int width, int height, int cols)
54
     {     
55
     int xsize = cols;
56
     int ysize = cols*height/width;
57

  
58
     if( xsize<1   ) xsize=  1;
59
     if( xsize>256 ) xsize=256;
60
     if( ysize<1   ) ysize=  1;
61
     if( ysize>256 ) ysize=256;
62
     
63
     mGrid = DistortedGridFactory.getGrid(xsize,ysize);
64
     initializeData(width,height,1);
65
     }
66

  
67
///////////////////////////////////////////////////////////////////////////////////////////////////   
68
/**
69
 * Creates a DistortedBitmap and immediately fills it up with Bitmap data.
70
 * The dimensions of the created DistortedBitmap object are the same like that of the passed Bitmap.
71
 *       
72
 * @param bmp The android.graphics.Bitmap object to apply effects to and display.
73
 * @param gridSize Horizontal size of the distortion grid. 1<=size&lt;256.
74
 */
75
   public DistortedBitmap(Bitmap bmp, int gridSize)
76
     {
77
     this(bmp.getWidth(), bmp.getHeight(), gridSize); 
78
     setBitmap(bmp);
79
     }
80

  
81
///////////////////////////////////////////////////////////////////////////////////////////////////
82
/**
83
 * Copy constructor.
84
 *
85
 * @param db Object to copy
86
 * @param flags see {@see DistortedObject#DistortedObject(DistortedObject,int)}
87
 */
88
   public DistortedBitmap(DistortedBitmap db, int flags)
89
     {
90
     super(db,flags);
91
     }
92

  
93
///////////////////////////////////////////////////////////////////////////////////////////////////
94

  
95
   protected DistortedObject deepCopy(int flags)
96
     {
97
     return new DistortedBitmap(this,flags);
98
     }
99

  
100
///////////////////////////////////////////////////////////////////////////////////////////////////
101
}
102
    
src/main/java/org/distorted/library/DistortedBitmapGrid.java
24 24

  
25 25
///////////////////////////////////////////////////////////////////////////////////////////////////
26 26

  
27
class DistortedBitmapGrid extends DistortedObjectGrid
27
public class DistortedBitmapGrid extends DistortedObjectGrid
28 28
  {
29 29
  private int mCols, mRows;
30 30
  private int remainingVert;
......
153 153
     }
154 154
*/
155 155
///////////////////////////////////////////////////////////////////////////////////////////////////
156

  
156
// PUBLIC API
157
///////////////////////////////////////////////////////////////////////////////////////////////////
157 158
/**
158 159
 * Creates the underlying grid of vertices, normals and texture coords.
159 160
 *
src/main/java/org/distorted/library/DistortedCubes.java
1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2016 Leszek Koltunski                                                               //
3
//                                                                                               //
4
// This file is part of Distorted.                                                               //
5
//                                                                                               //
6
// Distorted is free software: you can redistribute it and/or modify                             //
7
// it under the terms of the GNU General Public License as published by                          //
8
// the Free Software Foundation, either version 2 of the License, or                             //
9
// (at your option) any later version.                                                           //
10
//                                                                                               //
11
// Distorted is distributed in the hope that it will be useful,                                  //
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of                                //
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                 //
14
// GNU General Public License for more details.                                                  //
15
//                                                                                               //
16
// You should have received a copy of the GNU General Public License                             //
17
// along with Distorted.  If not, see <http://www.gnu.org/licenses/>.                            //
18
///////////////////////////////////////////////////////////////////////////////////////////////////
19

  
20
package org.distorted.library;
21

  
22
///////////////////////////////////////////////////////////////////////////////////////////////////
23
/**
24
 * DistortedObject descendant - with a Grid composed of a set of cubes, centers of which all have equal Z-coords.
25
 * (a subset of a NxMx1 cuboid build with 1x1x1 cubes, i.e. the MxNx1 cuboid with arbitrary cubes missing)
26
 */
27
public class DistortedCubes extends DistortedObject
28
   {
29
   
30
///////////////////////////////////////////////////////////////////////////////////////////////////
31
// PUBLIC API
32
///////////////////////////////////////////////////////////////////////////////////////////////////
33
/**
34
 * Creates internal memory representation of a cuboid subset.
35
 *
36
 * @param cols Integer helping to parse the next parameter.
37
 * @param desc String describing the subset of a MxNx1 cuboid that we want to create.
38
 *             Its MxN characters - all 0 or 1 - decide of appropriate field is taken or not.
39
 *      <p></p>
40
 *      <p>
41
 *      <pre>
42
 *      For example, (cols=2, desc="111010") describes the following shape:
43
 *
44
 *      XX
45
 *      X
46
 *      X
47
 *
48
 *      whereas (cols=2,desc="110001") describes
49
 *
50
 *      XX
51
 *
52
 *       X
53
 *      </pre>
54
 *      </p>
55
 * @param cubeSize size, in pixels, of the single 1x1x1 cube our cuboid is built from
56
 * @param frontOnly Only create the front wall or side and back as well?
57
 */
58
 public DistortedCubes(int cols, String desc, int cubeSize, boolean frontOnly)
59
   {
60
   int Rs = 0;
61
   int Cs = 0;
62
     
63
   if( cols>0 )
64
     {
65
     int reallen = desc.length();
66
     int len = reallen;
67

  
68
     if( (reallen/cols)*cols != reallen )
69
       {
70
       len = ((reallen/cols)+1)*cols;
71
       for(int i=reallen; i<len; i++) desc += "0";
72
       }
73
    
74
     if( desc.contains("1") )
75
       {
76
       Cs = cols;
77
       Rs = len/cols;
78
       }
79
     }
80
     
81
   mGrid = DistortedGridFactory.getGrid(cols,desc, frontOnly);
82
   initializeData(cubeSize*Cs,cubeSize*Rs,frontOnly ? 1 : cubeSize);
83
   }
84

  
85
///////////////////////////////////////////////////////////////////////////////////////////////////
86
/**
87
 * Creates internal memory representation of a full, hole-less cuboid subset.
88
 *
89
 * @param cols Number of columns
90
 * @param rows Number of rows
91
 * @param cubeSize size, in pixels, of the single 1x1x1 cube our cuboid is built from
92
 * @param frontOnly Only create the front wall or side and back as well?
93
 */
94
 public DistortedCubes(int cols, int rows, int cubeSize, boolean frontOnly)
95
   {
96
   mGrid = DistortedGridFactory.getGrid(cols,rows, frontOnly);
97
   initializeData(cubeSize*cols,cubeSize*rows,frontOnly ? 1 : cubeSize);
98
   }
99

  
100
///////////////////////////////////////////////////////////////////////////////////////////////////
101
/**
102
 * Convenience constructor.
103
 */
104
 public DistortedCubes(int cols, String desc, int gridSize)
105
   {
106
   this(cols,desc,gridSize,false);
107
   }
108

  
109
///////////////////////////////////////////////////////////////////////////////////////////////////
110
/**
111
 * Copy constructor.
112
 *
113
 * @param dc Object to copy
114
 * @param flags see {@link DistortedObject#DistortedObject(DistortedObject,int)}
115
 */
116
 public DistortedCubes(DistortedCubes dc, int flags)
117
   {
118
   super(dc,flags);
119
   }
120

  
121
///////////////////////////////////////////////////////////////////////////////////////////////////
122

  
123
 protected DistortedObject deepCopy(int flags)
124
   {
125
   return new DistortedCubes(this,flags);
126
   }
127

  
128
///////////////////////////////////////////////////////////////////////////////////////////////////   
129
 }
src/main/java/org/distorted/library/DistortedCubesGrid.java
25 25

  
26 26
///////////////////////////////////////////////////////////////////////////////////////////////////
27 27

  
28
class DistortedCubesGrid extends DistortedObjectGrid
28
public class DistortedCubesGrid extends DistortedObjectGrid
29 29
   {
30 30
   private static final float R = 0.0f;//0.2f;
31 31
   private static final float FRONTZ = 0.5f;
......
743 743
/**
744 744
 * Creates the underlying grid of vertices, normals, texture coords and colors.
745 745
 *    
746
 * @param cols      See {@link DistortedCubes#DistortedCubes(int,String,int,boolean)}
747
 * @param desc      See {@link DistortedCubes#DistortedCubes(int,String,int,boolean)}
748
 * @param frontOnly See {@link DistortedCubes#DistortedCubes(int,String,int,boolean)}
746
 * @param cols      Integer helping to parse the next parameter.
747
 * @param desc      String describing the subset of a MxNx1 cuboid that we want to create.
748
 *                  Its MxN characters - all 0 or 1 - decide of appropriate field is taken or not.
749
 *                  <p></p>
750
 *                  <p>
751
 *                  <pre>
752
 *                  For example, (cols=2, desc="111010") describes the following shape:
753
 *
754
 *                  XX
755
 *                  X
756
 *                  X
757
 *
758
 *                  whereas (cols=2,desc="110001") describes
759
 *
760
 *                  XX
761
 *
762
 *                   X
763
 *                  </pre>
764
 *                  </p>
765
 * @param frontOnly Only create the front wall or side and back as well?
749 766
 */
750
   DistortedCubesGrid(int cols, String desc, boolean frontOnly)
767
   public DistortedCubesGrid(int cols, String desc, boolean frontOnly)
751 768
      {
752 769
      prepareDataStructures(cols,desc,frontOnly);
753 770
      build(frontOnly);
......
757 774
/**
758 775
 * Creates a full, hole-less underlying grid of vertices, normals, texture coords and colors.
759 776
 *
760
 * @param cols      See {@link DistortedCubes#DistortedCubes(int,int,int,boolean)}
761
 * @param rows      See {@link DistortedCubes#DistortedCubes(int,int,int,boolean)}
762
 * @param frontOnly See {@link DistortedCubes#DistortedCubes(int,int,int,boolean)}
777
 * @param cols      Number of columns.
778
 * @param rows      Number of rows.
779
 * @param frontOnly Only create the front wall or side and back as well?
763 780
 */
764
   DistortedCubesGrid(int cols, int rows, boolean frontOnly)
781
   public DistortedCubesGrid(int cols, int rows, boolean frontOnly)
765 782
      {
766 783
      prepareDataStructures(cols,rows,frontOnly);
767 784
      build(frontOnly);
src/main/java/org/distorted/library/DistortedGridFactory.java
1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2016 Leszek Koltunski                                                               //
3
//                                                                                               //
4
// This file is part of Distorted.                                                               //
5
//                                                                                               //
6
// Distorted is free software: you can redistribute it and/or modify                             //
7
// it under the terms of the GNU General Public License as published by                          //
8
// the Free Software Foundation, either version 2 of the License, or                             //
9
// (at your option) any later version.                                                           //
10
//                                                                                               //
11
// Distorted is distributed in the hope that it will be useful,                                  //
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of                                //
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                 //
14
// GNU General Public License for more details.                                                  //
15
//                                                                                               //
16
// You should have received a copy of the GNU General Public License                             //
17
// along with Distorted.  If not, see <http://www.gnu.org/licenses/>.                            //
18
///////////////////////////////////////////////////////////////////////////////////////////////////
19

  
20
package org.distorted.library;
21

  
22
import java.util.HashMap;
23
/**
24
 * HashMap of all DistortedObjectGrids ever created. The point: we can share the Grids among
25
 * DistortedObjects that are of the same shape.
26
 */
27
///////////////////////////////////////////////////////////////////////////////////////////////////
28

  
29
final class DistortedGridFactory
30
  {
31
  private static HashMap<String,DistortedObjectGrid> mGrids = new HashMap<>();
32

  
33
///////////////////////////////////////////////////////////////////////////////////////////////////
34
// DistortedCubesGrid
35

  
36
  static synchronized DistortedObjectGrid getGrid(int cols, String desc, boolean frontOnly)
37
    {
38
    String d = "1_"+cols+"_"+desc+"_"+(frontOnly?"1":"0");
39
    Object o = mGrids.get(d);
40

  
41
    if( o!=null )
42
      {
43
      return (DistortedObjectGrid)o;
44
      }
45
    else
46
      {
47
      DistortedObjectGrid grid = new DistortedCubesGrid(cols,desc,frontOnly);
48
      mGrids.put(d,grid);
49
      return grid;
50
      }
51
    }
52

  
53
///////////////////////////////////////////////////////////////////////////////////////////////////
54
// DistortedCubesGrid (full)
55

  
56
  static synchronized DistortedObjectGrid getGrid(int cols, int rows, boolean frontOnly)
57
    {
58
    String d = "2_"+cols+"_"+rows+"_"+(frontOnly?"1":"0");
59
    Object o = mGrids.get(d);
60

  
61
    if( o!=null )
62
      {
63
      return (DistortedObjectGrid)o;
64
      }
65
    else
66
      {
67
      DistortedObjectGrid grid = new DistortedCubesGrid(cols,rows,frontOnly);
68
      mGrids.put(d,grid);
69
      return grid;
70
      }
71
    }
72

  
73
///////////////////////////////////////////////////////////////////////////////////////////////////
74
// DistortedBitmapGrid
75

  
76
  static synchronized DistortedObjectGrid getGrid(int cols, int rows)
77
    {
78
    String d = cols+"+"+rows;
79
    Object o = mGrids.get(d);
80

  
81
    if( o!=null )
82
      {
83
      return (DistortedObjectGrid)o;
84
      }
85
    else
86
      {
87
      DistortedObjectGrid grid = new DistortedBitmapGrid(cols,rows);
88
      mGrids.put(d,grid);
89
      return grid;
90
      }
91
    }
92

  
93
///////////////////////////////////////////////////////////////////////////////////////////////////
94

  
95
  static synchronized void release()
96
    {
97
    mGrids.clear();
98
    }
99

  
100
///////////////////////////////////////////////////////////////////////////////////////////////////
101
  }
src/main/java/org/distorted/library/DistortedNode.java
37 37
  private static HashMap<ArrayList<Long>,NodeData> mMapNodeID = new HashMap<>();
38 38
  private static long mNextNodeID =0;
39 39

  
40
  private DistortedObjectGrid mGrid;
40 41
  private DistortedObject mObject;
41 42
  private NodeData mData;
42 43

  
......
101 102
        if( mObject.mBitmapSet[0] )
102 103
          {
103 104
          GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mObject.mTextureDataH[0]);
104
          mObject.drawNoEffectsPriv(mData.mDF);
105
          mObject.drawNoEffectsPriv(mGrid, mData.mDF);
105 106
          }
106 107
      
107 108
        synchronized(this)
......
117 118
      mData.mDF.setAsInput();
118 119
      }
119 120
    
120
    mObject.drawPriv(currTime, df);
121
    mObject.drawPriv(currTime, mGrid, df);
121 122
    }
122 123
  
123 124
///////////////////////////////////////////////////////////////////////////////////////////////////
......
222 223

  
223 224
///////////////////////////////////////////////////////////////////////////////////////////////////
224 225
// Debug - print all the Node IDs
225

  
226
/*
226 227
  void debug(int depth)
227 228
    {
228 229
    String tmp="";
......
251 252
      android.util.Log.e("NODE", "key="+key+" NodeID: "+tmp.ID);
252 253
      }
253 254
    }
254

  
255
*/
255 256
///////////////////////////////////////////////////////////////////////////////////////////////////
256 257
// PUBLIC API
257 258
///////////////////////////////////////////////////////////////////////////////////////////////////
......
260 261
 *     
261 262
 * @param obj DistortedObject to put into the new Node.
262 263
 */
263
  public DistortedNode(DistortedObject obj)
264
  public DistortedNode(DistortedObject obj, DistortedObjectGrid grid)
264 265
    {
265 266
    mObject = obj;
267
    mGrid   = grid;
266 268
    mParent = null;
267 269
    mChildren = null;
268 270
    mNumChildren = new int[1];
......
297 299
  public DistortedNode(DistortedNode node, int flags)
298 300
    {
299 301
    mParent = null;
300
    mObject = node.mObject.deepCopy(flags);
302
    mObject = new DistortedObject(node.mObject,flags);
303
    mGrid   = node.mGrid;
301 304

  
302 305
    if( (flags & Distorted.CLONE_CHILDREN) != 0 )
303 306
      {
......
352 355
 * @param obj DistortedObject to initialize our child Node with.
353 356
 * @return the newly constructed child Node, or null if we couldn't allocate resources.
354 357
 */
355
  public synchronized DistortedNode attach(DistortedObject obj)
358
  public synchronized DistortedNode attach(DistortedObject obj, DistortedObjectGrid grid)
356 359
    {
357 360
    ArrayList<Long> prev = generateIDList(); 
358 361
      
359 362
    if( mChildren==null ) mChildren = new ArrayList<>(2);
360
    DistortedNode node = new DistortedNode(obj);
363
    DistortedNode node = new DistortedNode(obj,grid);
361 364
    node.mParent = this;
362 365
    mChildren.add(node);
363 366
    mNumChildren[0]++;
src/main/java/org/distorted/library/DistortedObject.java
59 59
 * deletion now - actually delete on next render' thing.
60 60
 * We need to be able to quickly retrieve an Object by its ID, thus a HashMap.
61 61
 */
62
public abstract class DistortedObject 
62
public class DistortedObject
63 63
  {
64 64
  private static long mNextID =0;
65 65
  private static HashMap<Long,DistortedObject> mObjects = new HashMap<>();
......
73 73
  private int mSizeX, mSizeY, mSizeZ; // in screen space
74 74
  private int mHalfX, mHalfY, mHalfZ; // halfs of the above
75 75

  
76
  protected DistortedObjectGrid mGrid = null;
77

  
78 76
  private Bitmap[] mBmp= null; //
79 77
  int[] mTextureDataH;         // have to be shared among all the cloned Objects
80 78
  boolean[] mBitmapSet;        //
......
99 97

  
100 98
///////////////////////////////////////////////////////////////////////////////////////////////////
101 99

  
102
  protected abstract DistortedObject deepCopy(int flags);
103

  
104
///////////////////////////////////////////////////////////////////////////////////////////////////
105

  
106
  protected void initializeData(int x, int y, int z)
100
  private void initializeData(int x, int y, int z)
107 101
    {
108 102
    mSizeX= x; mHalfX = x/2;
109 103
    mSizeY= y; mHalfY = y/2;
......
190 184
  
191 185
///////////////////////////////////////////////////////////////////////////////////////////////////
192 186
   
193
  void drawPriv(long currTime, DistortedFramebuffer df)
187
  void drawPriv(long currTime, DistortedObjectGrid grid, DistortedFramebuffer df)
194 188
    {
195 189
    DistortedFramebuffer.deleteAllMarked();
196 190

  
......
204 198
        
205 199
    mF.compute(currTime);
206 200
    mF.send(mHalfX,mHalfY);
207
       
208
    mGrid.draw();
201

  
202
    grid.draw();
209 203
    }
210 204

  
211 205
///////////////////////////////////////////////////////////////////////////////////////////////////
212 206
   
213
  void drawNoEffectsPriv(DistortedFramebuffer df)
207
  void drawNoEffectsPriv(DistortedObjectGrid grid, DistortedFramebuffer df)
214 208
    {
215 209
    GLES20.glViewport(0, 0, df.mWidth, df.mHeight);
216 210

  
217 211
    mM.sendZero(df,mHalfX,mHalfY,mHalfZ);
218 212
    mV.sendZero();
219 213
    mF.sendZero();
220
    mGrid.draw();
214

  
215
    grid.draw();
221 216
    }
222 217
    
223 218
///////////////////////////////////////////////////////////////////////////////////////////////////
......
229 224
    if( !fragmentCloned) mF.abortAll(false);
230 225

  
231 226
    mBmp          = null;
232
    mGrid         = null;
233 227
    mM            = null;
234 228
    mV            = null;
235 229
    mF            = null;
......
270 264
// PUBLIC API
271 265
///////////////////////////////////////////////////////////////////////////////////////////////////
272 266
/**
273
 * Default empty constructor so that derived classes can call it
267
 * Create empty effect queue with no Bitmap.
274 268
 */
275
  public DistortedObject()
269
  public DistortedObject(int width, int height, int depth)
276 270
    {
277

  
271
    initializeData(width,height,depth);
278 272
    }
279 273

  
280 274
///////////////////////////////////////////////////////////////////////////////////////////////////
......
302 296
    mHalfX = dc.mHalfX;
303 297
    mHalfY = dc.mHalfY;
304 298
    mHalfZ = dc.mHalfZ;
305
    mGrid  = dc.mGrid;
306 299

  
307 300
    if( (flags & Distorted.CLONE_BITMAP) != 0 )
308 301
      {
......
331 324
 *        This gets passed on to Dynamics inside the Effects that are currently applied to the
332 325
 *        Object.
333 326
 */
334
  public void draw(long currTime)
327
  public void draw(long currTime, DistortedObjectGrid grid)
335 328
    {
336 329
    GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, 0);
337 330
    GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mTextureDataH[0]);
338
    drawPriv(currTime, Distorted.mFramebuffer);
331
    drawPriv(currTime, grid, Distorted.mFramebuffer);
339 332
    }
340 333

  
341 334
///////////////////////////////////////////////////////////////////////////////////////////////////
......
345 338
 * @param currTime Current time, in milliseconds.
346 339
 * @param df       Framebuffer to render this to.
347 340
 */
348
  public void draw(long currTime, DistortedFramebuffer df)
341
  public void draw(long currTime, DistortedObjectGrid grid, DistortedFramebuffer df)
349 342
    {
350 343
    df.setAsOutput();
351 344
    GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mTextureDataH[0]);
352
    drawPriv(currTime,df);
345
    drawPriv(currTime,grid, df);
353 346
    }
354 347

  
355 348
///////////////////////////////////////////////////////////////////////////////////////////////////
......
372 365
 * @param bmp The android.graphics.Bitmap object to apply effects to and display.
373 366
 */
374 367
   
375
  public void setBitmap(Bitmap bmp)
368
  public void setTexture(Bitmap bmp)
376 369
    {
377 370
    mBitmapSet[0] = true;
378 371

  
src/main/java/org/distorted/library/DistortedObjectGrid.java
25 25

  
26 26
///////////////////////////////////////////////////////////////////////////////////////////////////
27 27

  
28
abstract class DistortedObjectGrid
28
public abstract class DistortedObjectGrid
29 29
   {
30 30
   protected static final int BYTES_PER_FLOAT   = 4; //
31 31
   protected static final int POSITION_DATA_SIZE= 3; // Size of the position data in elements

Also available in: Unified diff