abstractEngine.states.d.ts 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. import type { Nullable } from "../../types";
  2. declare module "../../Engines/abstractEngine" {
  3. interface AbstractEngine {
  4. /** @internal */
  5. _cachedStencilBuffer: boolean;
  6. /** @internal */
  7. _cachedStencilFunction: number;
  8. /** @internal */
  9. _cachedStencilMask: number;
  10. /** @internal */
  11. _cachedStencilOperationPass: number;
  12. /** @internal */
  13. _cachedStencilOperationFail: number;
  14. /** @internal */
  15. _cachedStencilOperationDepthFail: number;
  16. /** @internal */
  17. _cachedStencilReference: number;
  18. /**
  19. * Gets the current depth function
  20. * @returns a number defining the depth function
  21. */
  22. getDepthFunction(): Nullable<number>;
  23. /**
  24. * Sets the current depth function
  25. * @param depthFunc defines the function to use
  26. */
  27. setDepthFunction(depthFunc: number): void;
  28. /**
  29. * Sets the current depth function to GREATER
  30. */
  31. setDepthFunctionToGreater(): void;
  32. /**
  33. * Sets the current depth function to GEQUAL
  34. */
  35. setDepthFunctionToGreaterOrEqual(): void;
  36. /**
  37. * Sets the current depth function to LESS
  38. */
  39. setDepthFunctionToLess(): void;
  40. /**
  41. * Sets the current depth function to LEQUAL
  42. */
  43. setDepthFunctionToLessOrEqual(): void;
  44. /**
  45. * Gets a boolean indicating if depth writing is enabled
  46. * @returns the current depth writing state
  47. */
  48. getDepthWrite(): boolean;
  49. /**
  50. * Enable or disable depth writing
  51. * @param enable defines the state to set
  52. */
  53. setDepthWrite(enable: boolean): void;
  54. /**
  55. * Gets the current stencil operation when stencil passes
  56. * @returns a number defining stencil operation to use when stencil passes
  57. */
  58. getStencilOperationPass(): number;
  59. /**
  60. * Gets a boolean indicating if stencil buffer is enabled
  61. * @returns the current stencil buffer state
  62. */
  63. getStencilBuffer(): boolean;
  64. /**
  65. * Enable or disable the stencil buffer
  66. * @param enable defines if the stencil buffer must be enabled or disabled
  67. */
  68. setStencilBuffer(enable: boolean): void;
  69. /**
  70. * Gets the current stencil mask
  71. * @returns a number defining the new stencil mask to use
  72. */
  73. getStencilMask(): number;
  74. /**
  75. * Sets the current stencil mask
  76. * @param mask defines the new stencil mask to use
  77. */
  78. setStencilMask(mask: number): void;
  79. /**
  80. * Gets the current stencil function
  81. * @returns a number defining the stencil function to use
  82. */
  83. getStencilFunction(): number;
  84. /**
  85. * Gets the current stencil reference value
  86. * @returns a number defining the stencil reference value to use
  87. */
  88. getStencilFunctionReference(): number;
  89. /**
  90. * Gets the current stencil mask
  91. * @returns a number defining the stencil mask to use
  92. */
  93. getStencilFunctionMask(): number;
  94. /**
  95. * Sets the current stencil function
  96. * @param stencilFunc defines the new stencil function to use
  97. */
  98. setStencilFunction(stencilFunc: number): void;
  99. /**
  100. * Sets the current stencil reference
  101. * @param reference defines the new stencil reference to use
  102. */
  103. setStencilFunctionReference(reference: number): void;
  104. /**
  105. * Sets the current stencil mask
  106. * @param mask defines the new stencil mask to use
  107. */
  108. setStencilFunctionMask(mask: number): void;
  109. /**
  110. * Gets the current stencil operation when stencil fails
  111. * @returns a number defining stencil operation to use when stencil fails
  112. */
  113. getStencilOperationFail(): number;
  114. /**
  115. * Gets the current stencil operation when depth fails
  116. * @returns a number defining stencil operation to use when depth fails
  117. */
  118. getStencilOperationDepthFail(): number;
  119. /**
  120. * Sets the stencil operation to use when stencil fails
  121. * @param operation defines the stencil operation to use when stencil fails
  122. */
  123. setStencilOperationFail(operation: number): void;
  124. /**
  125. * Sets the stencil operation to use when depth fails
  126. * @param operation defines the stencil operation to use when depth fails
  127. */
  128. setStencilOperationDepthFail(operation: number): void;
  129. /**
  130. * Sets the stencil operation to use when stencil passes
  131. * @param operation defines the stencil operation to use when stencil passes
  132. */
  133. setStencilOperationPass(operation: number): void;
  134. /**
  135. * Caches the state of the stencil buffer
  136. */
  137. cacheStencilState(): void;
  138. /**
  139. * Restores the state of the stencil buffer
  140. */
  141. restoreStencilState(): void;
  142. /**
  143. * Sets alpha constants used by some alpha blending modes
  144. * @param r defines the red component
  145. * @param g defines the green component
  146. * @param b defines the blue component
  147. * @param a defines the alpha component
  148. */
  149. setAlphaConstants(r: number, g: number, b: number, a: number): void;
  150. /**
  151. * Gets the current alpha mode
  152. * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/advanced/transparent_rendering
  153. * @returns the current alpha mode
  154. */
  155. getAlphaMode(): number;
  156. /**
  157. * Gets the current alpha equation.
  158. * @returns the current alpha equation
  159. */
  160. getAlphaEquation(): number;
  161. }
  162. }