Revision 371c43ca
Added by Leszek Koltunski over 6 years ago
src/main/java/org/distorted/examples/triblur/TriblurRenderer.java | ||
---|---|---|
73 | 73 |
private FragmentEffectChroma[] mChroma; |
74 | 74 |
private int mDistance; |
75 | 75 |
private boolean[] mBlurStatus; |
76 |
private Static3D mMove, mScale, mCenter;
|
|
76 |
private Static3D mMove1, mMove2, mScale1, mScale2, mCenter;
|
|
77 | 77 |
|
78 | 78 |
Static4D mQuat1, mQuat2; |
79 | 79 |
int mScreenMin; |
... | ... | |
83 | 83 |
TriblurRenderer(GLSurfaceView v) |
84 | 84 |
{ |
85 | 85 |
mView = v; |
86 |
mDistance = OBJ_SIZE/2;
|
|
86 |
mDistance = (int)(OBJ_SIZE*0.6f);
|
|
87 | 87 |
|
88 | 88 |
MeshCubes mesh = new MeshCubes(1,1,1); |
89 | 89 |
|
... | ... | |
105 | 105 |
|
106 | 106 |
DistortedEffects[] effects= new DistortedEffects[NUM_OBJECTS]; |
107 | 107 |
|
108 |
mMove = new Static3D(0,0,0); |
|
109 |
mScale = new Static3D(1,1,1); |
|
108 |
mMove1 = new Static3D(0,0,0); |
|
109 |
mMove2 = new Static3D(0,0,0); |
|
110 |
mScale1 = new Static3D(1,1,1); |
|
111 |
mScale2 = new Static3D(1.5f,1.5f,1.5f); |
|
110 | 112 |
mCenter = new Static3D(0,0,0); |
111 | 113 |
|
112 |
MatrixEffectMove moveEffect = new MatrixEffectMove(mMove); |
|
113 |
MatrixEffectScale scaleEffect = new MatrixEffectScale(mScale); |
|
114 |
MatrixEffectMove moveEffect1 = new MatrixEffectMove(mMove1); |
|
115 |
MatrixEffectMove moveEffect2 = new MatrixEffectMove(mMove2); |
|
116 |
MatrixEffectScale scaleEffect1 = new MatrixEffectScale(mScale1); |
|
117 |
MatrixEffectScale scaleEffect2 = new MatrixEffectScale(mScale2); |
|
114 | 118 |
MatrixEffectQuaternion quatEffect1 = new MatrixEffectQuaternion(mQuat1, mCenter); |
115 | 119 |
MatrixEffectQuaternion quatEffect2 = new MatrixEffectQuaternion(mQuat2, mCenter); |
116 | 120 |
|
... | ... | |
125 | 129 |
|
126 | 130 |
effects[i].apply(mBlur[i]); |
127 | 131 |
effects[i].apply(mChroma[i]); |
128 |
effects[i].apply(moveEffect);
|
|
129 |
effects[i].apply(scaleEffect);
|
|
132 |
effects[i].apply( (i==0||i==NUM_OBJECTS-1) ? moveEffect1 : moveEffect2 );
|
|
133 |
effects[i].apply( (i==0||i==NUM_OBJECTS-1) ? scaleEffect1 : scaleEffect2 );
|
|
130 | 134 |
effects[i].apply(quatEffect1); |
131 | 135 |
effects[i].apply(quatEffect2); |
132 | 136 |
effects[i].apply(new MatrixEffectMove(mMoveVector[i])); |
133 | 137 |
|
134 | 138 |
mBlurStatus[i] = true; |
135 |
mNode[i] = new DistortedNode(mTex, effects[i], mesh); |
|
139 |
mNode[i] = new DistortedNode(mTex, effects[i], mesh );
|
|
136 | 140 |
mScreen.attach(mNode[i]); |
137 | 141 |
} |
138 | 142 |
|
... | ... | |
204 | 208 |
{ |
205 | 209 |
mScreenMin = width<height ? width:height; |
206 | 210 |
|
207 |
float factor = 0.24f*mScreenMin/OBJ_SIZE; |
|
208 |
mScale.set(factor,factor,factor); |
|
211 |
float factor1 = 0.22f*mScreenMin/OBJ_SIZE; |
|
212 |
float factor2 = 1.50f*factor1; |
|
213 |
mScale1.set(factor1,factor1,factor1); |
|
214 |
mScale2.set(factor2,factor2,factor2); |
|
209 | 215 |
mCenter.set((float)OBJ_SIZE/2, (float)OBJ_SIZE/2, -(float)OBJ_SIZE/2 ); |
210 |
mMove.set( (width -factor*OBJ_SIZE)/2 ,(height-factor*OBJ_SIZE)/2 ,0); |
|
216 |
mMove1.set( (width -factor1*OBJ_SIZE)/2 ,(height-factor1*OBJ_SIZE)/2 ,0); |
|
217 |
mMove2.set( (width -factor2*OBJ_SIZE)/2 ,(height-factor2*OBJ_SIZE)/2 ,0); |
|
211 | 218 |
computeMoveVectors(); |
212 | 219 |
mScreen.resize(width, height); |
213 | 220 |
} |
Also available in: Unified diff
Improve the 'Triblur' app.