Revision 9e771d06
Added by Leszek Koltunski almost 6 years ago
src/main/java/org/distorted/library/main/DistortedOutputSurface.java | ||
---|---|---|
71 | 71 |
private ArrayList<Job> mJobs = new ArrayList<>(); |
72 | 72 |
|
73 | 73 |
// Global buffers used for postprocessing. |
74 |
private static DistortedOutputSurface[] mBuffer=null;
|
|
74 |
private static DistortedFramebuffer[] mBuffer=null;
|
|
75 | 75 |
|
76 | 76 |
private float mFOV; |
77 | 77 |
float mDistance, mNear; |
... | ... | |
181 | 181 |
|
182 | 182 |
private static void createPostprocessingBuffers(int width, int height, float near) |
183 | 183 |
{ |
184 |
mBuffer = new DistortedOutputSurface[EffectQuality.LENGTH];
|
|
184 |
mBuffer = new DistortedFramebuffer[EffectQuality.LENGTH];
|
|
185 | 185 |
float mipmap=1.0f; |
186 | 186 |
|
187 | 187 |
for (int j=0; j<EffectQuality.LENGTH; j++) |
... | ... | |
404 | 404 |
DistortedNode child; |
405 | 405 |
EffectQueuePostprocess lastQueue=null, currQueue; |
406 | 406 |
long lastBucket=0, currBucket; |
407 |
boolean renderDirectly=false; |
|
407 | 408 |
|
408 | 409 |
setCurrFBO(fbo); |
409 | 410 |
|
410 | 411 |
if( mBuffer!=null ) |
411 | 412 |
{ |
412 |
for (int i=0; i<EffectQuality.LENGTH; i++) |
|
413 |
{ |
|
414 |
mBuffer[i].setCurrFBO(fbo); |
|
415 |
} |
|
413 |
for (int i=0; i<EffectQuality.LENGTH; i++) mBuffer[i].setCurrFBO(fbo); |
|
416 | 414 |
} |
417 | 415 |
|
418 | 416 |
if( oit && numChildren>0 ) |
... | ... | |
445 | 443 |
if( mBuffer==null ) |
446 | 444 |
{ |
447 | 445 |
createPostprocessingBuffers(mWidth,mHeight,mNear); |
448 |
|
|
449 |
for (int j=0; j<EffectQuality.LENGTH; j++) |
|
450 |
{ |
|
451 |
mBuffer[j].setCurrFBO(fbo); |
|
452 |
} |
|
446 |
for (int j=0; j<EffectQuality.LENGTH; j++) mBuffer[j].setCurrFBO(fbo); |
|
453 | 447 |
} |
454 | 448 |
|
455 | 449 |
if( lastBucket!=currBucket ) |
... | ... | |
460 | 454 |
} |
461 | 455 |
else |
462 | 456 |
{ |
463 |
for(int j=bucketChange; j<i; j++) numRenders += lastQueue.preprocess( mBuffer,children.get(j) ); |
|
464 |
numRenders += lastQueue.postprocess(mBuffer); |
|
457 |
for(int j=bucketChange; j<i; j++) numRenders += lastQueue.preprocess( mBuffer[quality],children.get(j) );
|
|
458 |
numRenders += lastQueue.postprocess(mBuffer[quality]);
|
|
465 | 459 |
|
466 | 460 |
if( oit ) |
467 | 461 |
{ |
... | ... | |
475 | 469 |
mBuffer[quality].clearBuffer(fbo); |
476 | 470 |
} |
477 | 471 |
|
478 |
quality = currQueue.getQuality();
|
|
472 |
quality= currQueue.getQuality(); |
|
479 | 473 |
bucketChange= i; |
474 |
renderDirectly = currQueue.getRender(); |
|
480 | 475 |
} |
481 | 476 |
|
482 |
mBuffer[quality].setAsOutput(time); |
|
483 |
child.drawNoBlend(time,mBuffer[quality]); |
|
477 |
if( renderDirectly ) |
|
478 |
{ |
|
479 |
setAsOutput(time); |
|
480 |
|
|
481 |
if( oit ) |
|
482 |
{ |
|
483 |
numRenders += child.drawOIT(time, this); |
|
484 |
GLES31.glMemoryBarrier(GLES31.GL_SHADER_STORAGE_BARRIER_BIT | GLES31.GL_ATOMIC_COUNTER_BARRIER_BIT); |
|
485 |
} |
|
486 |
else |
|
487 |
{ |
|
488 |
numRenders += child.draw(time, this); |
|
489 |
} |
|
490 |
} |
|
491 |
else |
|
492 |
{ |
|
493 |
mBuffer[quality].setAsOutput(time); |
|
494 |
child.drawNoBlend(time, mBuffer[quality]); |
|
495 |
} |
|
484 | 496 |
|
485 | 497 |
if( i==numChildren-1 ) |
486 | 498 |
{ |
487 |
for(int j=bucketChange; j<numChildren; j++) numRenders += currQueue.preprocess( mBuffer,children.get(j) ); |
|
488 |
numRenders += currQueue.postprocess(mBuffer); |
|
499 |
for(int j=bucketChange; j<numChildren; j++) numRenders += currQueue.preprocess( mBuffer[quality],children.get(j) );
|
|
500 |
numRenders += currQueue.postprocess(mBuffer[quality]);
|
|
489 | 501 |
|
490 | 502 |
if( oit ) |
491 | 503 |
{ |
... | ... | |
543 | 555 |
|
544 | 556 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
545 | 557 |
|
546 |
private void clearBuffer(int fbo)
|
|
558 |
void clearBuffer(int fbo) |
|
547 | 559 |
{ |
548 | 560 |
DistortedRenderState.colorDepthStencilOn(); |
549 | 561 |
|
Also available in: Unified diff
Progress with thr Glow effect - moving glow app looks ok now.