Revision 678c391d
Added by Leszek Koltunski over 4 years ago
src/main/java/org/distorted/examples/blur/BlurRenderer.java | ||
---|---|---|
24 | 24 |
import android.opengl.GLSurfaceView; |
25 | 25 |
|
26 | 26 |
import org.distorted.examples.R; |
27 |
import org.distorted.library.effect.MatrixEffectMove; |
|
28 | 27 |
import org.distorted.library.effect.MatrixEffectScale; |
29 | 28 |
import org.distorted.library.effect.PostprocessEffectBlur; |
30 | 29 |
import org.distorted.library.main.DistortedLibrary; |
... | ... | |
34 | 33 |
import org.distorted.library.main.DistortedScreen; |
35 | 34 |
import org.distorted.library.main.DistortedTexture; |
36 | 35 |
import org.distorted.library.mesh.MeshRectangles; |
37 |
import org.distorted.library.type.Dynamic1D;
|
|
38 |
import org.distorted.library.type.Static1D;
|
|
36 |
import org.distorted.library.type.Dynamic2D;
|
|
37 |
import org.distorted.library.type.Static2D;
|
|
39 | 38 |
import org.distorted.library.type.Static3D; |
40 | 39 |
|
41 | 40 |
import java.io.IOException; |
... | ... | |
56 | 55 |
private DistortedScreen mScreen; |
57 | 56 |
private DistortedFramebuffer mBuffer; |
58 | 57 |
private MeshRectangles mMesh, mMeshBuffer; |
59 |
private Static1D mRadiusSta;
|
|
58 |
private Static2D mHaloRadiusSta;
|
|
60 | 59 |
private int mObjHeight, mObjWidth; |
61 | 60 |
private Static3D mScale, mBufferScale; |
62 | 61 |
|
... | ... | |
70 | 69 |
mScreen = new DistortedScreen(); |
71 | 70 |
mBuffer = new DistortedFramebuffer(SIZE,SIZE,1, DistortedFramebuffer.NO_DEPTH_NO_STENCIL); |
72 | 71 |
|
73 |
mRadiusSta = new Static1D(5);
|
|
74 |
Dynamic1D radiusDyn = new Dynamic1D();
|
|
75 |
radiusDyn.add(mRadiusSta);
|
|
72 |
mHaloRadiusSta = new Static2D(10,5);
|
|
73 |
Dynamic2D haloAndRadiusDyn = new Dynamic2D();
|
|
74 |
haloAndRadiusDyn.add(mHaloRadiusSta);
|
|
76 | 75 |
|
77 | 76 |
mScale= new Static3D(1,1,1); |
78 | 77 |
mBufferScale= new Static3D(1,1,1); |
... | ... | |
81 | 80 |
mBufferEffects.apply(new MatrixEffectScale(mBufferScale)); |
82 | 81 |
|
83 | 82 |
mEffects = new DistortedEffects(); |
84 |
mEffects.apply( new PostprocessEffectBlur(radiusDyn) );
|
|
83 |
mEffects.apply( new PostprocessEffectBlur(haloAndRadiusDyn) );
|
|
85 | 84 |
mEffects.apply(new MatrixEffectScale(mScale)); |
86 | 85 |
} |
87 | 86 |
|
... | ... | |
90 | 89 |
int setBlur(int blur) |
91 | 90 |
{ |
92 | 91 |
int radius = blur/2; |
93 |
mRadiusSta.set(radius);
|
|
92 |
mHaloRadiusSta.set1(radius);
|
|
94 | 93 |
return radius; |
95 | 94 |
} |
96 | 95 |
|
src/main/java/org/distorted/examples/generic/GenericEffect.java | ||
---|---|---|
141 | 141 |
case CONTRAST : effect = new FragmentEffectContrast (mDyn1, mCenterDyn, mRegion3Dyn, false); break; |
142 | 142 |
case SMOOTH_CONTRAST : effect = new FragmentEffectContrast (mDyn1, mCenterDyn, mRegion3Dyn, true ); break; |
143 | 143 |
|
144 |
case BLUR : effect = new PostprocessEffectBlur (mDyn1 ); break;
|
|
145 |
case GLOW : effect = new PostprocessEffectGlow (mDyn1, mDyn4); break;
|
|
144 |
case BLUR : effect = new PostprocessEffectBlur (mDyn2 ); break;
|
|
145 |
case GLOW : effect = new PostprocessEffectGlow (mDyn2,mDyn4); break;
|
|
146 | 146 |
} |
147 | 147 |
|
148 | 148 |
if( effect!=null ) |
... | ... | |
264 | 264 |
// POSTPROCESS |
265 | 265 |
/////////////////////////////////////////////////////////////////////////////////////// |
266 | 266 |
|
267 |
case BLUR : mSta1.set(mInter[0]/2.0f); |
|
267 |
case BLUR : mSta2.set(mInter[0]/2.0f, |
|
268 |
mInter[1]/2.0f); |
|
268 | 269 |
break; |
269 |
case GLOW : mSta1.set(mInter[0]/2.0f);
|
|
270 |
mSta4.set(mInter[1]/100.0f,
|
|
271 |
mInter[2]/100.0f,
|
|
270 |
case GLOW : mSta2.set(mInter[0]/2.0f,
|
|
271 |
mInter[1]/2.0f);
|
|
272 |
mSta4.set(mInter[2]/100.0f,
|
|
272 | 273 |
mInter[3]/100.0f, |
273 |
mInter[4]/100.0f ); |
|
274 |
mInter[4]/100.0f, |
|
275 |
mInter[5]/100.0f ); |
|
274 | 276 |
break; |
275 | 277 |
} |
276 | 278 |
} |
... | ... | |
281 | 283 |
{ |
282 | 284 |
switch(mDimension) |
283 | 285 |
{ |
286 |
case 6: mInter[5] = 50; |
|
284 | 287 |
case 5: mInter[4] = 50; |
285 | 288 |
case 4: mInter[3] = 50; |
286 | 289 |
case 3: mInter[2] = 50; |
... | ... | |
531 | 534 |
mDyn1.add(mSta1); |
532 | 535 |
} |
533 | 536 |
break; |
537 |
case 6 : mDyn2 = new Dynamic2D(); |
|
538 |
mSta2 = new Static2D(0,0); |
|
539 |
mDyn2.add(mSta2); |
|
540 |
mDyn4 = new Dynamic4D(); |
|
541 |
mSta4 = new Static4D(0,0,0,0); |
|
542 |
mDyn4.add(mSta4); |
|
543 |
break; |
|
534 | 544 |
default: throw new RuntimeException("unsupported effect"); |
535 | 545 |
} |
536 | 546 |
|
... | ... | |
618 | 628 |
mSeekID[4] = seek[4].getId(); |
619 | 629 |
mButton = mEffect.findViewById(R.id.button5dRemove); |
620 | 630 |
break; |
631 |
case 6 : mEffect = act.getLayoutInflater().inflate(R.layout.effect6d, null); |
|
632 |
mText = mEffect.findViewById(R.id.effect6dText); |
|
633 |
seek[0] = mEffect.findViewById(R.id.effect6dbar1); |
|
634 |
seek[1] = mEffect.findViewById(R.id.effect6dbar2); |
|
635 |
seek[2] = mEffect.findViewById(R.id.effect6dbar3); |
|
636 |
seek[3] = mEffect.findViewById(R.id.effect6dbar4); |
|
637 |
seek[4] = mEffect.findViewById(R.id.effect6dbar5); |
|
638 |
seek[5] = mEffect.findViewById(R.id.effect6dbar6); |
|
639 |
mSeekID[0] = seek[0].getId(); |
|
640 |
mSeekID[1] = seek[1].getId(); |
|
641 |
mSeekID[2] = seek[2].getId(); |
|
642 |
mSeekID[3] = seek[3].getId(); |
|
643 |
mSeekID[4] = seek[4].getId(); |
|
644 |
mSeekID[5] = seek[5].getId(); |
|
645 |
mButton = mEffect.findViewById(R.id.button6dRemove); |
|
646 |
break; |
|
621 | 647 |
default: android.util.Log.e("GenericEffect", "dimension "+mDimension+" not supported!"); |
622 | 648 |
return null; |
623 | 649 |
} |
... | ... | |
743 | 769 |
boolean regionChanged=false; |
744 | 770 |
boolean centerChanged=false; |
745 | 771 |
|
746 |
for(int dim=0; dim<5; dim++)
|
|
772 |
for(int dim=0; dim<6; dim++)
|
|
747 | 773 |
{ |
748 | 774 |
if ( mDimension>dim && bar.getId()==mSeekID[dim] ) |
749 | 775 |
{ |
src/main/java/org/distorted/examples/glow/GlowRenderer.java | ||
---|---|---|
32 | 32 |
import org.distorted.library.main.DistortedScreen; |
33 | 33 |
import org.distorted.library.main.DistortedTexture; |
34 | 34 |
import org.distorted.library.mesh.MeshQuad; |
35 |
import org.distorted.library.type.Static1D;
|
|
35 |
import org.distorted.library.type.Static2D;
|
|
36 | 36 |
import org.distorted.library.type.Static3D; |
37 | 37 |
import org.distorted.library.type.Static4D; |
38 | 38 |
|
... | ... | |
47 | 47 |
class GlowRenderer implements GLSurfaceView.Renderer |
48 | 48 |
{ |
49 | 49 |
private static final int LEAF_SIZE = 100; |
50 |
private static final float HALO_TO_RADIUS = 0.2f; |
|
50 | 51 |
|
51 | 52 |
private GLSurfaceView mView; |
52 | 53 |
private DistortedTexture mLeaf; |
... | ... | |
54 | 55 |
private PostprocessEffectGlow mGlow; |
55 | 56 |
private int mRootW, mRootH; |
56 | 57 |
private Static3D mScale; |
57 |
private Static1D mRadius;
|
|
58 |
private Static2D mHaloRadius;
|
|
58 | 59 |
private Static4D mColor; |
59 | 60 |
|
60 | 61 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
63 | 64 |
{ |
64 | 65 |
mView = v; |
65 | 66 |
|
66 |
mRootW = LEAF_SIZE; |
|
67 |
mRootH = LEAF_SIZE; |
|
68 |
mLeaf = new DistortedTexture(); |
|
69 |
mScale = new Static3D(1,1,1); |
|
70 |
mRadius= new Static1D(25);
|
|
71 |
mColor = new Static4D(1.0f,0.0f,0.0f,0.5f); // half-transparent red |
|
67 |
mRootW = LEAF_SIZE;
|
|
68 |
mRootH = LEAF_SIZE;
|
|
69 |
mLeaf = new DistortedTexture();
|
|
70 |
mScale = new Static3D(1,1,1);
|
|
71 |
mHaloRadius= new Static2D(25*HALO_TO_RADIUS,25);
|
|
72 |
mColor = new Static4D(1.0f,0.0f,0.0f,0.5f); // half-transparent red
|
|
72 | 73 |
|
73 |
mGlow = new PostprocessEffectGlow(mRadius,mColor); |
|
74 |
mGlow = new PostprocessEffectGlow(mHaloRadius,mColor);
|
|
74 | 75 |
|
75 | 76 |
DistortedEffects effects = new DistortedEffects(); |
76 | 77 |
effects.apply(new MatrixEffectScale(mScale)); |
... | ... | |
97 | 98 |
int setGlowRadius(int glow) |
98 | 99 |
{ |
99 | 100 |
int radius = glow/2; |
100 |
mRadius.set(radius);
|
|
101 |
mHaloRadius.set(radius*HALO_TO_RADIUS,radius);
|
|
101 | 102 |
return radius; |
102 | 103 |
} |
103 | 104 |
|
src/main/java/org/distorted/examples/movingglow/MovingGlowRenderer.java | ||
---|---|---|
37 | 37 |
import org.distorted.library.mesh.MeshQuad; |
38 | 38 |
import org.distorted.library.message.EffectListener; |
39 | 39 |
import org.distorted.library.type.Dynamic1D; |
40 |
import org.distorted.library.type.Dynamic2D; |
|
40 | 41 |
import org.distorted.library.type.Dynamic4D; |
41 | 42 |
import org.distorted.library.type.Static1D; |
43 |
import org.distorted.library.type.Static2D; |
|
42 | 44 |
import org.distorted.library.type.Static3D; |
43 | 45 |
import org.distorted.library.type.Static4D; |
44 | 46 |
|
... | ... | |
106 | 108 |
root.attach(node); |
107 | 109 |
} |
108 | 110 |
|
109 |
Dynamic1D radiusDyn = new Dynamic1D(FLASH_TIME,1.0f);
|
|
110 |
radiusDyn.add(new Static1D( 0));
|
|
111 |
radiusDyn.add(new Static1D(70));
|
|
111 |
Dynamic2D haloAndRadiusDyn = new Dynamic2D(FLASH_TIME,1.0f);
|
|
112 |
haloAndRadiusDyn.add(new Static2D( 0, 0));
|
|
113 |
haloAndRadiusDyn.add(new Static2D(70,50));
|
|
112 | 114 |
|
113 | 115 |
for(int leaf=0; leaf<NUM_LEAVES; leaf++) |
114 | 116 |
{ |
... | ... | |
118 | 120 |
color.add(P1); |
119 | 121 |
color.add(P2); |
120 | 122 |
|
121 |
mGlow[leaf] = new PostprocessEffectGlow(radiusDyn,color);
|
|
123 |
mGlow[leaf] = new PostprocessEffectGlow(haloAndRadiusDyn,color);
|
|
122 | 124 |
} |
123 | 125 |
|
124 | 126 |
makeGlow(0); |
... | ... | |
161 | 163 |
{ |
162 | 164 |
float qw = (float)width ; |
163 | 165 |
float qh = (float)height; |
164 |
float factor = 0.9f* (qw<qh ? qw:qh);
|
|
166 |
float factor = 0.9f* (Math.min(qw, qh));
|
|
165 | 167 |
|
166 | 168 |
mScale.set( factor,factor,factor ); |
167 | 169 |
mScreen.resize(width, height); |
src/main/java/org/distorted/examples/multiblur/MultiblurRenderer.java | ||
---|---|---|
35 | 35 |
import org.distorted.library.main.DistortedTexture; |
36 | 36 |
import org.distorted.library.effect.EffectQuality; |
37 | 37 |
import org.distorted.library.mesh.MeshCubes; |
38 |
import org.distorted.library.type.Static1D;
|
|
38 |
import org.distorted.library.type.Static2D;
|
|
39 | 39 |
import org.distorted.library.type.Static3D; |
40 | 40 |
import org.distorted.library.type.Static4D; |
41 | 41 |
|
... | ... | |
68 | 68 |
private DistortedTexture mTex1, mTex2; |
69 | 69 |
private DistortedNode[] mNode; |
70 | 70 |
private Static3D[] mMoveVector; |
71 |
private Static1D mBlurVector;
|
|
71 |
private Static2D mBlurHaloRadius;
|
|
72 | 72 |
private DistortedScreen mScreen; |
73 | 73 |
private PostprocessEffectBlur mBlur; |
74 | 74 |
private int mDistance; |
... | ... | |
98 | 98 |
mBlurStatus[i] = false; |
99 | 99 |
} |
100 | 100 |
|
101 |
mBlurVector = new Static1D(10);
|
|
101 |
mBlurHaloRadius = new Static2D(10,2);
|
|
102 | 102 |
|
103 | 103 |
MeshCubes mesh = new MeshCubes(1,1,1); |
104 | 104 |
mesh.setStretch(OBJ_SIZE,OBJ_SIZE,OBJ_SIZE); |
... | ... | |
118 | 118 |
mScreen.attach(mNode[i]); |
119 | 119 |
} |
120 | 120 |
|
121 |
mBlur = new PostprocessEffectBlur(mBlurVector);
|
|
121 |
mBlur = new PostprocessEffectBlur(mBlurHaloRadius);
|
|
122 | 122 |
mBlurStatus[0] = true; |
123 | 123 |
effects[0].apply(mBlur); |
124 | 124 |
|
... | ... | |
163 | 163 |
|
164 | 164 |
public void onSurfaceChanged(GL10 glUnused, int width, int height) |
165 | 165 |
{ |
166 |
mScreenMin = width<height ? width:height;
|
|
166 |
mScreenMin = Math.min(width, height);
|
|
167 | 167 |
float factor= 0.15f*mScreenMin/OBJ_SIZE; |
168 | 168 |
mScale.set(factor,factor,factor); |
169 | 169 |
computeMoveVectors(); |
... | ... | |
232 | 232 |
|
233 | 233 |
void setRange(int range) |
234 | 234 |
{ |
235 |
mBlurVector.set(range/2);
|
|
235 |
mBlurHaloRadius.set(range*0.2f,range*0.5f);
|
|
236 | 236 |
} |
237 | 237 |
|
238 | 238 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/examples/postprocesstree/PostprocessTreeRenderer.java | ||
---|---|---|
36 | 36 |
import org.distorted.library.main.DistortedTexture; |
37 | 37 |
import org.distorted.library.mesh.MeshQuad; |
38 | 38 |
import org.distorted.library.type.Dynamic1D; |
39 |
import org.distorted.library.type.Dynamic2D; |
|
39 | 40 |
import org.distorted.library.type.Static1D; |
41 |
import org.distorted.library.type.Static2D; |
|
40 | 42 |
import org.distorted.library.type.Static3D; |
41 | 43 |
|
42 | 44 |
import java.io.IOException; |
... | ... | |
56 | 58 |
private DistortedTexture mLeaf; |
57 | 59 |
private DistortedScreen mScreen; |
58 | 60 |
private Static3D mScale; |
59 |
private Static1D mRadius;
|
|
61 |
private Static2D mHaloRadius;
|
|
60 | 62 |
|
61 | 63 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
62 | 64 |
|
... | ... | |
67 | 69 |
final int OUTER = 9; |
68 | 70 |
final int INNER = 4; |
69 | 71 |
|
70 |
mRadius = new Static1D(5);
|
|
71 |
Dynamic1D radiusDyn = new Dynamic1D();
|
|
72 |
radiusDyn.add(mRadius);
|
|
73 |
PostprocessEffectBlur blurEffect = new PostprocessEffectBlur(radiusDyn);
|
|
72 |
mHaloRadius = new Static2D(30,5);
|
|
73 |
Dynamic2D haloRadiusDyn = new Dynamic2D();
|
|
74 |
haloRadiusDyn.add(mHaloRadius);
|
|
75 |
PostprocessEffectBlur blurEffect = new PostprocessEffectBlur(haloRadiusDyn);
|
|
74 | 76 |
|
75 | 77 |
mLeaf = new DistortedTexture(); |
76 | 78 |
mScale= new Static3D(1,1,1); |
... | ... | |
94 | 96 |
|
95 | 97 |
Static3D center = new Static3D(0,0,0); |
96 | 98 |
Static3D axis = new Static3D(0,0,1); |
97 |
Static3D innerMoveVector = new Static3D( (1-INNER)*LEAF_SIZE/2, 0, 0);
|
|
98 |
Static3D outerMoveVector = new Static3D( (4-OUTER)*LEAF_SIZE/2, 0, 0);
|
|
99 |
Static3D innerMoveVector = new Static3D( (1-INNER)*LEAF_SIZE*0.5f, 0, 0);
|
|
100 |
Static3D outerMoveVector = new Static3D( (4-OUTER)*LEAF_SIZE*0.5f, 0, 0);
|
|
99 | 101 |
|
100 | 102 |
for(int j=0; j<NUM_LEAVES; j++) |
101 | 103 |
{ |
... | ... | |
135 | 137 |
int setBlur(int blur) |
136 | 138 |
{ |
137 | 139 |
int radius = blur/2; |
138 |
mRadius.set(radius);
|
|
140 |
mHaloRadius.set1(radius);
|
|
139 | 141 |
return radius; |
140 | 142 |
} |
141 | 143 |
|
... | ... | |
152 | 154 |
{ |
153 | 155 |
float horiRatio = (float)width ; |
154 | 156 |
float vertRatio = (float)height; |
155 |
float factor = horiRatio > vertRatio ? vertRatio : horiRatio;
|
|
157 |
float factor = Math.min(horiRatio, vertRatio);
|
|
156 | 158 |
|
157 | 159 |
mScale.set(factor,factor,factor); |
158 | 160 |
mScreen.resize(width, height); |
src/main/java/org/distorted/examples/transparency/TransparencyRenderer.java | ||
---|---|---|
34 | 34 |
import org.distorted.library.main.DistortedTexture; |
35 | 35 |
import org.distorted.library.mesh.MeshRectangles; |
36 | 36 |
import org.distorted.library.type.Static1D; |
37 |
import org.distorted.library.type.Static2D; |
|
37 | 38 |
import org.distorted.library.type.Static3D; |
38 | 39 |
import org.distorted.library.type.Static4D; |
39 | 40 |
|
... | ... | |
105 | 106 |
mTex[i] = new DistortedTexture(); |
106 | 107 |
mMoveVector[i] = new Static3D(0,0,0); |
107 | 108 |
mAlphaVector[i] = new Static1D(0.5f); |
108 |
mBlur[i] = new PostprocessEffectBlur(new Static1D(0));
|
|
109 |
mBlur[i] = new PostprocessEffectBlur( new Static2D(0,5) );
|
|
109 | 110 |
mBlurApplied[i] = true; |
110 | 111 |
alpha[i] = new FragmentEffectAlpha(mAlphaVector[i]); |
111 | 112 |
mEffects[i] = new DistortedEffects(); |
src/main/java/org/distorted/examples/triblur/TriblurRenderer.java | ||
---|---|---|
40 | 40 |
import org.distorted.library.main.DistortedTexture; |
41 | 41 |
import org.distorted.library.mesh.MeshCubes; |
42 | 42 |
import org.distorted.library.type.Static1D; |
43 |
import org.distorted.library.type.Static2D; |
|
43 | 44 |
import org.distorted.library.type.Static3D; |
44 | 45 |
import org.distorted.library.type.Static4D; |
45 | 46 |
|
... | ... | |
68 | 69 |
private GLSurfaceView mView; |
69 | 70 |
private DistortedTexture mTex; |
70 | 71 |
private DistortedNode[] mNode; |
71 |
private Static1D[] mEffectVector;
|
|
72 |
private Static2D[] mEffectHaloRadius;
|
|
72 | 73 |
private DistortedScreen mScreen; |
73 | 74 |
private PostprocessEffectBlur[] mBlur; |
74 | 75 |
private PostprocessEffectGlow[] mGlow; |
... | ... | |
95 | 96 |
mScreen = new DistortedScreen(); |
96 | 97 |
mScreen.showFPS(); |
97 | 98 |
|
98 |
mEffectStatus = new int[NUM_OBJECTS]; |
|
99 |
mEffectVector = new Static1D[NUM_OBJECTS];
|
|
100 |
mNode = new DistortedNode[NUM_OBJECTS]; |
|
101 |
mBlur = new PostprocessEffectBlur[NUM_OBJECTS]; |
|
102 |
mGlow = new PostprocessEffectGlow[NUM_OBJECTS]; |
|
99 |
mEffectStatus = new int[NUM_OBJECTS];
|
|
100 |
mEffectHaloRadius= new Static2D[NUM_OBJECTS];
|
|
101 |
mNode = new DistortedNode[NUM_OBJECTS];
|
|
102 |
mBlur = new PostprocessEffectBlur[NUM_OBJECTS];
|
|
103 |
mGlow = new PostprocessEffectGlow[NUM_OBJECTS];
|
|
103 | 104 |
|
104 | 105 |
FragmentEffectChroma[] chroma= new FragmentEffectChroma[NUM_OBJECTS]; |
105 | 106 |
Static3D[] chromaVector = new Static3D[NUM_OBJECTS]; |
... | ... | |
119 | 120 |
|
120 | 121 |
for(int i=0; i<NUM_OBJECTS; i++) |
121 | 122 |
{ |
122 |
moveVector[i] = new Static3D(OBJECTS[NUM*i ], OBJECTS[NUM*i+1], OBJECTS[NUM*i+2]); |
|
123 |
chromaVector[i] = new Static3D(OBJECTS[NUM*i+3], OBJECTS[NUM*i+4], OBJECTS[NUM*i+5]); |
|
124 |
mEffectVector[i] = new Static1D(10);
|
|
125 |
mBlur[i] = new PostprocessEffectBlur(mEffectVector[i]);
|
|
126 |
mGlow[i] = new PostprocessEffectGlow(mEffectVector[i], new Static4D(1.0f,1.0f,1.0f,0.5f) );
|
|
127 |
chroma[i] = new FragmentEffectChroma( new Static1D(0.3f), chromaVector[i]); |
|
128 |
effects[i] = new DistortedEffects(); |
|
123 |
moveVector[i] = new Static3D(OBJECTS[NUM*i ], OBJECTS[NUM*i+1], OBJECTS[NUM*i+2]);
|
|
124 |
chromaVector[i] = new Static3D(OBJECTS[NUM*i+3], OBJECTS[NUM*i+4], OBJECTS[NUM*i+5]);
|
|
125 |
mEffectHaloRadius[i]= new Static2D(10,10);
|
|
126 |
mBlur[i] = new PostprocessEffectBlur(mEffectHaloRadius[i] );
|
|
127 |
mGlow[i] = new PostprocessEffectGlow(mEffectHaloRadius[i], new Static4D(1.0f,1.0f,1.0f,0.5f) );
|
|
128 |
chroma[i] = new FragmentEffectChroma( new Static1D(0.3f), chromaVector[i]);
|
|
129 |
effects[i] = new DistortedEffects();
|
|
129 | 130 |
effects[i].apply(mBlur[i]); |
130 | 131 |
effects[i].apply(chroma[i]); |
131 | 132 |
// effects[i].apply(scaleEffectV); |
... | ... | |
213 | 214 |
|
214 | 215 |
public void onSurfaceChanged(GL10 glUnused, int width, int height) |
215 | 216 |
{ |
216 |
mScreenMin = width<height ? width:height;
|
|
217 |
mScreenMin = Math.min(width, height);
|
|
217 | 218 |
|
218 | 219 |
float factor1 = 0.20f*mScreenMin/OBJ_SIZE; |
219 | 220 |
float factor2 = 0.75f*factor1; |
... | ... | |
228 | 229 |
{ |
229 | 230 |
if( object>=0 && object<NUM_OBJECTS ) |
230 | 231 |
{ |
231 |
mEffectVector[object].set(range / 2);
|
|
232 |
mEffectHaloRadius[object].set(range*0.5f,range*0.5f);
|
|
232 | 233 |
} |
233 | 234 |
} |
234 | 235 |
|
src/main/res/layout/effect6d.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="utf-8"?> |
|
2 |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
|
3 |
android:id="@+id/effect6dLayout" |
|
4 |
android:layout_width="match_parent" |
|
5 |
android:layout_height="wrap_content" |
|
6 |
android:orientation="vertical"> |
|
7 |
|
|
8 |
<LinearLayout |
|
9 |
android:id="@+id/button6dLayout" |
|
10 |
android:layout_width="match_parent" |
|
11 |
android:layout_height="match_parent" |
|
12 |
android:orientation="horizontal"> |
|
13 |
|
|
14 |
<TextView |
|
15 |
android:id="@+id/effect6dText" |
|
16 |
android:layout_width="wrap_content" |
|
17 |
android:layout_height="wrap_content" |
|
18 |
android:layout_marginEnd="5dp" |
|
19 |
android:layout_marginStart="5dp" |
|
20 |
android:layout_marginTop="3dp" |
|
21 |
android:layout_weight="1"/> |
|
22 |
|
|
23 |
<Button |
|
24 |
android:text="@string/removebut" |
|
25 |
android:layout_width="wrap_content" |
|
26 |
android:layout_height="wrap_content" |
|
27 |
android:id="@+id/button6dRemove" |
|
28 |
android:layout_weight="0.2" |
|
29 |
android:layout_marginTop="3dp"/> |
|
30 |
</LinearLayout> |
|
31 |
|
|
32 |
<SeekBar |
|
33 |
android:id="@+id/effect6dbar1" |
|
34 |
android:layout_width="fill_parent" |
|
35 |
android:layout_height="wrap_content" |
|
36 |
android:layout_marginEnd="5dp" |
|
37 |
android:layout_marginLeft="5dp" |
|
38 |
android:layout_marginRight="5dp" /> |
|
39 |
|
|
40 |
<SeekBar |
|
41 |
android:id="@+id/effect6dbar2" |
|
42 |
android:layout_width="fill_parent" |
|
43 |
android:layout_height="wrap_content" |
|
44 |
android:layout_marginEnd="5dp" |
|
45 |
android:layout_marginLeft="5dp" |
|
46 |
android:layout_marginRight="5dp" /> |
|
47 |
|
|
48 |
<SeekBar |
|
49 |
android:id="@+id/effect6dbar3" |
|
50 |
android:layout_width="fill_parent" |
|
51 |
android:layout_height="wrap_content" |
|
52 |
android:layout_marginEnd="5dp" |
|
53 |
android:layout_marginLeft="5dp" |
|
54 |
android:layout_marginRight="5dp" /> |
|
55 |
|
|
56 |
<SeekBar |
|
57 |
android:id="@+id/effect6dbar4" |
|
58 |
android:layout_width="fill_parent" |
|
59 |
android:layout_height="wrap_content" |
|
60 |
android:layout_marginEnd="5dp" |
|
61 |
android:layout_marginLeft="5dp" |
|
62 |
android:layout_marginRight="5dp" /> |
|
63 |
|
|
64 |
<SeekBar |
|
65 |
android:id="@+id/effect6dbar5" |
|
66 |
android:layout_width="fill_parent" |
|
67 |
android:layout_height="wrap_content" |
|
68 |
android:layout_marginEnd="5dp" |
|
69 |
android:layout_marginLeft="5dp" |
|
70 |
android:layout_marginRight="5dp" /> |
|
71 |
|
|
72 |
<SeekBar |
|
73 |
android:id="@+id/effect6dbar6" |
|
74 |
android:layout_width="fill_parent" |
|
75 |
android:layout_height="wrap_content" |
|
76 |
android:layout_marginEnd="5dp" |
|
77 |
android:layout_marginLeft="5dp" |
|
78 |
android:layout_marginRight="5dp" /> |
|
79 |
|
|
80 |
</LinearLayout> |
Also available in: Unified diff
Change the Postprocessing effects: separate the radius and the halo.
Reason: we needed a way to specify the size of the halo around a postprocessed object; before it was automatically (and not very correctly) computed from the radius - before we knew the size of the object's bounding box, so this automatic computation was possible. Now we're removing the MashBase.getBounding(0 API, so the size of the halo has to be explicitly given by the user. This way is more correct anyway and gives the user more control (as the Multiblur app proves!)
Warning: here for the first time I can see that the 2 Examples (PostprocessingTree and MovingGlow) sometimes would not appear (black screen). Maybe this commit introduces such a bug - investigate.