Revision 13687207
Added by Leszek Koltunski about 7 years ago
src/main/java/org/distorted/library/DistortedNode.java | ||
---|---|---|
43 | 43 |
private DistortedNode mParent; |
44 | 44 |
private MeshObject mMesh; |
45 | 45 |
private DistortedEffects mEffects; |
46 |
private DistortedEffectsPostprocess mPostprocess; |
|
46 | 47 |
private DistortedInputSurface mSurface; |
47 | 48 |
private DistortedRenderState mState; |
48 | 49 |
private NodeData mData; |
... | ... | |
211 | 212 |
return 0; |
212 | 213 |
} |
213 | 214 |
|
214 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
215 |
|
|
216 |
int postprocess(long currTime, DistortedOutputSurface surface) |
|
217 |
{ |
|
218 |
return mEffects.postprocessPriv(currTime,surface); |
|
219 |
} |
|
220 |
|
|
221 | 215 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
222 | 216 |
|
223 | 217 |
EffectQueuePostprocess getPostprocess() |
224 | 218 |
{ |
225 |
return mEffects.getPostprocess();
|
|
219 |
return mPostprocess==null ? null : mPostprocess.getPostprocess();
|
|
226 | 220 |
} |
227 | 221 |
|
228 | 222 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
269 | 263 |
{ |
270 | 264 |
mSurface = surface; |
271 | 265 |
mEffects = effects; |
266 |
mPostprocess = null; |
|
272 | 267 |
mMesh = mesh; |
273 | 268 |
mState = new DistortedRenderState(); |
274 | 269 |
mChildren = null; |
... | ... | |
305 | 300 |
*/ |
306 | 301 |
public DistortedNode(DistortedNode node, int flags) |
307 | 302 |
{ |
308 |
mEffects= new DistortedEffects(node.mEffects,flags); |
|
309 |
mMesh = node.mMesh; |
|
310 |
mState = new DistortedRenderState(); |
|
311 |
mParent = null; |
|
303 |
mEffects = new DistortedEffects(node.mEffects,flags); |
|
304 |
mPostprocess = null; |
|
305 |
mMesh = node.mMesh; |
|
306 |
mState = new DistortedRenderState(); |
|
307 |
mParent = null; |
|
312 | 308 |
|
313 | 309 |
if( (flags & Distorted.CLONE_SURFACE) != 0 ) |
314 | 310 |
{ |
... | ... | |
521 | 517 |
} |
522 | 518 |
} |
523 | 519 |
|
520 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
521 |
/** |
|
522 |
* Sets the Postprocessing Effects we will apply to the temporary buffer this Node - and fellow siblings |
|
523 |
* with the same Effects - will get rendered to. |
|
524 |
* <p> |
|
525 |
* For efficiency reasons, it is very important to assign the very same DistortedEffectsPostprocess |
|
526 |
* object to all the DistortedNode siblings that are supposed to be postprocessed in the same way, |
|
527 |
* because only then will the library assign all such siblings to the same 'Bucket' which gets rendered |
|
528 |
* to the same offscreen buffer which then gets postprocessed in one go and subsequently merged to the |
|
529 |
* target Surface. |
|
530 |
*/ |
|
531 |
public void setPostprocessEffects(DistortedEffectsPostprocess dep) |
|
532 |
{ |
|
533 |
mPostprocess = dep; |
|
534 |
|
|
535 |
// TODO: rearrange all the siblings so that all are sorted by the DistortedEffectsPostprocess' ID. |
|
536 |
} |
|
537 |
|
|
524 | 538 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
525 | 539 |
/** |
526 | 540 |
* Returns the DistortedEffects object that's in the Node. |
... | ... | |
564 | 578 |
* @param b Write to the BLUE color channel when rendering this Node? |
565 | 579 |
* @param a Write to the ALPHA channel when rendering this Node? |
566 | 580 |
*/ |
581 |
@SuppressWarnings("unused") |
|
567 | 582 |
public void glColorMask(boolean r, boolean g, boolean b, boolean a) |
568 | 583 |
{ |
569 | 584 |
mState.glColorMask(r,g,b,a); |
... | ... | |
575 | 590 |
* |
576 | 591 |
* @param mask Write to the Depth buffer when rendering this Node? |
577 | 592 |
*/ |
593 |
@SuppressWarnings("unused") |
|
578 | 594 |
public void glDepthMask(boolean mask) |
579 | 595 |
{ |
580 | 596 |
mState.glDepthMask(mask); |
... | ... | |
586 | 602 |
* |
587 | 603 |
* @param mask Marks the bits of the Stencil buffer we will write to when rendering this Node. |
588 | 604 |
*/ |
605 |
@SuppressWarnings("unused") |
|
589 | 606 |
public void glStencilMask(int mask) |
590 | 607 |
{ |
591 | 608 |
mState.glStencilMask(mask); |
... | ... | |
597 | 614 |
* |
598 | 615 |
* @param test Valid values: GL_DEPTH_TEST, GL_STENCIL_TEST, GL_BLEND |
599 | 616 |
*/ |
617 |
@SuppressWarnings("unused") |
|
600 | 618 |
public void glEnable(int test) |
601 | 619 |
{ |
602 | 620 |
mState.glEnable(test); |
... | ... | |
608 | 626 |
* |
609 | 627 |
* @param test Valid values: GL_DEPTH_TEST, GL_STENCIL_TEST, GL_BLEND |
610 | 628 |
*/ |
629 |
@SuppressWarnings("unused") |
|
611 | 630 |
public void glDisable(int test) |
612 | 631 |
{ |
613 | 632 |
mState.glDisable(test); |
... | ... | |
621 | 640 |
* @param ref Reference valut to compare our stencil with. |
622 | 641 |
* @param mask Mask used when comparing. |
623 | 642 |
*/ |
643 |
@SuppressWarnings("unused") |
|
624 | 644 |
public void glStencilFunc(int func, int ref, int mask) |
625 | 645 |
{ |
626 | 646 |
mState.glStencilFunc(func,ref,mask); |
... | ... | |
636 | 656 |
* @param dpfail What to do when Depth Test fails. |
637 | 657 |
* @param dppass What to do when Depth Test passes. |
638 | 658 |
*/ |
659 |
@SuppressWarnings("unused") |
|
639 | 660 |
public void glStencilOp(int sfail, int dpfail, int dppass) |
640 | 661 |
{ |
641 | 662 |
mState.glStencilOp(sfail,dpfail,dppass); |
... | ... | |
647 | 668 |
* |
648 | 669 |
* @param func Valid values: GL_NEVER, GL_ALWAYS, GL_LESS, GL_LEQUAL, GL_EQUAL, GL_GEQUAL, GL_GREATER, GL_NOTEQUAL |
649 | 670 |
*/ |
671 |
@SuppressWarnings("unused") |
|
650 | 672 |
public void glDepthFunc(int func) |
651 | 673 |
{ |
652 | 674 |
mState.glDepthFunc(func); |
... | ... | |
663 | 685 |
* @param src Source Blend function |
664 | 686 |
* @param dst Destination Blend function |
665 | 687 |
*/ |
688 |
@SuppressWarnings("unused") |
|
666 | 689 |
public void glBlendFunc(int src, int dst) |
667 | 690 |
{ |
668 | 691 |
mState.glBlendFunc(src,dst); |
Also available in: Unified diff
Separate the Postprocessing Effects to their own DistortedEffectsPostprocess queue.
This partly breaks Multiblur (to be debugged)