abstractEngine.states.js 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. import { AbstractEngine } from "../abstractEngine.js";
  2. AbstractEngine.prototype.getInputElement = function () {
  3. return this._renderingCanvas;
  4. };
  5. AbstractEngine.prototype.getDepthFunction = function () {
  6. return this._depthCullingState.depthFunc;
  7. };
  8. AbstractEngine.prototype.setDepthFunction = function (depthFunc) {
  9. this._depthCullingState.depthFunc = depthFunc;
  10. };
  11. AbstractEngine.prototype.setDepthFunctionToGreater = function () {
  12. this.setDepthFunction(516);
  13. };
  14. AbstractEngine.prototype.setDepthFunctionToGreaterOrEqual = function () {
  15. this.setDepthFunction(518);
  16. };
  17. AbstractEngine.prototype.setDepthFunctionToLess = function () {
  18. this.setDepthFunction(513);
  19. };
  20. AbstractEngine.prototype.setDepthFunctionToLessOrEqual = function () {
  21. this.setDepthFunction(515);
  22. };
  23. AbstractEngine.prototype.getDepthWrite = function () {
  24. return this._depthCullingState.depthMask;
  25. };
  26. AbstractEngine.prototype.setDepthWrite = function (enable) {
  27. this._depthCullingState.depthMask = enable;
  28. };
  29. AbstractEngine.prototype.getStencilBuffer = function () {
  30. return this._stencilState.stencilTest;
  31. };
  32. AbstractEngine.prototype.setStencilBuffer = function (enable) {
  33. this._stencilState.stencilTest = enable;
  34. };
  35. AbstractEngine.prototype.getStencilMask = function () {
  36. return this._stencilState.stencilMask;
  37. };
  38. AbstractEngine.prototype.setStencilMask = function (mask) {
  39. this._stencilState.stencilMask = mask;
  40. };
  41. AbstractEngine.prototype.getStencilFunction = function () {
  42. return this._stencilState.stencilFunc;
  43. };
  44. AbstractEngine.prototype.getStencilFunctionReference = function () {
  45. return this._stencilState.stencilFuncRef;
  46. };
  47. AbstractEngine.prototype.getStencilFunctionMask = function () {
  48. return this._stencilState.stencilFuncMask;
  49. };
  50. AbstractEngine.prototype.setStencilFunction = function (stencilFunc) {
  51. this._stencilState.stencilFunc = stencilFunc;
  52. };
  53. AbstractEngine.prototype.setStencilFunctionReference = function (reference) {
  54. this._stencilState.stencilFuncRef = reference;
  55. };
  56. AbstractEngine.prototype.setStencilFunctionMask = function (mask) {
  57. this._stencilState.stencilFuncMask = mask;
  58. };
  59. AbstractEngine.prototype.getStencilOperationFail = function () {
  60. return this._stencilState.stencilOpStencilFail;
  61. };
  62. AbstractEngine.prototype.getStencilOperationDepthFail = function () {
  63. return this._stencilState.stencilOpDepthFail;
  64. };
  65. AbstractEngine.prototype.getStencilOperationPass = function () {
  66. return this._stencilState.stencilOpStencilDepthPass;
  67. };
  68. AbstractEngine.prototype.setStencilOperationFail = function (operation) {
  69. this._stencilState.stencilOpStencilFail = operation;
  70. };
  71. AbstractEngine.prototype.setStencilOperationDepthFail = function (operation) {
  72. this._stencilState.stencilOpDepthFail = operation;
  73. };
  74. AbstractEngine.prototype.setStencilOperationPass = function (operation) {
  75. this._stencilState.stencilOpStencilDepthPass = operation;
  76. };
  77. AbstractEngine.prototype.cacheStencilState = function () {
  78. this._cachedStencilBuffer = this.getStencilBuffer();
  79. this._cachedStencilFunction = this.getStencilFunction();
  80. this._cachedStencilMask = this.getStencilMask();
  81. this._cachedStencilOperationPass = this.getStencilOperationPass();
  82. this._cachedStencilOperationFail = this.getStencilOperationFail();
  83. this._cachedStencilOperationDepthFail = this.getStencilOperationDepthFail();
  84. this._cachedStencilReference = this.getStencilFunctionReference();
  85. };
  86. AbstractEngine.prototype.restoreStencilState = function () {
  87. this.setStencilFunction(this._cachedStencilFunction);
  88. this.setStencilMask(this._cachedStencilMask);
  89. this.setStencilBuffer(this._cachedStencilBuffer);
  90. this.setStencilOperationPass(this._cachedStencilOperationPass);
  91. this.setStencilOperationFail(this._cachedStencilOperationFail);
  92. this.setStencilOperationDepthFail(this._cachedStencilOperationDepthFail);
  93. this.setStencilFunctionReference(this._cachedStencilReference);
  94. };
  95. AbstractEngine.prototype.setAlphaConstants = function (r, g, b, a) {
  96. this._alphaState.setAlphaBlendConstants(r, g, b, a);
  97. };
  98. AbstractEngine.prototype.getAlphaMode = function () {
  99. return this._alphaMode;
  100. };
  101. AbstractEngine.prototype.getAlphaEquation = function () {
  102. return this._alphaEquation;
  103. };
  104. //# sourceMappingURL=abstractEngine.states.js.map