Revision 2386a081
Added by Leszek Koltunski over 7 years ago
| src/main/java/org/distorted/library/main/DistortedOutputSurface.java | ||
|---|---|---|
| 400 | 400 |
|
| 401 | 401 |
int renderChildren(long time, int numChildren, ArrayList<DistortedNode> children, int fbo, boolean oit) |
| 402 | 402 |
{
|
| 403 |
int quality=0, internalQuality = 0, numRenders = 0, bucketChange = 0;
|
|
| 404 |
DistortedNode child1, child2;
|
|
| 403 |
int quality=0, numRenders=0, bucketChange=0;
|
|
| 404 |
DistortedNode child; |
|
| 405 | 405 |
EffectQueuePostprocess lastQueue=null, currQueue; |
| 406 | 406 |
long lastBucket=0, currBucket; |
| 407 | 407 |
|
| ... | ... | |
| 422 | 422 |
|
| 423 | 423 |
for(int i=0; i<numChildren; i++) |
| 424 | 424 |
{
|
| 425 |
child1 = children.get(i);
|
|
| 426 |
currQueue = child1.getPostprocessQueue();
|
|
| 425 |
child = children.get(i); |
|
| 426 |
currQueue = child.getPostprocessQueue(); |
|
| 427 | 427 |
currBucket= currQueue.getID(); |
| 428 | 428 |
|
| 429 | 429 |
if( currBucket==0 ) |
| ... | ... | |
| 432 | 432 |
|
| 433 | 433 |
if( oit ) |
| 434 | 434 |
{
|
| 435 |
numRenders += child1.drawOIT(time, this);
|
|
| 435 |
numRenders += child.drawOIT(time, this); |
|
| 436 | 436 |
GLES31.glMemoryBarrier(GLES31.GL_SHADER_STORAGE_BARRIER_BIT | GLES31.GL_ATOMIC_COUNTER_BARRIER_BIT); |
| 437 | 437 |
} |
| 438 | 438 |
else |
| 439 | 439 |
{
|
| 440 |
numRenders += child1.draw(time, this);
|
|
| 440 |
numRenders += child.draw(time, this); |
|
| 441 | 441 |
} |
| 442 | 442 |
} |
| 443 | 443 |
else |
| ... | ... | |
| 460 | 460 |
} |
| 461 | 461 |
else |
| 462 | 462 |
{
|
| 463 |
for(int j=bucketChange; j<i; j++) |
|
| 464 |
{
|
|
| 465 |
child2 = children.get(j); |
|
| 466 |
mBuffer[internalQuality].setAsOutput(); |
|
| 467 |
numRenders += child2.markStencilAndDepth(time,mBuffer[internalQuality],lastQueue); |
|
| 468 |
} |
|
| 469 |
|
|
| 463 |
for(int j=bucketChange; j<i; j++) numRenders += lastQueue.preprocess( mBuffer,children.get(j), time); |
|
| 470 | 464 |
numRenders += lastQueue.postprocess(mBuffer); |
| 471 | 465 |
|
| 472 | 466 |
if( oit ) |
| ... | ... | |
| 481 | 475 |
mBuffer[quality].clearBuffer(fbo); |
| 482 | 476 |
} |
| 483 | 477 |
|
| 484 |
internalQuality = currQueue.getInternalQuality(); |
|
| 485 |
quality = currQueue.getQuality(); |
|
| 486 |
bucketChange = i; |
|
| 478 |
quality = currQueue.getQuality(); |
|
| 479 |
bucketChange= i; |
|
| 487 | 480 |
} |
| 488 | 481 |
|
| 489 | 482 |
mBuffer[quality].setAsOutput(time); |
| 490 |
child1.drawNoBlend(time,mBuffer[quality]);
|
|
| 483 |
child.drawNoBlend(time,mBuffer[quality]); |
|
| 491 | 484 |
|
| 492 | 485 |
if( i==numChildren-1 ) |
| 493 | 486 |
{
|
| 494 |
for(int j=bucketChange; j<numChildren; j++) |
|
| 495 |
{
|
|
| 496 |
child2 = children.get(j); |
|
| 497 |
mBuffer[internalQuality].setAsOutput(); |
|
| 498 |
numRenders += child2.markStencilAndDepth(time,mBuffer[internalQuality],currQueue); |
|
| 499 |
} |
|
| 500 |
|
|
| 487 |
for(int j=bucketChange; j<numChildren; j++) numRenders += currQueue.preprocess(mBuffer,children.get(j), time); |
|
| 501 | 488 |
numRenders += currQueue.postprocess(mBuffer); |
| 502 | 489 |
|
| 503 | 490 |
if( oit ) |
| src/main/java/org/distorted/library/main/EffectQueuePostprocess.java | ||
|---|---|---|
| 85 | 85 |
} |
| 86 | 86 |
|
| 87 | 87 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 88 |
// TODO (now only really works in case of 1 effect!) |
|
| 88 | 89 |
|
| 89 | 90 |
int getQuality() |
| 90 | 91 |
{
|
| ... | ... | |
| 92 | 93 |
} |
| 93 | 94 |
|
| 94 | 95 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 96 |
// TODO (now only really works in case of 1 effect!) |
|
| 95 | 97 |
|
| 96 |
int getInternalQuality() |
|
| 98 |
private int getInternalQuality()
|
|
| 97 | 99 |
{
|
| 98 | 100 |
return mNumEffects>0 ? ((PostprocessEffect)mEffects[0]).getInternalQuality() : 0; |
| 99 | 101 |
} |
| 100 | 102 |
|
| 103 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 104 |
|
|
| 105 |
int preprocess(DistortedOutputSurface[] buffers, DistortedNode node, long time) |
|
| 106 |
{
|
|
| 107 |
int numRenders = 0; |
|
| 108 |
int quality = getInternalQuality(); |
|
| 109 |
|
|
| 110 |
buffers[quality].setAsOutput(); |
|
| 111 |
|
|
| 112 |
numRenders += node.markStencilAndDepth(time,buffers[quality],this); |
|
| 113 |
|
|
| 114 |
return numRenders; |
|
| 115 |
} |
|
| 116 |
|
|
| 101 | 117 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 102 | 118 |
|
| 103 | 119 |
int postprocess(DistortedOutputSurface[] buffers) |
Also available in: Unified diff
1. Hide internalQuality inside Postprocess effects.
2. First step to turn markStencilAndDepth into a more generic Postprocessing 'preprocess'.