Revision 8c57d77b
Added by Leszek Koltunski about 1 year ago
src/main/java/org/distorted/library/main/InternalRenderState.java | ||
---|---|---|
273 | 273 |
if( cState.stencilTest!=0 ) |
274 | 274 |
{ |
275 | 275 |
cState.stencilTest = 0; |
276 |
//android.util.Log.d("State", "stencil test off");
|
|
276 |
//DistortedLibrary.logMessage("InternalRenderState: stencil test off");
|
|
277 | 277 |
GLES30.glDisable(GLES30.GL_STENCIL_TEST); |
278 | 278 |
} |
279 | 279 |
|
... | ... | |
282 | 282 |
if( cState.depthTest!=0 ) |
283 | 283 |
{ |
284 | 284 |
cState.depthTest = 0; |
285 |
//android.util.Log.d("State", "depth test off");
|
|
285 |
//DistortedLibrary.logMessage("InternalRenderState: depth test off");
|
|
286 | 286 |
GLES30.glDisable(GLES30.GL_DEPTH_TEST); |
287 | 287 |
} |
288 | 288 |
|
... | ... | |
297 | 297 |
cState.colorMaskG = 0; |
298 | 298 |
cState.colorMaskB = 0; |
299 | 299 |
cState.colorMaskA = 0; |
300 |
//android.util.Log.d("State", "switch off color writing");
|
|
300 |
//DistortedLibrary.logMessage("InternalRenderState: switch off color writing");
|
|
301 | 301 |
GLES30.glColorMask(false,false,false,false); |
302 | 302 |
} |
303 | 303 |
|
... | ... | |
306 | 306 |
if( cState.depthMask!=0 ) |
307 | 307 |
{ |
308 | 308 |
cState.depthMask = 0; |
309 |
//android.util.Log.d("State", "switch off depth writing");
|
|
309 |
//DistortedLibrary.logMessage("InternalRenderState: switch off depth writing");
|
|
310 | 310 |
GLES30.glDepthMask(false); |
311 | 311 |
} |
312 | 312 |
|
... | ... | |
315 | 315 |
if( cState.stencilMask!= 0x00 ) |
316 | 316 |
{ |
317 | 317 |
cState.stencilMask = 0x00; |
318 |
//android.util.Log.d("State", "stencil mask off");
|
|
318 |
//DistortedLibrary.logMessage("InternalRenderState: stencil mask off");
|
|
319 | 319 |
GLES30.glStencilMask(cState.stencilMask); |
320 | 320 |
} |
321 | 321 |
} |
... | ... | |
329 | 329 |
if( cState.stencilTest!=0 ) |
330 | 330 |
{ |
331 | 331 |
cState.stencilTest = 0; |
332 |
//android.util.Log.d("State", "stencil test off");
|
|
332 |
//DistortedLibrary.logMessage("InternalRenderState: stencil test off");
|
|
333 | 333 |
GLES30.glDisable(GLES30.GL_STENCIL_TEST); |
334 | 334 |
} |
335 | 335 |
|
... | ... | |
338 | 338 |
if( cState.depthTest!=0 ) |
339 | 339 |
{ |
340 | 340 |
cState.depthTest = 0; |
341 |
//android.util.Log.d("State", "depth test off");
|
|
341 |
//DistortedLibrary.logMessage("InternalRenderState: depth test off");
|
|
342 | 342 |
GLES30.glDisable(GLES30.GL_DEPTH_TEST); |
343 | 343 |
} |
344 | 344 |
|
... | ... | |
353 | 353 |
cState.colorMaskG = 1; |
354 | 354 |
cState.colorMaskB = 1; |
355 | 355 |
cState.colorMaskA = 1; |
356 |
//android.util.Log.d("State", "switch on color writing");
|
|
356 |
//DistortedLibrary.logMessage("InternalRenderState: switch on color writing");
|
|
357 | 357 |
GLES30.glColorMask(true,true,true,true); |
358 | 358 |
} |
359 | 359 |
|
... | ... | |
362 | 362 |
if( cState.depthMask!=1 ) |
363 | 363 |
{ |
364 | 364 |
cState.depthMask = 1; |
365 |
//android.util.Log.d("State", "switch on depth writing");
|
|
365 |
//DistortedLibrary.logMessage("InternalRenderState: switch on depth writing");
|
|
366 | 366 |
GLES30.glDepthMask(true); |
367 | 367 |
} |
368 | 368 |
|
... | ... | |
371 | 371 |
if( cState.stencilMask!= 0x00 ) |
372 | 372 |
{ |
373 | 373 |
cState.stencilMask = 0x00; |
374 |
//android.util.Log.d("State", "stencil mask off");
|
|
374 |
//DistortedLibrary.logMessage("InternalRenderState: stencil mask off");
|
|
375 | 375 |
GLES30.glStencilMask(cState.stencilMask); |
376 | 376 |
} |
377 | 377 |
} |
... | ... | |
435 | 435 |
if( cState.stencilTest!=1 ) |
436 | 436 |
{ |
437 | 437 |
cState.stencilTest = 1; |
438 |
//android.util.Log.d("State", "stencil test on");
|
|
438 |
//DistortedLibrary.logMessage("InternalRenderState: stencil test on");
|
|
439 | 439 |
GLES30.glEnable(GLES30.GL_STENCIL_TEST); |
440 | 440 |
} |
441 | 441 |
|
... | ... | |
448 | 448 |
cState.stencilFuncFunc = GLES30.GL_ALWAYS; |
449 | 449 |
cState.stencilFuncRef = 1; |
450 | 450 |
cState.stencilFuncMask = STENCIL_MASK; |
451 |
//android.util.Log.d("State", "stencil func on");
|
|
451 |
//DistortedLibrary.logMessage("InternalRenderState: stencil func on");
|
|
452 | 452 |
GLES30.glStencilFunc(cState.stencilFuncFunc,cState.stencilFuncRef,cState.stencilFuncMask); |
453 | 453 |
} |
454 | 454 |
|
... | ... | |
461 | 461 |
cState.stencilOpSfail = GLES30.GL_KEEP; |
462 | 462 |
cState.stencilOpDpfail= GLES30.GL_KEEP; |
463 | 463 |
cState.stencilOpDppass= GLES30.GL_REPLACE; |
464 |
//android.util.Log.d("State", "stencil op on");
|
|
464 |
//DistortedLibrary.logMessage("InternalRenderState: stencil op on");
|
|
465 | 465 |
GLES30.glStencilOp(cState.stencilOpSfail,cState.stencilOpDpfail,cState.stencilOpDppass); |
466 | 466 |
} |
467 | 467 |
|
... | ... | |
478 | 478 |
cState.colorMaskG = clr; |
479 | 479 |
cState.colorMaskB = clr; |
480 | 480 |
cState.colorMaskA = clr; |
481 |
//android.util.Log.d("State", "switch off color writing");
|
|
481 |
//DistortedLibrary.logMessage("InternalRenderState: switch off color writing");
|
|
482 | 482 |
GLES30.glColorMask(color,color,color,color); |
483 | 483 |
} |
484 | 484 |
|
... | ... | |
487 | 487 |
if( cState.depthMask!=1 ) |
488 | 488 |
{ |
489 | 489 |
cState.depthMask = 1; |
490 |
//android.util.Log.d("State", "switch on depth writing");
|
|
490 |
//DistortedLibrary.logMessage("InternalRenderState: switch on depth writing");
|
|
491 | 491 |
GLES30.glDepthMask(true); |
492 | 492 |
} |
493 | 493 |
|
... | ... | |
496 | 496 |
if( cState.stencilMask!= STENCIL_MASK ) |
497 | 497 |
{ |
498 | 498 |
cState.stencilMask = STENCIL_MASK; |
499 |
//android.util.Log.d("State", "stencil mask on");
|
|
499 |
//DistortedLibrary.logMessage("InternalRenderState: stencil mask on");
|
|
500 | 500 |
GLES30.glStencilMask(cState.stencilMask); |
501 | 501 |
} |
502 | 502 |
} |
... | ... | |
648 | 648 |
|
649 | 649 |
void apply() |
650 | 650 |
{ |
651 |
//android.util.Log.e("State", "APPLYING STATE");
|
|
651 |
//DistortedLibrary.logMessage("InternalRenderState: APPLYING STATE");
|
|
652 | 652 |
|
653 | 653 |
///////////////////////////////////////////////////// |
654 | 654 |
// 1. Write to color buffer? |
655 | 655 |
if( mState.colorMaskR!=cState.colorMaskR || mState.colorMaskG!=cState.colorMaskG || mState.colorMaskB!=cState.colorMaskB || mState.colorMaskA!=cState.colorMaskA) |
656 | 656 |
{ |
657 |
//android.util.Log.d("State", "setting color mask");
|
|
657 |
//DistortedLibrary.logMessage("InternalRenderState: setting color mask");
|
|
658 | 658 |
cState.colorMaskR = mState.colorMaskR; |
659 | 659 |
cState.colorMaskG = mState.colorMaskG; |
660 | 660 |
cState.colorMaskB = mState.colorMaskB; |
... | ... | |
670 | 670 |
|
671 | 671 |
if (cState.depthTest == 0) |
672 | 672 |
{ |
673 |
//android.util.Log.d("State", "disabling depth test");
|
|
673 |
//DistortedLibrary.logMessage("InternalRenderState: disabling depth test");
|
|
674 | 674 |
GLES30.glDisable(GLES30.GL_DEPTH_TEST); |
675 | 675 |
} |
676 | 676 |
else |
677 | 677 |
{ |
678 |
//android.util.Log.d("State", "enable depth test");
|
|
678 |
//DistortedLibrary.logMessage("InternalRenderState: enable depth test");
|
|
679 | 679 |
GLES30.glEnable(GLES30.GL_DEPTH_TEST); |
680 | 680 |
} |
681 | 681 |
} |
... | ... | |
684 | 684 |
// 3. Change Depth Function? |
685 | 685 |
if( mState.depthFunc!=cState.depthFunc ) |
686 | 686 |
{ |
687 |
//android.util.Log.d("State", "setting depth func");
|
|
687 |
//DistortedLibrary.logMessage("InternalRenderState: setting depth func");
|
|
688 | 688 |
cState.depthFunc = mState.depthFunc; |
689 | 689 |
GLES30.glDepthFunc(cState.depthFunc); |
690 | 690 |
} |
... | ... | |
693 | 693 |
// 4. Write to Depth buffer? |
694 | 694 |
if( mState.depthMask!=cState.depthMask ) |
695 | 695 |
{ |
696 |
//android.util.Log.d("State", "setting depth mask");
|
|
696 |
//DistortedLibrary.logMessage("InternalRenderState: setting depth mask");
|
|
697 | 697 |
cState.depthMask = mState.depthMask; |
698 | 698 |
GLES30.glDepthMask(cState.depthMask==1); |
699 | 699 |
} |
... | ... | |
706 | 706 |
|
707 | 707 |
if (cState.blend == 0) |
708 | 708 |
{ |
709 |
//android.util.Log.d("State", "disabling blending");
|
|
709 |
//DistortedLibrary.logMessage("InternalRenderState: disabling blending");
|
|
710 | 710 |
GLES30.glDisable(GLES30.GL_BLEND); |
711 | 711 |
} |
712 | 712 |
else |
713 | 713 |
{ |
714 |
//android.util.Log.d("State", "enabling blending");
|
|
714 |
//DistortedLibrary.logMessage("InternalRenderState: enabling blending");
|
|
715 | 715 |
GLES30.glEnable(GLES30.GL_BLEND); |
716 | 716 |
} |
717 | 717 |
} |
... | ... | |
720 | 720 |
// 6. Change Blend function? |
721 | 721 |
if( mState.blendSrc!=cState.blendSrc || mState.blendDst!=cState.blendDst ) |
722 | 722 |
{ |
723 |
//android.util.Log.d("State", "setting blend function");
|
|
723 |
//DistortedLibrary.logMessage("InternalRenderState: setting blend function");
|
|
724 | 724 |
cState.blendSrc = mState.blendSrc; |
725 | 725 |
cState.blendDst = mState.blendDst; |
726 | 726 |
GLES30.glBlendFunc(cState.blendSrc,cState.blendDst); |
... | ... | |
734 | 734 |
|
735 | 735 |
if (cState.stencilTest == 0) |
736 | 736 |
{ |
737 |
//android.util.Log.d("State", "disabling stencil test");
|
|
737 |
//DistortedLibrary.logMessage("InternalRenderState: disabling stencil test");
|
|
738 | 738 |
GLES30.glDisable(GLES30.GL_STENCIL_TEST); |
739 | 739 |
} |
740 | 740 |
else |
741 | 741 |
{ |
742 |
//android.util.Log.d("State", "enabling stencil test");
|
|
742 |
//DistortedLibrary.logMessage("InternalRenderState: enabling stencil test");
|
|
743 | 743 |
GLES30.glEnable(GLES30.GL_STENCIL_TEST); |
744 | 744 |
} |
745 | 745 |
} |
... | ... | |
748 | 748 |
// 8. Adjust Stencil function? |
749 | 749 |
if( mState.stencilFuncFunc!=cState.stencilFuncFunc || mState.stencilFuncRef!=cState.stencilFuncRef || mState.stencilFuncMask!=cState.stencilFuncMask ) |
750 | 750 |
{ |
751 |
//android.util.Log.d("State", "setting stencil function");
|
|
751 |
//DistortedLibrary.logMessage("InternalRenderState: setting stencil function");
|
|
752 | 752 |
cState.stencilFuncFunc = mState.stencilFuncFunc; |
753 | 753 |
cState.stencilFuncRef = mState.stencilFuncRef ; |
754 | 754 |
cState.stencilFuncMask = mState.stencilFuncMask; |
... | ... | |
759 | 759 |
// 9. Adjust Stencil operation? |
760 | 760 |
if( mState.stencilOpSfail!=cState.stencilOpSfail || mState.stencilOpDpfail!=cState.stencilOpDpfail || mState.stencilOpDppass!=cState.stencilOpDppass ) |
761 | 761 |
{ |
762 |
//android.util.Log.d("State", "setting stencil op");
|
|
762 |
//DistortedLibrary.logMessage("InternalRenderState: setting stencil op");
|
|
763 | 763 |
cState.stencilOpSfail = mState.stencilOpSfail; |
764 | 764 |
cState.stencilOpDpfail= mState.stencilOpDpfail; |
765 | 765 |
cState.stencilOpDppass= mState.stencilOpDppass; |
... | ... | |
770 | 770 |
// 10. Write to Stencil buffer? |
771 | 771 |
if( mState.stencilMask!=cState.stencilMask ) |
772 | 772 |
{ |
773 |
//android.util.Log.d("State", "setting stencil mask");
|
|
773 |
//DistortedLibrary.logMessage("InternalRenderState: setting stencil mask");
|
|
774 | 774 |
cState.stencilMask = mState.stencilMask; |
775 | 775 |
GLES30.glStencilMask(cState.stencilMask); |
776 | 776 |
} |
... | ... | |
779 | 779 |
// 11. Clear buffers? |
780 | 780 |
if( mClear!=0 ) |
781 | 781 |
{ |
782 |
//android.util.Log.d("State", "clearing buffer");
|
|
782 |
//DistortedLibrary.logMessage("InternalRenderState: clearing buffer");
|
|
783 | 783 |
GLES30.glClear(mClear); |
784 | 784 |
} |
785 | 785 |
} |
Also available in: Unified diff
Decouple (to a large degree) the OpenGL Library from Android.