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/projection/ProjectionRenderer.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.DistortedBitmapGrid;
27
import org.distorted.library.DistortedObject;
27 28
import org.distorted.library.type.Static3D;
28 29
import org.distorted.library.type.Static4D;
29 30

  
......
39 40
class ProjectionRenderer implements GLSurfaceView.Renderer
40 41
{
41 42
   private GLSurfaceView mView;
42
   private DistortedBitmap mProjection;
43
   private DistortedObject mProjection;
44
   private DistortedBitmapGrid mGrid;
43 45

  
44 46
   private static float mF, mX, mY;
45 47
   private static int mWidth, mHeight;
......
83 85
   public void onDrawFrame(GL10 glUnused) 
84 86
      {
85 87
      GLES20.glClear( GLES20.GL_DEPTH_BUFFER_BIT | GLES20.GL_COLOR_BUFFER_BIT);
86
      mProjection.draw(System.currentTimeMillis());
88
      mProjection.draw(System.currentTimeMillis(), mGrid);
87 89
      }
88 90

  
89 91
///////////////////////////////////////////////////////////////////////////////////////////////////
......
118 120
    private void setupBitmap(int w, int h)
119 121
      {
120 122
      Paint paint = new Paint();
121
      mProjection = new DistortedBitmap(w,h, 50);
123
      mProjection = new DistortedObject(w,h,1);
124
      mGrid       = new DistortedBitmapGrid(50,50*h/w);
122 125
      Bitmap bmp = Bitmap.createBitmap(w,h, Bitmap.Config.ARGB_8888);
123 126
      Canvas bmpCanvas = new Canvas(bmp);
124 127

  
......
135 138
        bmpCanvas.drawRect(               0, h *i/NUMLINES -1,  w               ,  h*i/NUMLINES + 1, paint);
136 139
        }
137 140
        
138
      mProjection.setBitmap(bmp);
141
      mProjection.setTexture(bmp);
139 142
        
140 143
      int min = w<h ? w:h;
141 144
        

Also available in: Unified diff