Revision ebb06a48
Added by Leszek Koltunski over 7 years ago
src/main/java/org/distorted/examples/check/CheckRenderer.java | ||
---|---|---|
66 | 66 |
private MeshFlat mMesh; |
67 | 67 |
private DistortedScreen mScreen; |
68 | 68 |
private int mObjHeight, mObjWidth; |
69 |
private Static3D mMove, mScale; |
|
69 |
private Static3D mMove, mScale, mCenter;
|
|
70 | 70 |
private Static3D mSwirl1, mSwirl2, mDeform1, mDeform2; |
71 | 71 |
|
72 | 72 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
87 | 87 |
mSwirl2 = new Static3D(0,0,0); |
88 | 88 |
mDeform1= new Static3D(0,0,0); |
89 | 89 |
mDeform2= new Static3D(0,0,0); |
90 |
mMove = new Static3D(0,0,0); |
|
91 |
mScale = new Static3D(1,1,1); |
|
92 |
mCenter = new Static3D(0,0,0); |
|
90 | 93 |
|
91 |
mMove = new Static3D(0,0,0); |
|
92 |
mScale= new Static3D(1,1,1); |
|
93 | 94 |
mEffects = new DistortedEffects(); |
94 | 95 |
mEffects.apply(new MatrixEffectMove(mMove)); |
95 | 96 |
mEffects.apply(new MatrixEffectScale(mScale)); |
... | ... | |
113 | 114 |
dDeform.add(mDeform1); |
114 | 115 |
dDeform.add(mDeform2); |
115 | 116 |
|
116 |
if( !mEffects.apply( new VertexEffectDeform(dDeform, new Static3D(mObjWidth/2,0,0)) ) )
|
|
117 |
if( !mEffects.apply( new VertexEffectDeform(dDeform,mCenter) ) )
|
|
117 | 118 |
{ |
118 | 119 |
Log.e("Check", "Failed to add Deform effect!"); |
119 | 120 |
} |
... | ... | |
192 | 193 |
mScreen.detachAll(); |
193 | 194 |
mScreen.attach(mTexture,mEffects,mMesh); |
194 | 195 |
|
195 |
mSwirl1.set ( 0, mObjHeight/2, 0); |
|
196 |
mSwirl2.set (mObjWidth, mObjHeight/2, 0); |
|
197 |
mDeform1.set( 0, 0 , 0); |
|
198 |
mDeform2.set( 0,-mObjHeight , 0); |
|
196 |
mSwirl1.set ( 0, mObjHeight/2, 0); |
|
197 |
mSwirl2.set (mObjWidth , mObjHeight/2, 0); |
|
198 |
mDeform1.set( 0, 0 , 0); |
|
199 |
mDeform2.set( 0,-mObjHeight , 0); |
|
200 |
mCenter.set (mObjWidth/2, 0 , 0); |
|
199 | 201 |
|
200 | 202 |
try |
201 | 203 |
{ |
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 |
} |
src/main/java/org/distorted/examples/glow/GlowRenderer.java | ||
---|---|---|
106 | 106 |
root.attach(node); |
107 | 107 |
} |
108 | 108 |
|
109 |
makeGlow(0); |
|
110 |
|
|
111 |
mScreen = new DistortedScreen(mView); |
|
112 |
mScreen.attach(root); |
|
113 |
|
|
114 | 109 |
mMove = new Static3D(0,0,0); |
115 | 110 |
mScale= new Static3D(1,1,1); |
116 | 111 |
|
... | ... | |
140 | 135 |
|
141 | 136 |
mGlow[leaf] = new PostprocessEffectGlow(radius,color); |
142 | 137 |
} |
138 |
|
|
139 |
makeGlow(0); |
|
140 |
|
|
141 |
mScreen = new DistortedScreen(mView); |
|
142 |
mScreen.attach(root); |
|
143 | 143 |
} |
144 | 144 |
|
145 | 145 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/examples/projection/ProjectionRenderer.java | ||
---|---|---|
103 | 103 |
public void onSurfaceChanged(GL10 glUnused, int width, int height) |
104 | 104 |
{ |
105 | 105 |
mScreen.setProjection(mF,mNear); |
106 |
mEffects.abortAllEffects(); |
|
107 | 106 |
|
108 | 107 |
Paint paint = new Paint(); |
109 | 108 |
Bitmap bmp = Bitmap.createBitmap(width,height, Bitmap.Config.ARGB_8888); |
Also available in: Unified diff
Bugfixes for the recent 'Effect classes' API change.