Revision fc6f1299
Added by Leszek Koltunski over 7 years ago
src/main/java/org/distorted/examples/multiblur/MultiblurActivity.java | ||
---|---|---|
39 | 39 |
super.onCreate(savedState); |
40 | 40 |
setContentView(R.layout.multiblurlayout); |
41 | 41 |
|
42 |
SeekBar bar = (SeekBar)findViewById(R.id.multiblurSeek); |
|
43 |
bar.setOnSeekBarChangeListener(this); |
|
44 |
bar.setProgress(50); |
|
42 |
SeekBar distanceBar = (SeekBar)findViewById(R.id.multiblurDistanceSeek); |
|
43 |
distanceBar.setOnSeekBarChangeListener(this); |
|
44 |
distanceBar.setProgress(50); |
|
45 |
SeekBar rangeBar = (SeekBar)findViewById(R.id.multiblurRangeSeek); |
|
46 |
rangeBar.setOnSeekBarChangeListener(this); |
|
47 |
rangeBar.setProgress(10); |
|
45 | 48 |
} |
46 | 49 |
|
47 | 50 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
79 | 82 |
{ |
80 | 83 |
switch (bar.getId()) |
81 | 84 |
{ |
82 |
case R.id.multiblurSeek: MultiblurSurfaceView view = (MultiblurSurfaceView) this.findViewById(R.id.multiblurSurfaceView); |
|
83 |
view.getRenderer().setDistance(progress); |
|
84 |
break; |
|
85 |
case R.id.multiblurDistanceSeek: MultiblurSurfaceView view1 = (MultiblurSurfaceView) this.findViewById(R.id.multiblurSurfaceView); |
|
86 |
view1.getRenderer().setDistance(progress); |
|
87 |
break; |
|
88 |
case R.id.multiblurRangeSeek : MultiblurSurfaceView view2 = (MultiblurSurfaceView) this.findViewById(R.id.multiblurSurfaceView); |
|
89 |
view2.getRenderer().setRange(progress); |
|
90 |
break; |
|
91 |
|
|
85 | 92 |
} |
86 | 93 |
} |
87 | 94 |
|
src/main/java/org/distorted/examples/multiblur/MultiblurRenderer.java | ||
---|---|---|
21 | 21 |
|
22 | 22 |
import android.graphics.Bitmap; |
23 | 23 |
import android.graphics.BitmapFactory; |
24 |
import android.opengl.GLES30; |
|
25 | 24 |
import android.opengl.GLSurfaceView; |
26 | 25 |
|
27 | 26 |
import org.distorted.examples.R; |
... | ... | |
32 | 31 |
import org.distorted.library.EffectNames; |
33 | 32 |
import org.distorted.library.EffectTypes; |
34 | 33 |
import org.distorted.library.MeshCubes; |
34 |
import org.distorted.library.type.Dynamic1D; |
|
35 | 35 |
import org.distorted.library.type.Dynamic3D; |
36 | 36 |
import org.distorted.library.type.DynamicQuat; |
37 | 37 |
import org.distorted.library.type.Static1D; |
... | ... | |
68 | 68 |
private DistortedEffects[] mEffects; |
69 | 69 |
private Static3D[] mMoveVector; |
70 | 70 |
private Dynamic3D[] mMoveDynamic; |
71 |
private Static1D mBlurVector; |
|
71 | 72 |
private DistortedScreen mScreen; |
72 | 73 |
private DynamicQuat mQuatInt1, mQuatInt2; |
73 | 74 |
private int mDistance; |
... | ... | |
95 | 96 |
mMoveDynamic[i].add(mMoveVector[i]); |
96 | 97 |
} |
97 | 98 |
|
98 |
mEffects[0].blur(new Static1D(10)); |
|
99 |
Dynamic1D blurDynamic= new Dynamic1D(); |
|
100 |
mBlurVector = new Static1D(10); |
|
101 |
blurDynamic.add(mBlurVector); |
|
102 |
|
|
103 |
mEffects[0].blur(blurDynamic); |
|
99 | 104 |
|
100 | 105 |
MeshCubes mesh = new MeshCubes(1,1,false); |
101 | 106 |
|
... | ... | |
208 | 213 |
computeMoveVectors(); |
209 | 214 |
android.util.Log.e("renderer", "distance: "+distance); |
210 | 215 |
} |
216 |
|
|
217 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
218 |
|
|
219 |
void setRange(int range) |
|
220 |
{ |
|
221 |
mBlurVector.set(range); |
|
222 |
android.util.Log.e("renderer", "range: "+range); |
|
223 |
} |
|
211 | 224 |
} |
src/main/res/layout/multiblurlayout.xml | ||
---|---|---|
20 | 20 |
android:paddingTop="10dp" > |
21 | 21 |
|
22 | 22 |
<SeekBar |
23 |
android:id="@+id/multiblurSeek" |
|
23 |
android:id="@+id/multiblurDistanceSeek"
|
|
24 | 24 |
android:layout_weight="1" |
25 | 25 |
android:layout_width="wrap_content" |
26 | 26 |
android:layout_height="wrap_content" |
27 |
android:paddingLeft="15dp" |
|
27 |
android:paddingLeft="10dp" |
|
28 |
android:paddingRight="10dp" /> |
|
29 |
|
|
30 |
<SeekBar |
|
31 |
android:id="@+id/multiblurRangeSeek" |
|
32 |
android:layout_weight="1" |
|
33 |
android:layout_width="wrap_content" |
|
34 |
android:layout_height="wrap_content" |
|
35 |
android:paddingLeft="10dp" |
|
28 | 36 |
android:paddingRight="10dp" /> |
29 | 37 |
|
30 | 38 |
</LinearLayout> |
Also available in: Unified diff
Improve the Multiblur app. Things seem to work now!