stencilState.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /**
  2. * @internal
  3. **/
  4. export class StencilState {
  5. constructor() {
  6. this.reset();
  7. }
  8. reset() {
  9. this.enabled = false;
  10. this.mask = 0xff;
  11. this.func = StencilState.ALWAYS;
  12. this.funcRef = 1;
  13. this.funcMask = 0xff;
  14. this.opStencilFail = StencilState.KEEP;
  15. this.opDepthFail = StencilState.KEEP;
  16. this.opStencilDepthPass = StencilState.REPLACE;
  17. }
  18. get stencilFunc() {
  19. return this.func;
  20. }
  21. set stencilFunc(value) {
  22. this.func = value;
  23. }
  24. get stencilFuncRef() {
  25. return this.funcRef;
  26. }
  27. set stencilFuncRef(value) {
  28. this.funcRef = value;
  29. }
  30. get stencilFuncMask() {
  31. return this.funcMask;
  32. }
  33. set stencilFuncMask(value) {
  34. this.funcMask = value;
  35. }
  36. get stencilOpStencilFail() {
  37. return this.opStencilFail;
  38. }
  39. set stencilOpStencilFail(value) {
  40. this.opStencilFail = value;
  41. }
  42. get stencilOpDepthFail() {
  43. return this.opDepthFail;
  44. }
  45. set stencilOpDepthFail(value) {
  46. this.opDepthFail = value;
  47. }
  48. get stencilOpStencilDepthPass() {
  49. return this.opStencilDepthPass;
  50. }
  51. set stencilOpStencilDepthPass(value) {
  52. this.opStencilDepthPass = value;
  53. }
  54. get stencilMask() {
  55. return this.mask;
  56. }
  57. set stencilMask(value) {
  58. this.mask = value;
  59. }
  60. get stencilTest() {
  61. return this.enabled;
  62. }
  63. set stencilTest(value) {
  64. this.enabled = value;
  65. }
  66. }
  67. /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will always pass. i.e. Pixels will be drawn in the order they are drawn */
  68. StencilState.ALWAYS = 519;
  69. /** Passed to stencilOperation to specify that stencil value must be kept */
  70. StencilState.KEEP = 7680;
  71. /** Passed to stencilOperation to specify that stencil value must be replaced */
  72. StencilState.REPLACE = 7681;
  73. //# sourceMappingURL=stencilState.js.map