Revision 01cef452
Added by Leszek Koltunski about 5 years ago
src/main/java/org/distorted/examples/movingeffects/MovingEffectsSurfaceView.java | ||
---|---|---|
32 | 32 |
import org.distorted.library.effect.EffectType; |
33 | 33 |
import org.distorted.library.effect.FragmentEffectAlpha; |
34 | 34 |
import org.distorted.library.effect.FragmentEffectChroma; |
35 |
import org.distorted.library.effect.VertexEffectDistort;
|
|
35 |
import org.distorted.library.effect.VertexEffectDeform;
|
|
36 | 36 |
import org.distorted.library.effect.VertexEffectSink; |
37 | 37 |
import org.distorted.library.effect.VertexEffectSwirl; |
38 | 38 |
import org.distorted.library.main.DistortedEffects; |
... | ... | |
68 | 68 |
|
69 | 69 |
private int mCurrEffect; |
70 | 70 |
private int mSize1, mSize2; |
71 |
private Static3D mDistort;
|
|
71 |
private Static3D mDeform;
|
|
72 | 72 |
|
73 | 73 |
private MovingEffectsRenderer mRenderer; |
74 | 74 |
|
75 |
private VertexEffectDistort mEffectDistort;
|
|
75 |
private VertexEffectDeform mEffectDeform;
|
|
76 | 76 |
private VertexEffectSink mEffectSink; |
77 | 77 |
private VertexEffectSwirl mEffectSwirl; |
78 | 78 |
private FragmentEffectChroma mEffectChroma; |
... | ... | |
92 | 92 |
mCenter = new Dynamic3D(LOOP_TIME,0.0f); |
93 | 93 |
mRegionFragment = new Static3D(0,0,0); |
94 | 94 |
mRegionVertex = new Static4D(0,0,0,0); |
95 |
mDistort = new Static3D(0,0,0);
|
|
95 |
mDeform = new Static3D(0,0,0);
|
|
96 | 96 |
|
97 | 97 |
if(!isInEditMode()) |
98 | 98 |
{ |
... | ... | |
105 | 105 |
setEGLContextClientVersion( (configurationInfo.reqGlEsVersion>>16) >= 3 ? 3:2 ); |
106 | 106 |
setRenderer(mRenderer); |
107 | 107 |
|
108 |
mEffectDistort = new VertexEffectDistort ( mDistort , mCenter, mRegionVertex);
|
|
108 |
mEffectDeform = new VertexEffectDeform ( mDeform , mCenter, mRegionVertex);
|
|
109 | 109 |
mEffectSink = new VertexEffectSink (new Static1D(10) , mCenter, mRegionVertex); |
110 | 110 |
mEffectSwirl = new VertexEffectSwirl (new Static1D(30) , mCenter, mRegionVertex); |
111 | 111 |
mEffectAlpha = new FragmentEffectAlpha (new Static1D(0.5f), mCenter, mRegionFragment, true); |
... | ... | |
127 | 127 |
|
128 | 128 |
mRegionVertex.set(0,0,0,rad); |
129 | 129 |
mRegionFragment.set(rad,rad,rad); |
130 |
mDistort.set3(max/10);
|
|
130 |
mDeform.set3(max/7);
|
|
131 | 131 |
} |
132 | 132 |
|
133 | 133 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
148 | 148 |
DistortedEffects q = mRenderer.getEffects(); |
149 | 149 |
q.abortByType(EffectType.VERTEX); |
150 | 150 |
q.abortByType(EffectType.FRAGMENT); |
151 |
q.apply(mEffectDistort);
|
|
151 |
q.apply(mEffectDeform);
|
|
152 | 152 |
mCurrEffect = EFFECT_BUBBLE; |
153 | 153 |
} |
154 | 154 |
} |
... | ... | |
291 | 291 |
gx = dv.get1(); |
292 | 292 |
gy = dv.get2(); |
293 | 293 |
|
294 |
float Z = mDistort.get3()/10;
|
|
294 |
float Z = mDeform.get3()/7;
|
|
295 | 295 |
|
296 | 296 |
if( (xDown-gx)*(xDown-gx) + (yDown-gy)*(yDown-gy) < Z*Z ) |
297 | 297 |
{ |
Also available in: Unified diff
Change Distort to Deform in two apps - looks better.