Revision 60c1c622
Added by Leszek Koltunski about 7 years ago
src/main/java/org/distorted/library/EffectQueuePostprocess.java | ||
---|---|---|
65 | 65 |
mQuadTexture.put(textureNor).position(0); |
66 | 66 |
} |
67 | 67 |
|
68 |
private static DistortedFramebuffer mPostBuffer = new DistortedFramebuffer(true,DistortedSurface.TYPE_SYST,1,1); |
|
69 |
DistortedFramebuffer mMainBuffer = new DistortedFramebuffer(true,DistortedSurface.TYPE_TREE,1,1); |
|
70 |
|
|
71 | 68 |
// BLUR effect |
72 | 69 |
private static final float GAUSSIAN[] = // G(0.00), G(0.03), G(0.06), ..., G(3.00), 0 |
73 | 70 |
{ // where G(x)= (1/(sqrt(2*PI))) * e^(-(x^2)/2). The last 0 terminates. |
... | ... | |
162 | 159 |
} |
163 | 160 |
|
164 | 161 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
165 |
|
|
162 |
// TODO: change this into a EQP <--> long Map. |
|
163 |
// For now, just returning number of effects is sufficient. |
|
164 |
|
|
165 |
long getBucket() |
|
166 |
{ |
|
167 |
return mNumEffects; |
|
168 |
} |
|
169 |
|
|
170 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
171 |
|
|
166 | 172 |
synchronized boolean compute(long currTime) |
167 | 173 |
{ |
168 | 174 |
if( currTime==mTime ) return false; |
... | ... | |
260 | 266 |
{ |
261 | 267 |
if( mNumEffects>0 && compute(time) ) |
262 | 268 |
{ |
263 |
mMainBuffer.setAsInput();
|
|
269 |
surface.mBuffer1.setAsInput();
|
|
264 | 270 |
float w = surface.mWidth; |
265 | 271 |
float h = surface.mHeight; |
266 | 272 |
|
... | ... | |
275 | 281 |
|
276 | 282 |
// horizontal blur |
277 | 283 |
mBlur1Program.useProgram(); |
278 |
mPostBuffer.resizeFast( (int)w, (int)h); |
|
279 |
mPostBuffer.setAsOutput(time); |
|
284 |
surface.mBuffer2.setAsOutput(time); |
|
280 | 285 |
|
281 | 286 |
GLES30.glUniform1fv( mWeights1H, radius+1, weightsCache,offset); |
282 | 287 |
GLES30.glUniform1i( mRadius1H, radius); |
... | ... | |
290 | 295 |
|
291 | 296 |
// vertical blur |
292 | 297 |
mBlur2Program.useProgram(); |
293 |
mPostBuffer.setAsInput();
|
|
294 |
mMainBuffer.setAsDepth();
|
|
298 |
surface.mBuffer2.setAsInput();
|
|
299 |
surface.mBuffer1.setAsDepth();
|
|
295 | 300 |
surface.setAsOutput(time); |
296 | 301 |
|
297 | 302 |
GLES30.glUniform1fv( mWeights2H, radius+1, weightsCache,offset); |
Also available in: Unified diff
Move the Postprocessing buffers to OutputSurface.