Revision e8b6aa95
Added by Leszek Koltunski over 7 years ago
src/main/java/org/distorted/examples/effects3d/Effects3DRenderer.java | ||
---|---|---|
26 | 26 |
|
27 | 27 |
import org.distorted.examples.R; |
28 | 28 |
import org.distorted.library.Distorted; |
29 |
import org.distorted.library.DistortedBitmap; |
|
29 |
import org.distorted.library.DistortedBitmapGrid;
|
|
30 | 30 |
import org.distorted.library.DistortedObject; |
31 |
import org.distorted.library.DistortedObjectGrid; |
|
31 | 32 |
import org.distorted.library.EffectTypes; |
32 | 33 |
import org.distorted.library.type.Dynamic3D; |
33 | 34 |
import org.distorted.library.type.DynamicQuat; |
... | ... | |
46 | 47 |
{ |
47 | 48 |
private GLSurfaceView mView; |
48 | 49 |
private DistortedObject mObject; |
49 |
private DistortedBitmap mBackground; |
|
50 |
private DistortedBitmap mCenter; |
|
51 |
private DistortedBitmap mRegion; |
|
50 |
private DistortedObject mBackground; |
|
51 |
private DistortedObject mCenter; |
|
52 |
private DistortedObject mRegion; |
|
53 |
private DistortedBitmapGrid mQuad; |
|
54 |
private DistortedObjectGrid mGrid; |
|
52 | 55 |
private int mObjWidth, mObjHeight, mObjDepth; |
53 | 56 |
private DynamicQuat mQuatInt1, mQuatInt2; |
54 | 57 |
|
... | ... | |
68 | 71 |
{ |
69 | 72 |
mView = v; |
70 | 73 |
|
71 |
mObject = ((Effects3DActivity)v.getContext()).getObject(); |
|
72 |
mBackground = new DistortedBitmap(100, 100, 1); |
|
73 |
mCenter = new DistortedBitmap(100, 100, 1); |
|
74 |
mRegion = new DistortedBitmap(100, 100, 1); |
|
74 |
Effects3DActivity act = (Effects3DActivity)v.getContext(); |
|
75 |
|
|
76 |
mObject = act.getObject(); |
|
77 |
mGrid = act.getGrid(); |
|
78 |
mBackground = new DistortedObject(100, 100, 1); |
|
79 |
mCenter = new DistortedObject(100, 100, 1); |
|
80 |
mRegion = new DistortedObject(100, 100, 1); |
|
81 |
mQuad = new DistortedBitmapGrid(1,1); |
|
75 | 82 |
|
76 | 83 |
mObjWidth = mObject.getWidth(); |
77 | 84 |
mObjHeight= mObject.getHeight(); |
... | ... | |
123 | 130 |
|
124 | 131 |
long time = System.currentTimeMillis(); |
125 | 132 |
|
126 |
mBackground.draw(time); |
|
127 |
mObject.draw(time); |
|
133 |
mBackground.draw(time,mQuad);
|
|
134 |
mObject.draw(time,mGrid);
|
|
128 | 135 |
|
129 | 136 |
if( Effects3DActivity.supportsCenter() ) |
130 | 137 |
{ |
131 |
mCenter.draw(time); |
|
132 |
if( Effects3DActivity.supportsRegion() ) mRegion.draw(time); |
|
138 |
mCenter.draw(time, mQuad);
|
|
139 |
if( Effects3DActivity.supportsRegion() ) mRegion.draw(time, mQuad);
|
|
133 | 140 |
} |
134 | 141 |
} |
135 | 142 |
|
... | ... | |
234 | 241 |
catch(IOException e) { } |
235 | 242 |
} |
236 | 243 |
|
237 |
mObject.setBitmap( act.getBitmap() );
|
|
238 |
mBackground.setBitmap(bitmap1);
|
|
239 |
mCenter.setBitmap(bitmap2);
|
|
240 |
mRegion.setBitmap(bitmap3);
|
|
244 |
mObject.setTexture( act.getBitmap() );
|
|
245 |
mBackground.setTexture(bitmap1);
|
|
246 |
mCenter.setTexture(bitmap2);
|
|
247 |
mRegion.setTexture(bitmap3);
|
|
241 | 248 |
|
242 | 249 |
try |
243 | 250 |
{ |
Also available in: Unified diff
Major change in API: separate the GRID from DistortedObject; completely remove classes derived from DistortedObject.