Revision c834348d
Added by Leszek Koltunski about 7 years ago
src/main/java/org/distorted/library/DistortedNode.java | ||
---|---|---|
44 | 44 |
private MeshObject mMesh; |
45 | 45 |
private DistortedEffects mEffects; |
46 | 46 |
private DistortedInputSurface mSurface; |
47 |
private DistortedRenderState mState; |
|
47 | 48 |
private NodeData mData; |
48 | 49 |
|
49 | 50 |
private ArrayList<DistortedNode> mChildren; |
... | ... | |
227 | 228 |
if( input.setAsInput() ) |
228 | 229 |
{ |
229 | 230 |
ret++; |
231 |
mState.apply(); |
|
230 | 232 |
mEffects.drawPriv(halfX, halfY, mMesh, surface, currTime); |
231 | 233 |
} |
232 | 234 |
|
... | ... | |
248 | 250 |
mSurface = surface; |
249 | 251 |
mEffects = effects; |
250 | 252 |
mMesh = mesh; |
253 |
mState = new DistortedRenderState(); |
|
251 | 254 |
mChildren = null; |
252 | 255 |
mNumChildren = new int[1]; |
253 | 256 |
mNumChildren[0]= 0; |
... | ... | |
284 | 287 |
{ |
285 | 288 |
mEffects= new DistortedEffects(node.mEffects,flags); |
286 | 289 |
mMesh = node.mMesh; |
290 |
mState = new DistortedRenderState(); |
|
287 | 291 |
mParent = null; |
288 | 292 |
|
289 | 293 |
if( (flags & Distorted.CLONE_SURFACE) != 0 ) |
... | ... | |
521 | 525 |
return mData.mFBO; |
522 | 526 |
} |
523 | 527 |
|
528 |
|
|
529 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
530 |
/** |
|
531 |
* When rendering this Node, use ColorMask (r,g,b,a). |
|
532 |
* |
|
533 |
* @param r Write to the RED color channel when rendering this Node? |
|
534 |
* @param g Write to the GREEN color channel when rendering this Node? |
|
535 |
* @param b Write to the BLUE color channel when rendering this Node? |
|
536 |
* @param a Write to the ALPHA channel when rendering this Node? |
|
537 |
*/ |
|
538 |
public void glColorMask(boolean r, boolean g, boolean b, boolean a) |
|
539 |
{ |
|
540 |
mState.glColorMask(r,g,b,a); |
|
541 |
} |
|
542 |
|
|
543 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
544 |
/** |
|
545 |
* When rendering this Node, switch on writing to Depth buffer? |
|
546 |
* |
|
547 |
* @param mask Write to the Depth buffer when rendering this Node? |
|
548 |
*/ |
|
549 |
public void glDepthMask(boolean mask) |
|
550 |
{ |
|
551 |
mState.glDepthMask(mask); |
|
552 |
} |
|
553 |
|
|
554 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
555 |
/** |
|
556 |
* When rendering this Node, which bits of the Stencil buffer to write to? |
|
557 |
* |
|
558 |
* @param mask Marks the bits of the Stencil buffer we will write to when rendering this Node. |
|
559 |
*/ |
|
560 |
public void glStencilMask(int mask) |
|
561 |
{ |
|
562 |
mState.glStencilMask(mask); |
|
563 |
} |
|
564 |
|
|
565 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
566 |
/** |
|
567 |
* When rendering this Node, which Tests to enable? |
|
568 |
* |
|
569 |
* @param test Valid values: GL_DEPTH_TEST, GL_STENCIL_TEST, GL_BLEND |
|
570 |
*/ |
|
571 |
public void glEnable(int test) |
|
572 |
{ |
|
573 |
mState.glEnable(test); |
|
574 |
} |
|
575 |
|
|
576 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
577 |
/** |
|
578 |
* When rendering this Node, which Tests to enable? |
|
579 |
* |
|
580 |
* @param test Valid values: GL_DEPTH_TEST, GL_STENCIL_TEST, GL_BLEND |
|
581 |
*/ |
|
582 |
public void glDisable(int test) |
|
583 |
{ |
|
584 |
mState.glDisable(test); |
|
585 |
} |
|
586 |
|
|
587 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
588 |
/** |
|
589 |
* When rendering this Node, use the following StencilFunc. |
|
590 |
* |
|
591 |
* @param func Valid values: GL_NEVER, GL_ALWAYS, GL_LESS, GL_LEQUAL, GL_EQUAL, GL_GEQUAL, GL_GREATER, GL_NOTEQUAL |
|
592 |
* @param ref Reference valut to compare our stencil with. |
|
593 |
* @param mask Mask used when comparing. |
|
594 |
*/ |
|
595 |
public void glStencilFunc(int func, int ref, int mask) |
|
596 |
{ |
|
597 |
mState.glStencilFunc(func,ref,mask); |
|
598 |
} |
|
599 |
|
|
600 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
601 |
/** |
|
602 |
* When rendering this Node, use the following StencilOp. |
|
603 |
* <p> |
|
604 |
* Valid values of all 3 parameters: GL_KEEP, GL_ZERO, GL_REPLACE, GL_INCR, GL_DECR, GL_INVERT, GL_INCR_WRAP, GL_DECR_WRAP |
|
605 |
* |
|
606 |
* @param sfail What to do when Stencil Test fails. |
|
607 |
* @param dpfail What to do when Depth Test fails. |
|
608 |
* @param dppass What to do when Depth Test passes. |
|
609 |
*/ |
|
610 |
public void glStencilOp(int sfail, int dpfail, int dppass) |
|
611 |
{ |
|
612 |
mState.glStencilOp(sfail,dpfail,dppass); |
|
613 |
} |
|
614 |
|
|
615 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
616 |
/** |
|
617 |
* When rendering this Node, use the following DepthFunc. |
|
618 |
* |
|
619 |
* @param func Valid values: GL_NEVER, GL_ALWAYS, GL_LESS, GL_LEQUAL, GL_EQUAL, GL_GEQUAL, GL_GREATER, GL_NOTEQUAL |
|
620 |
*/ |
|
621 |
public void glDepthFunc(int func) |
|
622 |
{ |
|
623 |
mState.glDepthFunc(func); |
|
624 |
} |
|
625 |
|
|
626 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
627 |
/** |
|
628 |
* When rendering this Node, use the following Blending mode. |
|
629 |
* <p> |
|
630 |
* Valid values: GL_ZERO, GL_ONE, GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR, GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, |
|
631 |
* GL_DST_ALPHA, GL_ONE_MINUS_DST_ALPHA, GL_CONSTANT_COLOR, GL_ONE_MINUS_CONSTANT_COLOR, |
|
632 |
* GL_CONSTANT_ALPHA, GL_ONE_MINUS_CONSTANT_ALPHA, GL_SRC_ALPHA_SATURATE |
|
633 |
* |
|
634 |
* @param src Source Blend function |
|
635 |
* @param dst Destination Blend function |
|
636 |
*/ |
|
637 |
public void glBlendFunc(int src, int dst) |
|
638 |
{ |
|
639 |
mState.glBlendFunc(src,dst); |
|
640 |
} |
|
524 | 641 |
} |
Also available in: Unified diff
Make it possible to render each DistortedNode with adjustable OpeGL state (writeing to Color, Depth,Stencil buffers, DEPTH, STENCIL, BLENDING on.off, etc)