Revision 678c391d
Added by Leszek Koltunski about 4 years ago
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 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
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.