Revision f6d884d5
Added by Leszek Koltunski over 7 years ago
src/main/java/org/distorted/examples/movingeffects/MovingEffectsSurfaceView.java | ||
---|---|---|
24 | 24 |
import android.graphics.Paint; |
25 | 25 |
import android.graphics.Paint.Style; |
26 | 26 |
import android.opengl.GLSurfaceView; |
27 |
import android.os.Build; |
|
28 | 27 |
import android.view.MotionEvent; |
29 | 28 |
import android.util.AttributeSet; |
30 | 29 |
|
30 |
import org.distorted.library.DistortedEffectQueues; |
|
31 | 31 |
import org.distorted.library.EffectTypes; |
32 |
import org.distorted.library.type.Dynamic2D; |
|
33 | 32 |
import org.distorted.library.type.Dynamic3D; |
34 | 33 |
import org.distorted.library.type.Dynamic4D; |
35 | 34 |
import org.distorted.library.type.Static1D; |
... | ... | |
65 | 64 |
private int mSize1, mSize2, mSizeR; |
66 | 65 |
private int mMax; |
67 | 66 |
|
67 |
private MovingEffectsRenderer mRenderer; |
|
68 |
|
|
68 | 69 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
69 | 70 |
|
70 | 71 |
public MovingEffectsSurfaceView(Context c, AttributeSet attrs) |
... | ... | |
79 | 80 |
di3D = new Dynamic3D(LOOP_TIME,0.0f); |
80 | 81 |
mRegion = new Dynamic4D(LOOP_TIME,0.0f); |
81 | 82 |
|
83 |
mRenderer = new MovingEffectsRenderer(this); |
|
84 |
|
|
82 | 85 |
if(!isInEditMode()) |
83 | 86 |
{ |
84 | 87 |
setFocusable(true); |
85 | 88 |
setFocusableInTouchMode(true); |
86 | 89 |
setEGLContextClientVersion(2); |
87 |
setRenderer(new MovingEffectsRenderer(this));
|
|
90 |
setRenderer(mRenderer);
|
|
88 | 91 |
} |
89 | 92 |
} |
90 | 93 |
|
... | ... | |
116 | 119 |
|
117 | 120 |
synchronized(lock) |
118 | 121 |
{ |
119 |
MovingEffectsRenderer.mBackground.abortEffects(EffectTypes.VERTEX); |
|
120 |
MovingEffectsRenderer.mBackground.abortEffects(EffectTypes.FRAGMENT); |
|
121 |
MovingEffectsRenderer.mBackground.distort( new Static3D(0,0,mMax/10) , di3D, dr); |
|
122 |
DistortedEffectQueues q = mRenderer.getQueues(); |
|
123 |
q.abortEffects(EffectTypes.VERTEX); |
|
124 |
q.abortEffects(EffectTypes.FRAGMENT); |
|
125 |
q.distort( new Static3D(0,0,mMax/10) , di3D, dr); |
|
122 | 126 |
mCurrEffect = EFFECT_BUBBLE; |
123 | 127 |
} |
124 | 128 |
} |
... | ... | |
131 | 135 |
|
132 | 136 |
synchronized(lock) |
133 | 137 |
{ |
134 |
MovingEffectsRenderer.mBackground.abortEffects(EffectTypes.VERTEX); |
|
135 |
MovingEffectsRenderer.mBackground.abortEffects(EffectTypes.FRAGMENT); |
|
136 |
MovingEffectsRenderer.mBackground.sink(new Static1D(10), di3D, dr); |
|
138 |
DistortedEffectQueues q = mRenderer.getQueues(); |
|
139 |
q.abortEffects(EffectTypes.VERTEX); |
|
140 |
q.abortEffects(EffectTypes.FRAGMENT); |
|
141 |
q.sink(new Static1D(10), di3D, dr); |
|
137 | 142 |
mCurrEffect = EFFECT_SINK; |
138 | 143 |
} |
139 | 144 |
} |
... | ... | |
146 | 151 |
|
147 | 152 |
synchronized(lock) |
148 | 153 |
{ |
149 |
MovingEffectsRenderer.mBackground.abortEffects(EffectTypes.VERTEX); |
|
150 |
MovingEffectsRenderer.mBackground.abortEffects(EffectTypes.FRAGMENT); |
|
151 |
MovingEffectsRenderer.mBackground.chroma(new Static1D(0.5f), new Static3D(1,0,0), mRegion, true); |
|
154 |
DistortedEffectQueues q = mRenderer.getQueues(); |
|
155 |
q.abortEffects(EffectTypes.VERTEX); |
|
156 |
q.abortEffects(EffectTypes.FRAGMENT); |
|
157 |
q.chroma(new Static1D(0.5f), new Static3D(1,0,0), mRegion, true); |
|
152 | 158 |
mCurrEffect = EFFECT_CHROMA; |
153 | 159 |
} |
154 | 160 |
} |
... | ... | |
161 | 167 |
|
162 | 168 |
synchronized(lock) |
163 | 169 |
{ |
164 |
MovingEffectsRenderer.mBackground.abortEffects(EffectTypes.VERTEX); |
|
165 |
MovingEffectsRenderer.mBackground.abortEffects(EffectTypes.FRAGMENT); |
|
166 |
MovingEffectsRenderer.mBackground.alpha(new Static1D(0.5f), mRegion, true); |
|
170 |
DistortedEffectQueues q = mRenderer.getQueues(); |
|
171 |
q.abortEffects(EffectTypes.VERTEX); |
|
172 |
q.abortEffects(EffectTypes.FRAGMENT); |
|
173 |
q.alpha(new Static1D(0.5f), mRegion, true); |
|
167 | 174 |
mCurrEffect = EFFECT_TRANS; |
168 | 175 |
} |
169 | 176 |
} |
... | ... | |
176 | 183 |
|
177 | 184 |
synchronized(lock) |
178 | 185 |
{ |
179 |
MovingEffectsRenderer.mBackground.abortEffects(EffectTypes.VERTEX); |
|
180 |
MovingEffectsRenderer.mBackground.abortEffects(EffectTypes.FRAGMENT); |
|
181 |
MovingEffectsRenderer.mBackground.swirl( new Static1D(30), di3D, dr); |
|
186 |
DistortedEffectQueues q = mRenderer.getQueues(); |
|
187 |
q.abortEffects(EffectTypes.VERTEX); |
|
188 |
q.abortEffects(EffectTypes.FRAGMENT); |
|
189 |
q.swirl( new Static1D(30), di3D, dr); |
|
182 | 190 |
mCurrEffect = EFFECT_SWIRL; |
183 | 191 |
} |
184 | 192 |
} |
... | ... | |
189 | 197 |
{ |
190 | 198 |
synchronized(lock) |
191 | 199 |
{ |
192 |
MovingEffectsRenderer.mBackground.abortEffects(EffectTypes.VERTEX); |
|
193 |
MovingEffectsRenderer.mBackground.abortEffects(EffectTypes.FRAGMENT); |
|
200 |
DistortedEffectQueues q = mRenderer.getQueues(); |
|
201 |
q.abortEffects(EffectTypes.VERTEX); |
|
202 |
q.abortEffects(EffectTypes.FRAGMENT); |
|
194 | 203 |
di3D.removeAll(); |
195 | 204 |
mRegion.removeAll(); |
196 | 205 |
mCurrEffect = EFFECT_POINTS; |
Also available in: Unified diff
Complete the split DistortedObject -> (DistortedTexture,DistortedEffectQueue)