Project

General

Profile

« Previous | Next » 

Revision 70b6a155

Added by Leszek Koltunski almost 7 years ago

Internal API change around postprocessing.

View differences:

src/main/java/org/distorted/library/main/DistortedOutputSurface.java
27 27
import java.util.ArrayList;
28 28

  
29 29
///////////////////////////////////////////////////////////////////////////////////////////////////
30

  
31
abstract class DistortedOutputSurface extends DistortedSurface implements DistortedMaster.Slave
30
/**
31
 * This is not really part of the public API.
32
 *
33
 * @y.exclude
34
 */
35
public abstract class DistortedOutputSurface extends DistortedSurface implements DistortedMaster.Slave
32 36
{
33 37
//////////// DEBUG FLAGS /////////////////////////////////////////////
34 38
/**
......
72 76

  
73 77
  private ArrayList<Job> mJobs = new ArrayList<>();
74 78

  
75
  DistortedFramebuffer[] mBuffer;
79
  DistortedOutputSurface[] mBuffer;
76 80

  
77 81
  private long mTime;
78 82
  private float mFOV;
......
128 132
    mClearStencil = 0;
129 133
    mClear = GLES30.GL_DEPTH_BUFFER_BIT | GLES30.GL_COLOR_BUFFER_BIT;
130 134

  
131
    mBuffer = new DistortedFramebuffer[EffectQuality.LENGTH];
135
    mBuffer = new DistortedOutputSurface[1+EffectQuality.LENGTH];
132 136

  
133 137
    mMipmap = 1.0f;
134 138

  
......
188 192
      mipmap *= EffectQuality.MULTIPLIER;
189 193
      }
190 194

  
195
    mBuffer[EffectQuality.LENGTH] = this;
196

  
191 197
    DistortedObject.toDo(); // create the FBOs immediately. This is safe as we must be holding the OpenGL context now.
192 198

  
193 199
    GLES30.glStencilMask(0xff);
......
209 215

  
210 216
///////////////////////////////////////////////////////////////////////////////////////////////////
211 217

  
212
  private int blitWithDepth(long currTime, DistortedFramebuffer buffer)
218
  private int blitWithDepth(long currTime, DistortedOutputSurface buffer)
213 219
    {
214 220
    GLES30.glViewport(0, 0, mWidth, mHeight);
215 221
    setAsOutput(currTime);
......
253 259
    {
254 260
    int quality=0, internalQuality = 0, numRenders = 0, bucketChange = 0;
255 261
    DistortedNode child1, child2;
256
    DistortedEffects lastEffects=null, currEffects;
262
    EffectQueuePostprocess lastQueue=null, currQueue;
257 263
    long lastBucket=0, currBucket;
258 264

  
259 265
sCurr = "";
......
261 267
    for(int i=0; i<numChildren; i++)
262 268
      {
263 269
      child1 = children.get(i);
264
      currEffects = child1.getEffects();
265
      currBucket  = currEffects.getBucket();
270
      currQueue = child1.getPostprocessQueue();
271
      currBucket= currQueue.getID();
266 272

  
267 273
sCurr += (" "+currBucket);
268 274

  
......
278 284
            for(int j=bucketChange; j<i; j++)
279 285
              {
280 286
              child2 = children.get(j);
281
              numRenders += child2.markStencilAndDepth(time,mBuffer[internalQuality],lastEffects);
287
              numRenders += child2.markStencilAndDepth(time,mBuffer[internalQuality],lastQueue);
282 288
              }
283 289

  
284
            numRenders += lastEffects.postprocess(this);
290
            numRenders += lastQueue.postprocess(this);
285 291
            numRenders += blitWithDepth(time, mBuffer[quality]);
286 292
            }
287 293

  
288
          internalQuality = currEffects.getInternalQuality();
289
          quality = currEffects.getQuality();
290
          bucketChange = i;
294
          internalQuality = currQueue.getInternalQuality();
295
          quality         = currQueue.getQuality();
296
          bucketChange    = i;
291 297
          }
292 298

  
293
        numRenders += child1.draw(time,mBuffer[quality]);
299
        child1.draw(time,mBuffer[quality]);
300
        //numRenders += currQueue.draw(child1,time,mBuffer);
294 301

  
295 302
        if( i==numChildren-1 )
296 303
          {
297 304
          for(int j=bucketChange; j<numChildren; j++)
298 305
            {
299 306
            child2 = children.get(j);
300
            numRenders += child2.markStencilAndDepth(time,mBuffer[internalQuality],currEffects);
307
            numRenders += child2.markStencilAndDepth(time,mBuffer[internalQuality],currQueue);
301 308
            }
302 309

  
303
          numRenders += currEffects.postprocess(this);
310
          numRenders += currQueue.postprocess(this);
304 311
          numRenders += blitWithDepth(time, mBuffer[quality]);
305 312
          }
306 313
        }
307 314

  
308
      lastEffects = currEffects;
309
      lastBucket  = currBucket;
315
      lastQueue = currQueue;
316
      lastBucket= currBucket;
310 317
      }
311 318

  
312 319
if( !sLast.equals(sCurr) ) android.util.Log.e("surface", "rendering: "+sCurr);

Also available in: Unified diff