Project

General

Profile

« Previous | Next » 

Revision c5369f1b

Added by Leszek Koltunski about 7 years ago

Major: change of API.

Split DFramebuffer into Framebuffer and Screen; introduce the 'DistortedInputSurface' and 'DistortedOutputSurface' interfaces.

View differences:

src/main/java/org/distorted/library/EffectQueuePostprocess.java
229 229
// w,h - width and height of the input texture. MVP - Model-View-Projection matrix to apply to the
230 230
// texture; df - output FBO.
231 231

  
232
  synchronized void render(float w, float h, float[] mvp, DistortedFramebuffer df)
232
  synchronized void render(float w, float h, float[] mvp, DistortedOutputSurface surface)
233 233
    {
234 234
    mBlurProgram.useProgram();
235 235

  
236
    DistortedProjection inputP  = mBufferFBO.getProjection();
237
    DistortedProjection outputP = surface.getProjection();
238

  
236 239
    int radius = (int)mUniforms[0];
237 240
    if( radius>=MAX_BLUR ) radius = MAX_BLUR-1;
238 241
    computeGaussianKernel(radius);
......
252 255
    GLES30.glViewport(0, 0, (int)w, (int)h);
253 256

  
254 257
    Matrix.setIdentityM(mTmpMatrix, 0);
255
    Matrix.translateM(mTmpMatrix, 0, 0, 0, -mBufferFBO.mDistance);
256
    Matrix.multiplyMM(mMVPMatrix, 0, mBufferFBO.mProjectionMatrix, 0, mTmpMatrix, 0);
258
    Matrix.translateM(mTmpMatrix, 0, 0, 0, -inputP.mDistance);
259
    Matrix.multiplyMM(mMVPMatrix, 0, inputP.mProjectionMatrix, 0, mTmpMatrix, 0);
257 260

  
258 261
    // horizontal blur
259 262
    GLES30.glUniform1fv( mOffsetsH ,radius+1, mOffsets,0);
......
263 266
    GLES30.glDrawArrays(GLES30.GL_TRIANGLE_STRIP, 0, 4);
264 267

  
265 268
    mBufferFBO.setAsInput();
266
    df.setAsOutput();
267
    GLES30.glViewport(0, 0, df.mWidth, df.mHeight);
269
    surface.setAsOutput();
270

  
271
    GLES30.glViewport(0, 0, outputP.mWidth, outputP.mHeight);
268 272

  
269 273
    for(int i=0; i<=radius; i++) mOffsets[i] = offsetsCache[offset+i]/w;
270 274

  

Also available in: Unified diff