Revision 698ad0a8
Added by Leszek Koltunski about 4 years ago
src/main/java/org/distorted/examples/blur/BlurRenderer.java | ||
---|---|---|
55 | 55 |
private DistortedEffects mEffects, mBufferEffects; |
56 | 56 |
private DistortedScreen mScreen; |
57 | 57 |
private DistortedFramebuffer mBuffer; |
58 |
private MeshRectangles mMesh; |
|
58 |
private MeshRectangles mMesh, mMeshBuffer;
|
|
59 | 59 |
private Static1D mRadiusSta; |
60 | 60 |
private int mObjHeight, mObjWidth; |
61 | 61 |
private Static3D mMove, mScale, mBufferMove, mBufferScale; |
... | ... | |
64 | 64 |
|
65 | 65 |
BlurRenderer(GLSurfaceView v) |
66 | 66 |
{ |
67 |
mView = v; |
|
68 |
mMesh = new MeshRectangles(1,1); |
|
69 |
mScreen = new DistortedScreen(); |
|
70 |
mBuffer = new DistortedFramebuffer(SIZE,SIZE,1, DistortedFramebuffer.NO_DEPTH_NO_STENCIL); |
|
67 |
mView = v; |
|
68 |
mMesh = new MeshRectangles(1,1); |
|
69 |
mMeshBuffer = new MeshRectangles(1,1); |
|
70 |
mScreen = new DistortedScreen(); |
|
71 |
mBuffer = new DistortedFramebuffer(SIZE,SIZE,1, DistortedFramebuffer.NO_DEPTH_NO_STENCIL); |
|
71 | 72 |
|
72 | 73 |
mRadiusSta = new Static1D(5); |
73 | 74 |
Dynamic1D radiusDyn = new Dynamic1D(); |
... | ... | |
78 | 79 |
mBufferMove = new Static3D(0,0,0); |
79 | 80 |
mBufferScale= new Static3D(1,1,1); |
80 | 81 |
|
81 |
mBufferEffects = new DistortedEffects(1);
|
|
82 |
mBufferEffects = new DistortedEffects(); |
|
82 | 83 |
mBufferEffects.apply(new MatrixEffectScale(mBufferScale)); |
83 | 84 |
mBufferEffects.apply(new MatrixEffectMove(mBufferMove)); |
84 | 85 |
|
85 |
mEffects = new DistortedEffects(1);
|
|
86 |
mEffects = new DistortedEffects(); |
|
86 | 87 |
mEffects.apply( new PostprocessEffectBlur(radiusDyn) ); |
87 | 88 |
mEffects.apply(new MatrixEffectScale(mScale)); |
88 | 89 |
mEffects.apply(new MatrixEffectMove(mMove)); |
... | ... | |
155 | 156 |
mObjHeight = bitmap.getHeight(); |
156 | 157 |
mObjWidth = bitmap.getWidth(); |
157 | 158 |
|
158 |
mEffects.setStretch(mObjWidth,mObjHeight,0);
|
|
159 |
mBufferEffects.setStretch(SIZE,SIZE,0);
|
|
159 |
mMesh.setStretch(mObjWidth,mObjHeight,0);
|
|
160 |
mMeshBuffer.setStretch(SIZE,SIZE,0);
|
|
160 | 161 |
|
161 | 162 |
if( mTexture==null ) mTexture = new DistortedTexture(); |
162 | 163 |
mTexture.setTexture(bitmap); |
163 | 164 |
|
164 | 165 |
mScreen.detachAll(); |
165 |
mScreen.attach(mBuffer, mBufferEffects, mMesh); |
|
166 |
mScreen.attach(mBuffer, mBufferEffects, mMeshBuffer);
|
|
166 | 167 |
mBuffer.attach(new DistortedNode(mTexture,mEffects,mMesh)); |
167 | 168 |
|
168 | 169 |
PostprocessEffectBlur.enable(); |
Also available in: Unified diff
Move the Effects.setStretch to Meshbase.setStretch