Revision e8b6aa95
Added by Leszek Koltunski over 7 years ago
src/main/java/org/distorted/examples/bean/BeanRenderer.java | ||
---|---|---|
29 | 29 |
|
30 | 30 |
import org.distorted.library.EffectTypes; |
31 | 31 |
import org.distorted.library.Distorted; |
32 |
import org.distorted.library.DistortedBitmap; |
|
32 |
import org.distorted.library.DistortedObject; |
|
33 |
import org.distorted.library.DistortedBitmapGrid; |
|
33 | 34 |
import org.distorted.library.type.Dynamic3D; |
34 | 35 |
import org.distorted.library.type.Static3D; |
35 | 36 |
import org.distorted.library.type.Static4D; |
... | ... | |
44 | 45 |
class BeanRenderer implements GLSurfaceView.Renderer |
45 | 46 |
{ |
46 | 47 |
private GLSurfaceView mView; |
47 |
private DistortedBitmap mBean; |
|
48 |
private DistortedObject mBean; |
|
49 |
private DistortedBitmapGrid mGrid; |
|
48 | 50 |
private Static3D pLeft, pRight; |
49 | 51 |
private Dynamic3D dLeft, dRight; |
50 | 52 |
private Static4D rLeft, rRight; |
... | ... | |
88 | 90 |
public void onDrawFrame(GL10 glUnused) |
89 | 91 |
{ |
90 | 92 |
GLES20.glClear( GLES20.GL_DEPTH_BUFFER_BIT | GLES20.GL_COLOR_BUFFER_BIT); |
91 |
mBean.draw(System.currentTimeMillis()); |
|
93 |
mBean.draw(System.currentTimeMillis(), mGrid);
|
|
92 | 94 |
} |
93 | 95 |
|
94 | 96 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
142 | 144 |
bmpHeight = bitmap.getHeight(); |
143 | 145 |
bmpWidth = bitmap.getWidth(); |
144 | 146 |
|
145 |
mBean = new DistortedBitmap(bitmap, 25); |
|
147 |
mBean = new DistortedObject(bmpWidth, bmpHeight, 1); |
|
148 |
mBean.setTexture(bitmap); |
|
146 | 149 |
mBean.distort(dLeft , pLeft , rLeft ); |
147 | 150 |
mBean.distort(dRight, pRight, rRight); |
148 |
|
|
151 |
|
|
152 |
mGrid = new DistortedBitmapGrid(25,25*bmpHeight/bmpWidth); |
|
153 |
|
|
149 | 154 |
try |
150 | 155 |
{ |
151 | 156 |
Distorted.onSurfaceCreated(mView.getContext()); |
Also available in: Unified diff
Major change in API: separate the GRID from DistortedObject; completely remove classes derived from DistortedObject.