Revision ebb06a48
Added by Leszek Koltunski almost 7 years ago
src/main/java/org/distorted/examples/deform/DeformRenderer.java | ||
---|---|---|
56 | 56 |
private DistortedEffects stretchEffects; |
57 | 57 |
private MeshObject stretchMesh; |
58 | 58 |
private DistortedScreen mScreen; |
59 |
private Static3D touchPoint;
|
|
59 |
private Static3D mTouchPoint;
|
|
60 | 60 |
|
61 | 61 |
private Static3D[] vDistort; |
62 | 62 |
private Static3D[] vDeform; |
... | ... | |
83 | 83 |
stretchEffects = new DistortedEffects(); |
84 | 84 |
mRegion = new Static4D(0,0,0,0); |
85 | 85 |
mMove = new Static3D(0,0,0); |
86 |
mTouchPoint= new Static3D(0,0,0); |
|
86 | 87 |
|
87 | 88 |
// DISTORT |
88 | 89 |
Dynamic3D releasedDistortDynamic = new Dynamic3D(NUM_VECTORS*500, 0.5f); |
... | ... | |
135 | 136 |
mScreen = new DistortedScreen(mView); |
136 | 137 |
mScreen.setDebug(DistortedScreen.DEBUG_FPS); |
137 | 138 |
|
138 |
mMovingDistort = new VertexEffectDistort(movingDistortDynamic, touchPoint, mRegion);
|
|
139 |
mMovingDeform = new VertexEffectDeform(movingDeformDynamic, touchPoint, mRegion);
|
|
140 |
mMovingShear = new MatrixEffectShear(movingShearDynamic, touchPoint);
|
|
141 |
mReleasedDistort = new VertexEffectDistort(releasedDistortDynamic, touchPoint, mRegion);
|
|
142 |
mReleasedDeform = new VertexEffectDeform(releasedDeformDynamic, touchPoint, mRegion);
|
|
143 |
mReleasedShear = new MatrixEffectShear(releasedShearDynamic, touchPoint);
|
|
139 |
mMovingDistort = new VertexEffectDistort(movingDistortDynamic, mTouchPoint, mRegion);
|
|
140 |
mMovingDeform = new VertexEffectDeform(movingDeformDynamic, mTouchPoint, mRegion);
|
|
141 |
mMovingShear = new MatrixEffectShear(movingShearDynamic, mTouchPoint);
|
|
142 |
mReleasedDistort = new VertexEffectDistort(releasedDistortDynamic, mTouchPoint, mRegion);
|
|
143 |
mReleasedDeform = new VertexEffectDeform(releasedDeformDynamic, mTouchPoint, mRegion);
|
|
144 |
mReleasedShear = new MatrixEffectShear(releasedShearDynamic, mTouchPoint);
|
|
144 | 145 |
|
145 | 146 |
stretchEffects.apply(new MatrixEffectMove(mMove)); |
146 | 147 |
} |
... | ... | |
198 | 199 |
stretchCanvas.drawRect( 0, h *i/NUM_LINES -1, w , h*i/NUM_LINES + 1, paint); |
199 | 200 |
} |
200 | 201 |
|
201 |
touchPoint= new Static3D(0,0,0); |
|
202 |
|
|
203 | 202 |
if( stretchTexture==null ) stretchTexture = new DistortedTexture(w,h); |
204 | 203 |
stretchTexture.setTexture(stretchBitmap); |
205 | 204 |
|
... | ... | |
240 | 239 |
if( yt<0 ) yt=0; |
241 | 240 |
if( yt>scrHeight/2 ) yt=scrHeight/2; |
242 | 241 |
|
243 |
touchPoint.set(xt,yt,0);
|
|
242 |
mTouchPoint.set(xt,yt,0);
|
|
244 | 243 |
|
245 | 244 |
switch(mMode) |
246 | 245 |
{ |
247 | 246 |
case DISTORT: vDistort[0].set(0,0,0); |
248 | 247 |
stretchEffects.apply(mMovingDistort); |
249 |
mLastEffect = mMovingDeform.getID();
|
|
248 |
mLastEffect = mMovingDistort.getID();
|
|
250 | 249 |
break; |
251 | 250 |
case DEFORM : vDeform[0].set(0,0,0); |
252 | 251 |
stretchEffects.apply(mMovingDeform); |
... | ... | |
289 | 288 |
vDistort[i].set( vDistort[i-1].getX()*damp, vDistort[i-1].getY()*damp ); |
290 | 289 |
} |
291 | 290 |
vDistort[NUM_VECTORS-1].set(0,0); |
291 |
//stretchEffects.abortEffect(mMovingDistort); |
|
292 | 292 |
stretchEffects.apply( mReleasedDistort); |
293 | 293 |
break; |
294 | 294 |
case DEFORM : for(int i=1; i<NUM_VECTORS-1; i++) |
... | ... | |
296 | 296 |
vDeform[i].set( vDeform[i-1].getX()*damp, vDeform[i-1].getY()*damp ); |
297 | 297 |
} |
298 | 298 |
vDeform[NUM_VECTORS-1].set(0,0); |
299 |
//stretchEffects.abortEffect( mMovingDeform); |
|
299 | 300 |
stretchEffects.apply( mReleasedDeform); |
300 | 301 |
break; |
301 | 302 |
case SHEAR : for(int i=1; i<NUM_VECTORS-1; i++) |
... | ... | |
303 | 304 |
vShear[i].set( vShear[i-1].getX()*damp, vShear[i-1].getY()*damp ); |
304 | 305 |
} |
305 | 306 |
vShear[NUM_VECTORS-1].set(0,0); |
307 |
|
|
308 |
//stretchEffects.abortEffect(mMovingShear); |
|
306 | 309 |
stretchEffects.apply(mReleasedShear); |
307 | 310 |
break; |
308 | 311 |
} |
Also available in: Unified diff
Bugfixes for the recent 'Effect classes' API change.