@babylonjs/core 5.35.0 → 5.36.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (250) hide show
  1. package/Audio/sound.d.ts +5 -0
  2. package/Audio/sound.js +7 -0
  3. package/Audio/sound.js.map +1 -1
  4. package/Debug/physicsViewer.d.ts +4 -3
  5. package/Debug/physicsViewer.js +2 -2
  6. package/Debug/physicsViewer.js.map +1 -1
  7. package/Engines/Extensions/engine.renderTarget.js +15 -15
  8. package/Engines/Extensions/engine.renderTarget.js.map +1 -1
  9. package/Engines/Extensions/engine.renderTargetCube.d.ts +1 -1
  10. package/Engines/Extensions/engine.renderTargetCube.js.map +1 -1
  11. package/Engines/Extensions/engine.views.d.ts +4 -0
  12. package/Engines/Extensions/engine.views.js +61 -42
  13. package/Engines/Extensions/engine.views.js.map +1 -1
  14. package/Engines/Native/nativeHardwareTexture.d.ts +14 -0
  15. package/Engines/Native/nativeHardwareTexture.js +24 -0
  16. package/Engines/Native/nativeHardwareTexture.js.map +1 -0
  17. package/Engines/Native/nativeInterfaces.d.ts +22 -15
  18. package/Engines/Native/nativeInterfaces.js.map +1 -1
  19. package/Engines/Native/nativePipelineContext.d.ts +252 -0
  20. package/Engines/Native/nativePipelineContext.js +502 -0
  21. package/Engines/Native/nativePipelineContext.js.map +1 -0
  22. package/Engines/Native/nativeRenderTargetWrapper.d.ts +16 -0
  23. package/Engines/Native/nativeRenderTargetWrapper.js +33 -0
  24. package/Engines/Native/nativeRenderTargetWrapper.js.map +1 -0
  25. package/Engines/WebGPU/Extensions/engine.renderTarget.js +3 -3
  26. package/Engines/WebGPU/Extensions/engine.renderTarget.js.map +1 -1
  27. package/Engines/WebGPU/Extensions/engine.renderTargetCube.js.map +1 -1
  28. package/Engines/engine.d.ts +1 -0
  29. package/Engines/engine.js +24 -18
  30. package/Engines/engine.js.map +1 -1
  31. package/Engines/nativeEngine.d.ts +18 -17
  32. package/Engines/nativeEngine.js +100 -598
  33. package/Engines/nativeEngine.js.map +1 -1
  34. package/Engines/nullEngine.d.ts +1 -1
  35. package/Engines/nullEngine.js.map +1 -1
  36. package/Engines/thinEngine.d.ts +1 -1
  37. package/Engines/thinEngine.js +41 -38
  38. package/Engines/thinEngine.js.map +1 -1
  39. package/Engines/webgpuEngine.js.map +1 -1
  40. package/Gizmos/planeRotationGizmo.js +3 -1
  41. package/Gizmos/planeRotationGizmo.js.map +1 -1
  42. package/Inputs/scene.inputManager.js +4 -4
  43. package/Inputs/scene.inputManager.js.map +1 -1
  44. package/Loading/Plugins/babylonFileLoader.js +3 -3
  45. package/Loading/Plugins/babylonFileLoader.js.map +1 -1
  46. package/Materials/Node/Blocks/Dual/textureBlock.js +1 -1
  47. package/Materials/Node/Blocks/Dual/textureBlock.js.map +1 -1
  48. package/Materials/Node/nodeMaterial.d.ts +19 -1
  49. package/Materials/Node/nodeMaterial.js +30 -0
  50. package/Materials/Node/nodeMaterial.js.map +1 -1
  51. package/Materials/Node/nodeMaterialBuildStateSharedData.d.ts +2 -8
  52. package/Materials/Node/nodeMaterialBuildStateSharedData.js.map +1 -1
  53. package/Materials/Textures/baseTexture.d.ts +2 -1
  54. package/Materials/Textures/baseTexture.js +3 -2
  55. package/Materials/Textures/baseTexture.js.map +1 -1
  56. package/Materials/Textures/internalTexture.d.ts +2 -0
  57. package/Materials/Textures/internalTexture.js +4 -0
  58. package/Materials/Textures/internalTexture.js.map +1 -1
  59. package/Materials/Textures/mirrorTexture.js +0 -2
  60. package/Materials/Textures/mirrorTexture.js.map +1 -1
  61. package/Materials/Textures/renderTargetTexture.d.ts +53 -3
  62. package/Materials/Textures/renderTargetTexture.js +25 -25
  63. package/Materials/Textures/renderTargetTexture.js.map +1 -1
  64. package/Materials/Textures/texture.d.ts +2 -0
  65. package/Materials/Textures/texture.js +35 -7
  66. package/Materials/Textures/texture.js.map +1 -1
  67. package/Materials/Textures/textureCreationOptions.d.ts +4 -1
  68. package/Materials/Textures/textureCreationOptions.js.map +1 -1
  69. package/Materials/material.js +1 -1
  70. package/Materials/material.js.map +1 -1
  71. package/Meshes/abstractMesh.d.ts +4 -4
  72. package/Meshes/abstractMesh.js +4 -4
  73. package/Meshes/abstractMesh.js.map +1 -1
  74. package/Meshes/mesh.d.ts +2 -2
  75. package/Meshes/mesh.js +1 -1
  76. package/Meshes/mesh.js.map +1 -1
  77. package/Misc/copyTextureToTexture.d.ts +9 -2
  78. package/Misc/copyTextureToTexture.js +23 -1
  79. package/Misc/copyTextureToTexture.js.map +1 -1
  80. package/Particles/IParticleSystem.d.ts +15 -1
  81. package/Particles/IParticleSystem.js.map +1 -1
  82. package/Particles/gpuParticleSystem.d.ts +24 -2
  83. package/Particles/gpuParticleSystem.js +98 -43
  84. package/Particles/gpuParticleSystem.js.map +1 -1
  85. package/Particles/particleSystem.d.ts +6 -1
  86. package/Particles/particleSystem.js +7 -2
  87. package/Particles/particleSystem.js.map +1 -1
  88. package/Physics/IPhysicsEngine.d.ts +8 -108
  89. package/Physics/IPhysicsEngine.js.map +1 -1
  90. package/Physics/Plugins/ammoJSPlugin.d.ts +1 -389
  91. package/Physics/Plugins/ammoJSPlugin.js +2 -1414
  92. package/Physics/Plugins/ammoJSPlugin.js.map +1 -1
  93. package/Physics/Plugins/cannonJSPlugin.d.ts +1 -75
  94. package/Physics/Plugins/cannonJSPlugin.js +2 -664
  95. package/Physics/Plugins/cannonJSPlugin.js.map +1 -1
  96. package/Physics/Plugins/oimoJSPlugin.d.ts +1 -59
  97. package/Physics/Plugins/oimoJSPlugin.js +2 -432
  98. package/Physics/Plugins/oimoJSPlugin.js.map +1 -1
  99. package/Physics/index.d.ts +3 -6
  100. package/Physics/index.js +3 -6
  101. package/Physics/index.js.map +1 -1
  102. package/Physics/physicsEngine.d.ts +1 -135
  103. package/Physics/physicsEngine.js +2 -221
  104. package/Physics/physicsEngine.js.map +1 -1
  105. package/Physics/physicsEngineComponent.d.ts +7 -42
  106. package/Physics/physicsEngineComponent.js +11 -71
  107. package/Physics/physicsEngineComponent.js.map +1 -1
  108. package/Physics/physicsHelper.d.ts +1 -411
  109. package/Physics/physicsHelper.js +2 -708
  110. package/Physics/physicsHelper.js.map +1 -1
  111. package/Physics/physicsImpostor.d.ts +1 -640
  112. package/Physics/physicsImpostor.js +2 -1004
  113. package/Physics/physicsImpostor.js.map +1 -1
  114. package/Physics/physicsJoint.d.ts +1 -275
  115. package/Physics/physicsJoint.js +2 -222
  116. package/Physics/physicsJoint.js.map +1 -1
  117. package/Physics/v1/IPhysicsEnginePlugin.d.ts +73 -0
  118. package/Physics/v1/IPhysicsEnginePlugin.js +2 -0
  119. package/Physics/v1/IPhysicsEnginePlugin.js.map +1 -0
  120. package/Physics/v1/Plugins/ammoJSPlugin.d.ts +401 -0
  121. package/Physics/v1/Plugins/ammoJSPlugin.js +1431 -0
  122. package/Physics/v1/Plugins/ammoJSPlugin.js.map +1 -0
  123. package/Physics/v1/Plugins/cannonJSPlugin.d.ts +87 -0
  124. package/Physics/v1/Plugins/cannonJSPlugin.js +683 -0
  125. package/Physics/v1/Plugins/cannonJSPlugin.js.map +1 -0
  126. package/Physics/{Plugins → v1/Plugins}/index.d.ts +0 -0
  127. package/Physics/{Plugins → v1/Plugins}/index.js +0 -0
  128. package/Physics/v1/Plugins/index.js.map +1 -0
  129. package/Physics/v1/Plugins/oimoJSPlugin.d.ts +71 -0
  130. package/Physics/v1/Plugins/oimoJSPlugin.js +450 -0
  131. package/Physics/v1/Plugins/oimoJSPlugin.js.map +1 -0
  132. package/Physics/v1/index.d.ts +7 -0
  133. package/Physics/v1/index.js +9 -0
  134. package/Physics/v1/index.js.map +1 -0
  135. package/Physics/v1/physicsEngine.d.ts +147 -0
  136. package/Physics/v1/physicsEngine.js +237 -0
  137. package/Physics/v1/physicsEngine.js.map +1 -0
  138. package/Physics/v1/physicsEngineComponent.d.ts +45 -0
  139. package/Physics/v1/physicsEngineComponent.js +70 -0
  140. package/Physics/v1/physicsEngineComponent.js.map +1 -0
  141. package/Physics/v1/physicsHelper.d.ts +411 -0
  142. package/Physics/v1/physicsHelper.js +709 -0
  143. package/Physics/v1/physicsHelper.js.map +1 -0
  144. package/Physics/v1/physicsImpostor.d.ts +636 -0
  145. package/Physics/v1/physicsImpostor.js +1001 -0
  146. package/Physics/v1/physicsImpostor.js.map +1 -0
  147. package/Physics/v1/physicsJoint.d.ts +275 -0
  148. package/Physics/v1/physicsJoint.js +223 -0
  149. package/Physics/v1/physicsJoint.js.map +1 -0
  150. package/Physics/v2/IPhysicsEnginePlugin.d.ts +170 -0
  151. package/Physics/v2/IPhysicsEnginePlugin.js +47 -0
  152. package/Physics/v2/IPhysicsEnginePlugin.js.map +1 -0
  153. package/Physics/v2/Plugins/index.d.ts +0 -0
  154. package/Physics/v2/Plugins/index.js +2 -0
  155. package/Physics/v2/Plugins/index.js.map +1 -0
  156. package/Physics/v2/index.d.ts +6 -0
  157. package/Physics/v2/index.js +8 -0
  158. package/Physics/v2/index.js.map +1 -0
  159. package/Physics/v2/physicsAggregate.d.ts +114 -0
  160. package/Physics/v2/physicsAggregate.js +46 -0
  161. package/Physics/v2/physicsAggregate.js.map +1 -0
  162. package/Physics/v2/physicsBody.d.ts +109 -0
  163. package/Physics/v2/physicsBody.js +158 -0
  164. package/Physics/v2/physicsBody.js.map +1 -0
  165. package/Physics/v2/physicsConstraint.d.ts +184 -0
  166. package/Physics/v2/physicsConstraint.js +257 -0
  167. package/Physics/v2/physicsConstraint.js.map +1 -0
  168. package/Physics/v2/physicsEngine.d.ts +103 -0
  169. package/Physics/v2/physicsEngine.js +146 -0
  170. package/Physics/v2/physicsEngine.js.map +1 -0
  171. package/Physics/v2/physicsEngineComponent.d.ts +31 -0
  172. package/Physics/v2/physicsEngineComponent.js +50 -0
  173. package/Physics/v2/physicsEngineComponent.js.map +1 -0
  174. package/Physics/v2/physicsMaterial.d.ts +45 -0
  175. package/Physics/v2/physicsMaterial.js +67 -0
  176. package/Physics/v2/physicsMaterial.js.map +1 -0
  177. package/Physics/v2/physicsShape.d.ts +182 -0
  178. package/Physics/v2/physicsShape.js +229 -0
  179. package/Physics/v2/physicsShape.js.map +1 -0
  180. package/PostProcesses/postProcess.d.ts +3 -1
  181. package/PostProcesses/postProcess.js +4 -1
  182. package/PostProcesses/postProcess.js.map +1 -1
  183. package/Rendering/fluidRenderer/fluidRenderer.d.ts +153 -0
  184. package/Rendering/fluidRenderer/fluidRenderer.js +410 -0
  185. package/Rendering/fluidRenderer/fluidRenderer.js.map +1 -0
  186. package/Rendering/fluidRenderer/fluidRenderingDepthTextureCopy.d.ts +13 -0
  187. package/Rendering/fluidRenderer/fluidRenderingDepthTextureCopy.js +31 -0
  188. package/Rendering/fluidRenderer/fluidRenderingDepthTextureCopy.js.map +1 -0
  189. package/Rendering/fluidRenderer/fluidRenderingObject.d.ts +81 -0
  190. package/Rendering/fluidRenderer/fluidRenderingObject.js +180 -0
  191. package/Rendering/fluidRenderer/fluidRenderingObject.js.map +1 -0
  192. package/Rendering/fluidRenderer/fluidRenderingObjectCustomParticles.d.ts +63 -0
  193. package/Rendering/fluidRenderer/fluidRenderingObjectCustomParticles.js +130 -0
  194. package/Rendering/fluidRenderer/fluidRenderingObjectCustomParticles.js.map +1 -0
  195. package/Rendering/fluidRenderer/fluidRenderingObjectParticleSystem.d.ts +64 -0
  196. package/Rendering/fluidRenderer/fluidRenderingObjectParticleSystem.js +104 -0
  197. package/Rendering/fluidRenderer/fluidRenderingObjectParticleSystem.js.map +1 -0
  198. package/Rendering/fluidRenderer/fluidRenderingTargetRenderer.d.ts +234 -0
  199. package/Rendering/fluidRenderer/fluidRenderingTargetRenderer.js +690 -0
  200. package/Rendering/fluidRenderer/fluidRenderingTargetRenderer.js.map +1 -0
  201. package/Rendering/fluidRenderer/fluidRenderingTextures.d.ts +56 -0
  202. package/Rendering/fluidRenderer/fluidRenderingTextures.js +261 -0
  203. package/Rendering/fluidRenderer/fluidRenderingTextures.js.map +1 -0
  204. package/Rendering/fluidRenderer/index.d.ts +5 -0
  205. package/Rendering/fluidRenderer/index.js +6 -0
  206. package/Rendering/fluidRenderer/index.js.map +1 -0
  207. package/Rendering/index.d.ts +1 -0
  208. package/Rendering/index.js +2 -0
  209. package/Rendering/index.js.map +1 -1
  210. package/Shaders/copyTextureToTexture.fragment.js +4 -1
  211. package/Shaders/copyTextureToTexture.fragment.js.map +1 -1
  212. package/Shaders/fluidRenderingBilateralBlur.fragment.d.ts +5 -0
  213. package/Shaders/fluidRenderingBilateralBlur.fragment.js +9 -0
  214. package/Shaders/fluidRenderingBilateralBlur.fragment.js.map +1 -0
  215. package/Shaders/fluidRenderingParticleDepth.fragment.d.ts +5 -0
  216. package/Shaders/fluidRenderingParticleDepth.fragment.js +17 -0
  217. package/Shaders/fluidRenderingParticleDepth.fragment.js.map +1 -0
  218. package/Shaders/fluidRenderingParticleDepth.vertex.d.ts +5 -0
  219. package/Shaders/fluidRenderingParticleDepth.vertex.js +13 -0
  220. package/Shaders/fluidRenderingParticleDepth.vertex.js.map +1 -0
  221. package/Shaders/fluidRenderingParticleDiffuse.fragment.d.ts +5 -0
  222. package/Shaders/fluidRenderingParticleDiffuse.fragment.js +9 -0
  223. package/Shaders/fluidRenderingParticleDiffuse.fragment.js.map +1 -0
  224. package/Shaders/fluidRenderingParticleDiffuse.vertex.d.ts +5 -0
  225. package/Shaders/fluidRenderingParticleDiffuse.vertex.js +4 -0
  226. package/Shaders/fluidRenderingParticleDiffuse.vertex.js.map +1 -0
  227. package/Shaders/fluidRenderingParticleThickness.fragment.d.ts +5 -0
  228. package/Shaders/fluidRenderingParticleThickness.fragment.js +9 -0
  229. package/Shaders/fluidRenderingParticleThickness.fragment.js.map +1 -0
  230. package/Shaders/fluidRenderingParticleThickness.vertex.d.ts +5 -0
  231. package/Shaders/fluidRenderingParticleThickness.vertex.js +9 -0
  232. package/Shaders/fluidRenderingParticleThickness.vertex.js.map +1 -0
  233. package/Shaders/fluidRenderingRender.fragment.d.ts +5 -0
  234. package/Shaders/fluidRenderingRender.fragment.js +46 -0
  235. package/Shaders/fluidRenderingRender.fragment.js.map +1 -0
  236. package/Shaders/fluidRenderingStandardBlur.fragment.d.ts +5 -0
  237. package/Shaders/fluidRenderingStandardBlur.fragment.js +9 -0
  238. package/Shaders/fluidRenderingStandardBlur.fragment.js.map +1 -0
  239. package/XR/features/WebXRControllerPhysics.d.ts +1 -1
  240. package/XR/features/WebXRControllerPhysics.js +1 -1
  241. package/XR/features/WebXRControllerPhysics.js.map +1 -1
  242. package/XR/features/WebXRHandTracking.js +1 -1
  243. package/XR/features/WebXRHandTracking.js.map +1 -1
  244. package/package.json +1 -1
  245. package/scene.js +6 -1
  246. package/scene.js.map +1 -1
  247. package/sceneComponent.d.ts +3 -0
  248. package/sceneComponent.js +3 -0
  249. package/sceneComponent.js.map +1 -1
  250. package/Physics/Plugins/index.js.map +0 -1
@@ -0,0 +1,690 @@
1
+
2
+ import { Color3, Color4 } from "../../Maths/math.color.js";
3
+ import { Matrix, Vector2, Vector3 } from "../../Maths/math.vector.js";
4
+ import { Observable } from "../../Misc/observable.js";
5
+ import { PostProcess } from "../../PostProcesses/postProcess.js";
6
+ import { FluidRenderingTextures } from "./fluidRenderingTextures.js";
7
+ /**
8
+ * Textures that can be displayed as a debugging tool
9
+ */
10
+ export var FluidRenderingDebug;
11
+ (function (FluidRenderingDebug) {
12
+ FluidRenderingDebug[FluidRenderingDebug["DepthTexture"] = 0] = "DepthTexture";
13
+ FluidRenderingDebug[FluidRenderingDebug["DepthBlurredTexture"] = 1] = "DepthBlurredTexture";
14
+ FluidRenderingDebug[FluidRenderingDebug["ThicknessTexture"] = 2] = "ThicknessTexture";
15
+ FluidRenderingDebug[FluidRenderingDebug["ThicknessBlurredTexture"] = 3] = "ThicknessBlurredTexture";
16
+ FluidRenderingDebug[FluidRenderingDebug["DiffuseTexture"] = 4] = "DiffuseTexture";
17
+ FluidRenderingDebug[FluidRenderingDebug["Normals"] = 5] = "Normals";
18
+ FluidRenderingDebug[FluidRenderingDebug["DiffuseRendering"] = 6] = "DiffuseRendering";
19
+ })(FluidRenderingDebug || (FluidRenderingDebug = {}));
20
+ /**
21
+ * Class used to render an object as a fluid thanks to different render target textures (depth, thickness, diffuse)
22
+ */
23
+ export class FluidRenderingTargetRenderer {
24
+ /**
25
+ * Creates an instance of the class
26
+ * @param scene Scene used to render the fluid object into
27
+ * @param camera Camera used to render the fluid object. If not provided, use the active camera of the scene instead
28
+ */
29
+ constructor(scene, camera) {
30
+ this._generateDiffuseTexture = false;
31
+ /**
32
+ * Fluid color. Not used if generateDiffuseTexture is true
33
+ */
34
+ this.fluidColor = new Color3(0.085, 0.6375, 0.765);
35
+ /**
36
+ * Density of the fluid (positive number). The higher the value, the more opaque the fluid.
37
+ */
38
+ this.density = 2;
39
+ /**
40
+ * Strength of the refraction (positive number, but generally between 0 and 0.3).
41
+ */
42
+ this.refractionStrength = 0.1;
43
+ /**
44
+ * Strength of the fresnel effect (value between 0 and 1). Lower the value if you want to soften the specular effect
45
+ */
46
+ this.fresnelClamp = 1.0;
47
+ /**
48
+ * Strength of the specular power (positive number). Increase the value to make the specular effect more concentrated
49
+ */
50
+ this.specularPower = 250;
51
+ /**
52
+ * Minimum thickness of the particles (positive number). If useFixedThickness is true, minimumThickness is the thickness used
53
+ */
54
+ this.minimumThickness = 0;
55
+ /**
56
+ * Direction of the light. The fluid is assumed to be lit by a directional light
57
+ */
58
+ this.dirLight = new Vector3(-2, -1, 1).normalize();
59
+ this._debugFeature = FluidRenderingDebug.DepthBlurredTexture;
60
+ this._debug = false;
61
+ this._enableBlurDepth = true;
62
+ this._blurDepthSizeDivisor = 1;
63
+ this._blurDepthFilterSize = 7;
64
+ this._blurDepthNumIterations = 3;
65
+ this._blurDepthMaxFilterSize = 100;
66
+ this._blurDepthDepthScale = 10;
67
+ this._enableBlurThickness = true;
68
+ this._blurThicknessSizeDivisor = 1;
69
+ this._blurThicknessFilterSize = 5;
70
+ this._blurThicknessNumIterations = 1;
71
+ this._useFixedThickness = false;
72
+ /** @internal */
73
+ this._onUseVelocityChanged = new Observable();
74
+ this._useVelocity = false;
75
+ this._depthMapSize = null;
76
+ this._thicknessMapSize = null;
77
+ this._diffuseMapSize = null;
78
+ this._samples = 1;
79
+ this._scene = scene;
80
+ this._engine = scene.getEngine();
81
+ this._camera = camera !== null && camera !== void 0 ? camera : scene.activeCamera;
82
+ this._needInitialization = true;
83
+ this._bgDepthTexture = null;
84
+ this._invProjectionMatrix = new Matrix();
85
+ this._depthClearColor = new Color4(1e6, 1e6, 1e6, 1);
86
+ this._thicknessClearColor = new Color4(0, 0, 0, 1);
87
+ this._depthRenderTarget = null;
88
+ this._diffuseRenderTarget = null;
89
+ this._thicknessRenderTarget = null;
90
+ this._renderPostProcess = null;
91
+ }
92
+ /**
93
+ * Returns true if the class needs to be reinitialized (because of changes in parameterization)
94
+ */
95
+ get needInitialization() {
96
+ return this._needInitialization;
97
+ }
98
+ /**
99
+ * Gets or sets a boolean indicating that the diffuse texture should be generated and used for the rendering
100
+ */
101
+ get generateDiffuseTexture() {
102
+ return this._generateDiffuseTexture;
103
+ }
104
+ set generateDiffuseTexture(generate) {
105
+ if (this._generateDiffuseTexture === generate) {
106
+ return;
107
+ }
108
+ this._generateDiffuseTexture = generate;
109
+ this._needInitialization = true;
110
+ }
111
+ /**
112
+ * Gets or sets the feature (texture) to be debugged. Not used if debug is false
113
+ */
114
+ get debugFeature() {
115
+ return this._debugFeature;
116
+ }
117
+ set debugFeature(feature) {
118
+ if (this._debugFeature === feature) {
119
+ return;
120
+ }
121
+ this._needInitialization = true;
122
+ this._debugFeature = feature;
123
+ }
124
+ /**
125
+ * Gets or sets a boolean indicating if we should display a specific texture (given by debugFeature) for debugging purpose
126
+ */
127
+ get debug() {
128
+ return this._debug;
129
+ }
130
+ set debug(debug) {
131
+ if (this._debug === debug) {
132
+ return;
133
+ }
134
+ this._debug = debug;
135
+ this._needInitialization = true;
136
+ }
137
+ /**
138
+ * Gets or sets the environment map used for the reflection part of the shading
139
+ * If null, no map will be used. If undefined, the scene.environmentMap will be used (if defined)
140
+ */
141
+ get environmentMap() {
142
+ return this._environmentMap;
143
+ }
144
+ set environmentMap(map) {
145
+ if (this._environmentMap === map) {
146
+ return;
147
+ }
148
+ this._needInitialization = true;
149
+ this._environmentMap = map;
150
+ }
151
+ /**
152
+ * Gets or sets a boolean indicating that the depth texture should be blurred
153
+ */
154
+ get enableBlurDepth() {
155
+ return this._enableBlurDepth;
156
+ }
157
+ set enableBlurDepth(enable) {
158
+ if (this._enableBlurDepth === enable) {
159
+ return;
160
+ }
161
+ this._enableBlurDepth = enable;
162
+ this._needInitialization = true;
163
+ }
164
+ /**
165
+ * Gets or sets the depth size divisor (positive number, generally between 1 and 4), which is used as a divisor when creating the texture used for blurring the depth
166
+ * For eg. if blurDepthSizeDivisor=2, the texture used to blur the depth will be half the size of the depth texture
167
+ */
168
+ get blurDepthSizeDivisor() {
169
+ return this._blurDepthSizeDivisor;
170
+ }
171
+ set blurDepthSizeDivisor(scale) {
172
+ if (this._blurDepthSizeDivisor === scale) {
173
+ return;
174
+ }
175
+ this._blurDepthSizeDivisor = scale;
176
+ this._needInitialization = true;
177
+ }
178
+ /**
179
+ * Size of the kernel used to filter the depth blur texture (positive number, generally between 1 and 20 - higher values will require more processing power from the GPU)
180
+ */
181
+ get blurDepthFilterSize() {
182
+ return this._blurDepthFilterSize;
183
+ }
184
+ set blurDepthFilterSize(filterSize) {
185
+ if (this._blurDepthFilterSize === filterSize) {
186
+ return;
187
+ }
188
+ this._blurDepthFilterSize = filterSize;
189
+ this._setBlurParameters();
190
+ }
191
+ /**
192
+ * Number of blurring iterations used to generate the depth blur texture (positive number, generally between 1 and 10 - higher values will require more processing power from the GPU)
193
+ */
194
+ get blurDepthNumIterations() {
195
+ return this._blurDepthNumIterations;
196
+ }
197
+ set blurDepthNumIterations(numIterations) {
198
+ if (this._blurDepthNumIterations === numIterations) {
199
+ return;
200
+ }
201
+ this._blurDepthNumIterations = numIterations;
202
+ this._setBlurParameters();
203
+ }
204
+ /**
205
+ * Maximum size of the kernel used to blur the depth texture (positive number, generally between 1 and 200 - higher values will require more processing power from the GPU when the particles are larger on screen)
206
+ */
207
+ get blurDepthMaxFilterSize() {
208
+ return this._blurDepthMaxFilterSize;
209
+ }
210
+ set blurDepthMaxFilterSize(maxFilterSize) {
211
+ if (this._blurDepthMaxFilterSize === maxFilterSize) {
212
+ return;
213
+ }
214
+ this._blurDepthMaxFilterSize = maxFilterSize;
215
+ this._setBlurParameters();
216
+ }
217
+ /**
218
+ * Depth weight in the calculation when applying the bilateral blur to generate the depth blur texture (positive number, generally between 0 and 100)
219
+ */
220
+ get blurDepthDepthScale() {
221
+ return this._blurDepthDepthScale;
222
+ }
223
+ set blurDepthDepthScale(scale) {
224
+ if (this._blurDepthDepthScale === scale) {
225
+ return;
226
+ }
227
+ this._blurDepthDepthScale = scale;
228
+ this._setBlurParameters();
229
+ }
230
+ /**
231
+ * Gets or sets a boolean indicating that the thickness texture should be blurred
232
+ */
233
+ get enableBlurThickness() {
234
+ return this._enableBlurThickness;
235
+ }
236
+ set enableBlurThickness(enable) {
237
+ if (this._enableBlurThickness === enable) {
238
+ return;
239
+ }
240
+ this._enableBlurThickness = enable;
241
+ this._needInitialization = true;
242
+ }
243
+ /**
244
+ * Gets or sets the thickness size divisor (positive number, generally between 1 and 4), which is used as a divisor when creating the texture used for blurring the thickness
245
+ * For eg. if blurThicknessSizeDivisor=2, the texture used to blur the thickness will be half the size of the thickness texture
246
+ */
247
+ get blurThicknessSizeDivisor() {
248
+ return this._blurThicknessSizeDivisor;
249
+ }
250
+ set blurThicknessSizeDivisor(scale) {
251
+ if (this._blurThicknessSizeDivisor === scale) {
252
+ return;
253
+ }
254
+ this._blurThicknessSizeDivisor = scale;
255
+ this._needInitialization = true;
256
+ }
257
+ /**
258
+ * Size of the kernel used to filter the thickness blur texture (positive number, generally between 1 and 20 - higher values will require more processing power from the GPU)
259
+ */
260
+ get blurThicknessFilterSize() {
261
+ return this._blurThicknessFilterSize;
262
+ }
263
+ set blurThicknessFilterSize(filterSize) {
264
+ if (this._blurThicknessFilterSize === filterSize) {
265
+ return;
266
+ }
267
+ this._blurThicknessFilterSize = filterSize;
268
+ this._setBlurParameters();
269
+ }
270
+ /**
271
+ * Number of blurring iterations used to generate the thickness blur texture (positive number, generally between 1 and 10 - higher values will require more processing power from the GPU)
272
+ */
273
+ get blurThicknessNumIterations() {
274
+ return this._blurThicknessNumIterations;
275
+ }
276
+ set blurThicknessNumIterations(numIterations) {
277
+ if (this._blurThicknessNumIterations === numIterations) {
278
+ return;
279
+ }
280
+ this._blurThicknessNumIterations = numIterations;
281
+ this._setBlurParameters();
282
+ }
283
+ /**
284
+ * Gets or sets a boolean indicating that a fixed thickness should be used instead of generating a thickness texture
285
+ */
286
+ get useFixedThickness() {
287
+ return this._useFixedThickness;
288
+ }
289
+ set useFixedThickness(use) {
290
+ if (this._useFixedThickness === use) {
291
+ return;
292
+ }
293
+ this._useFixedThickness = use;
294
+ this._needInitialization = true;
295
+ }
296
+ /**
297
+ * Gets or sets a boolean indicating that the velocity should be used when rendering the particles as a fluid.
298
+ * Note: the vertex buffers must contain a "velocity" buffer for this to work!
299
+ */
300
+ get useVelocity() {
301
+ return this._useVelocity;
302
+ }
303
+ set useVelocity(use) {
304
+ if (this._useVelocity === use) {
305
+ return;
306
+ }
307
+ this._useVelocity = use;
308
+ this._needInitialization = true;
309
+ this._onUseVelocityChanged.notifyObservers(this);
310
+ }
311
+ /**
312
+ * Defines the size of the depth texture.
313
+ * If null, the texture will have the size of the screen
314
+ */
315
+ get depthMapSize() {
316
+ return this._depthMapSize;
317
+ }
318
+ set depthMapSize(size) {
319
+ if (this._depthMapSize === size) {
320
+ return;
321
+ }
322
+ this._depthMapSize = size;
323
+ this._needInitialization = true;
324
+ }
325
+ /**
326
+ * Defines the size of the thickness texture.
327
+ * If null, the texture will have the size of the screen
328
+ */
329
+ get thicknessMapSize() {
330
+ return this._thicknessMapSize;
331
+ }
332
+ set thicknessMapSize(size) {
333
+ if (this._thicknessMapSize === size) {
334
+ return;
335
+ }
336
+ this._thicknessMapSize = size;
337
+ this._needInitialization = true;
338
+ }
339
+ /**
340
+ * Defines the size of the diffuse texture.
341
+ * If null, the texture will have the size of the screen
342
+ */
343
+ get diffuseMapSize() {
344
+ return this._diffuseMapSize;
345
+ }
346
+ set diffuseMapSize(size) {
347
+ if (this._diffuseMapSize === size) {
348
+ return;
349
+ }
350
+ this._diffuseMapSize = size;
351
+ this._needInitialization = true;
352
+ }
353
+ /**
354
+ * Gets or sets the number of samples used by MSAA
355
+ * Note: changing this value in WebGL does not work because depth/stencil textures can't be created with MSAA (see https://github.com/BabylonJS/Babylon.js/issues/12444)
356
+ */
357
+ get samples() {
358
+ return this._samples;
359
+ }
360
+ set samples(samples) {
361
+ if (this._samples === samples) {
362
+ return;
363
+ }
364
+ this._samples = samples;
365
+ this._needInitialization = true;
366
+ }
367
+ /**
368
+ * Gets the camera used for the rendering
369
+ */
370
+ get camera() {
371
+ return this._camera;
372
+ }
373
+ /** @internal */
374
+ _initialize() {
375
+ var _a, _b, _c;
376
+ this.dispose();
377
+ this._needInitialization = false;
378
+ const depthWidth = (_a = this._depthMapSize) !== null && _a !== void 0 ? _a : this._engine.getRenderWidth();
379
+ const depthHeight = this._depthMapSize !== null ? Math.round((this._depthMapSize * this._engine.getRenderHeight()) / this._engine.getRenderWidth()) : this._engine.getRenderHeight();
380
+ this._depthRenderTarget = new FluidRenderingTextures("Depth", this._scene, depthWidth, depthHeight, depthWidth, depthHeight, 1, 7, 1, 7, false, this._camera, true, this._samples);
381
+ this._initializeRenderTarget(this._depthRenderTarget);
382
+ if (this.generateDiffuseTexture) {
383
+ const diffuseWidth = (_b = this._diffuseMapSize) !== null && _b !== void 0 ? _b : this._engine.getRenderWidth();
384
+ const diffuseHeight = this._diffuseMapSize !== null
385
+ ? Math.round((this._diffuseMapSize * this._engine.getRenderHeight()) / this._engine.getRenderWidth())
386
+ : this._engine.getRenderHeight();
387
+ this._diffuseRenderTarget = new FluidRenderingTextures("Diffuse", this._scene, diffuseWidth, diffuseHeight, 0, 0, 0, 5, 0, 5, true, this._camera, true, this._samples);
388
+ this._initializeRenderTarget(this._diffuseRenderTarget);
389
+ }
390
+ const thicknessWidth = (_c = this._thicknessMapSize) !== null && _c !== void 0 ? _c : this._engine.getRenderWidth();
391
+ const thicknessHeight = this._thicknessMapSize !== null
392
+ ? Math.round((this._thicknessMapSize * this._engine.getRenderHeight()) / this._engine.getRenderWidth())
393
+ : this._engine.getRenderHeight();
394
+ if (!this._useFixedThickness) {
395
+ this._thicknessRenderTarget = new FluidRenderingTextures("Thickness", this._scene, thicknessWidth, thicknessHeight, thicknessWidth, thicknessHeight, 2, 6, 2, 6, true, this._camera, false, this._samples);
396
+ this._initializeRenderTarget(this._thicknessRenderTarget);
397
+ }
398
+ this._createLiquidRenderingPostProcess();
399
+ }
400
+ _setBlurParameters(renderTarget = null) {
401
+ if (renderTarget === null || renderTarget === this._depthRenderTarget) {
402
+ this._setBlurDepthParameters();
403
+ }
404
+ if (renderTarget === null || renderTarget === this._thicknessRenderTarget) {
405
+ this._setBlurThicknessParameters();
406
+ }
407
+ }
408
+ _setBlurDepthParameters() {
409
+ if (!this._depthRenderTarget) {
410
+ return;
411
+ }
412
+ this._depthRenderTarget.blurFilterSize = this.blurDepthFilterSize;
413
+ this._depthRenderTarget.blurMaxFilterSize = this.blurDepthMaxFilterSize;
414
+ this._depthRenderTarget.blurNumIterations = this.blurDepthNumIterations;
415
+ this._depthRenderTarget.blurDepthScale = this.blurDepthDepthScale;
416
+ }
417
+ _setBlurThicknessParameters() {
418
+ if (!this._thicknessRenderTarget) {
419
+ return;
420
+ }
421
+ this._thicknessRenderTarget.blurFilterSize = this.blurThicknessFilterSize;
422
+ this._thicknessRenderTarget.blurNumIterations = this.blurThicknessNumIterations;
423
+ }
424
+ _initializeRenderTarget(renderTarget) {
425
+ if (renderTarget !== this._diffuseRenderTarget) {
426
+ renderTarget.enableBlur = renderTarget === this._depthRenderTarget ? this.enableBlurDepth : this.enableBlurThickness;
427
+ renderTarget.blurSizeDivisor = renderTarget === this._depthRenderTarget ? this.blurDepthSizeDivisor : this.blurThicknessSizeDivisor;
428
+ }
429
+ this._setBlurParameters(renderTarget);
430
+ renderTarget.initialize();
431
+ }
432
+ _createLiquidRenderingPostProcess() {
433
+ var _a;
434
+ const engine = this._scene.getEngine();
435
+ const uniformNames = [
436
+ "viewMatrix",
437
+ "projectionMatrix",
438
+ "invProjectionMatrix",
439
+ "texelSize",
440
+ "dirLight",
441
+ "cameraFar",
442
+ "density",
443
+ "refractionStrength",
444
+ "fresnelClamp",
445
+ "specularPower",
446
+ ];
447
+ const samplerNames = ["depthSampler"];
448
+ const defines = [];
449
+ this.dispose(true);
450
+ if (!this._camera) {
451
+ return;
452
+ }
453
+ const texture = this._depthRenderTarget.enableBlur ? this._depthRenderTarget.textureBlur : this._depthRenderTarget.texture;
454
+ const texelSize = new Vector2(1 / texture.getSize().width, 1 / texture.getSize().height);
455
+ if (this._environmentMap !== null) {
456
+ const envMap = (_a = this._environmentMap) !== null && _a !== void 0 ? _a : this._scene.environmentTexture;
457
+ if (envMap) {
458
+ samplerNames.push("reflectionSampler");
459
+ defines.push("#define FLUIDRENDERING_ENVIRONMENT");
460
+ }
461
+ }
462
+ if (this._diffuseRenderTarget) {
463
+ samplerNames.push("diffuseSampler");
464
+ defines.push("#define FLUIDRENDERING_DIFFUSETEXTURE");
465
+ }
466
+ else {
467
+ uniformNames.push("diffuseColor");
468
+ }
469
+ if (this._useVelocity) {
470
+ samplerNames.push("velocitySampler");
471
+ defines.push("#define FLUIDRENDERING_VELOCITY");
472
+ }
473
+ if (this._useFixedThickness) {
474
+ uniformNames.push("thickness");
475
+ samplerNames.push("bgDepthSampler");
476
+ defines.push("#define FLUIDRENDERING_FIXED_THICKNESS");
477
+ }
478
+ else {
479
+ uniformNames.push("minimumThickness");
480
+ samplerNames.push("thicknessSampler");
481
+ }
482
+ if (this._debug) {
483
+ defines.push("#define FLUIDRENDERING_DEBUG");
484
+ if (this._debugFeature === FluidRenderingDebug.Normals) {
485
+ defines.push("#define FLUIDRENDERING_DEBUG_SHOWNORMAL");
486
+ }
487
+ else if (this._debugFeature === FluidRenderingDebug.DiffuseRendering) {
488
+ defines.push("#define FLUIDRENDERING_DEBUG_DIFFUSERENDERING");
489
+ }
490
+ else {
491
+ defines.push("#define FLUIDRENDERING_DEBUG_TEXTURE");
492
+ samplerNames.push("debugSampler");
493
+ if (this._debugFeature === FluidRenderingDebug.DepthTexture || this._debugFeature === FluidRenderingDebug.DepthBlurredTexture) {
494
+ defines.push("#define FLUIDRENDERING_DEBUG_DEPTH");
495
+ }
496
+ }
497
+ }
498
+ this._renderPostProcess = new PostProcess("FluidRendering", "fluidRenderingRender", uniformNames, samplerNames, 1, null, 2, engine, false, null, 0, undefined, undefined, true, undefined);
499
+ this._renderPostProcess.updateEffect(defines.join("\n"));
500
+ this._renderPostProcess.samples = this._samples;
501
+ this._renderPostProcess.onApplyObservable.add((effect) => {
502
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
503
+ this._invProjectionMatrix.copyFrom(this._scene.getProjectionMatrix());
504
+ this._invProjectionMatrix.invert();
505
+ if (engine.isWebGPU) {
506
+ effect.setTextureSampler("textureSamplerSampler", this._renderPostProcess.inputTexture.texture);
507
+ }
508
+ if (!this._depthRenderTarget.enableBlur) {
509
+ effect.setTexture("depthSampler", this._depthRenderTarget.texture);
510
+ if (engine.isWebGPU) {
511
+ effect.setTextureSampler("depthSamplerSampler", (_b = (_a = this._depthRenderTarget.texture) === null || _a === void 0 ? void 0 : _a.getInternalTexture()) !== null && _b !== void 0 ? _b : null);
512
+ }
513
+ }
514
+ else {
515
+ effect.setTexture("depthSampler", this._depthRenderTarget.textureBlur);
516
+ if (engine.isWebGPU) {
517
+ effect.setTextureSampler("depthSamplerSampler", (_d = (_c = this._depthRenderTarget.textureBlur) === null || _c === void 0 ? void 0 : _c.getInternalTexture()) !== null && _d !== void 0 ? _d : null);
518
+ }
519
+ }
520
+ if (this._diffuseRenderTarget) {
521
+ if (!this._diffuseRenderTarget.enableBlur) {
522
+ effect.setTexture("diffuseSampler", this._diffuseRenderTarget.texture);
523
+ if (engine.isWebGPU) {
524
+ effect.setTextureSampler("diffuseSamplerSampler", (_f = (_e = this._diffuseRenderTarget.texture) === null || _e === void 0 ? void 0 : _e.getInternalTexture()) !== null && _f !== void 0 ? _f : null);
525
+ }
526
+ }
527
+ else {
528
+ effect.setTexture("diffuseSampler", this._diffuseRenderTarget.textureBlur);
529
+ if (engine.isWebGPU) {
530
+ effect.setTextureSampler("diffuseSamplerSampler", (_h = (_g = this._diffuseRenderTarget.textureBlur) === null || _g === void 0 ? void 0 : _g.getInternalTexture()) !== null && _h !== void 0 ? _h : null);
531
+ }
532
+ }
533
+ }
534
+ else {
535
+ effect.setColor3("diffuseColor", this.fluidColor);
536
+ }
537
+ if (this._useFixedThickness) {
538
+ effect.setFloat("thickness", this.minimumThickness);
539
+ effect._bindTexture("bgDepthSampler", this._bgDepthTexture);
540
+ if (engine.isWebGPU) {
541
+ effect.setTextureSampler("bgDepthSamplerSampler", (_j = this._bgDepthTexture) !== null && _j !== void 0 ? _j : null);
542
+ }
543
+ }
544
+ else {
545
+ if (!this._thicknessRenderTarget.enableBlur) {
546
+ effect.setTexture("thicknessSampler", this._thicknessRenderTarget.texture);
547
+ if (engine.isWebGPU) {
548
+ effect.setTextureSampler("thicknessSamplerSampler", (_l = (_k = this._thicknessRenderTarget.texture) === null || _k === void 0 ? void 0 : _k.getInternalTexture()) !== null && _l !== void 0 ? _l : null);
549
+ }
550
+ }
551
+ else {
552
+ effect.setTexture("thicknessSampler", this._thicknessRenderTarget.textureBlur);
553
+ if (engine.isWebGPU) {
554
+ effect.setTextureSampler("thicknessSamplerSampler", (_o = (_m = this._thicknessRenderTarget.textureBlur) === null || _m === void 0 ? void 0 : _m.getInternalTexture()) !== null && _o !== void 0 ? _o : null);
555
+ }
556
+ }
557
+ effect.setFloat("minimumThickness", this.minimumThickness);
558
+ }
559
+ if (this._environmentMap !== null) {
560
+ const envMap = (_p = this._environmentMap) !== null && _p !== void 0 ? _p : this._scene.environmentTexture;
561
+ if (envMap) {
562
+ effect.setTexture("reflectionSampler", envMap);
563
+ if (engine.isWebGPU) {
564
+ effect.setTextureSampler("reflectionSamplerSampler", (_q = envMap === null || envMap === void 0 ? void 0 : envMap.getInternalTexture()) !== null && _q !== void 0 ? _q : null);
565
+ }
566
+ }
567
+ }
568
+ effect.setMatrix("viewMatrix", this._scene.getViewMatrix());
569
+ effect.setMatrix("invProjectionMatrix", this._invProjectionMatrix);
570
+ effect.setMatrix("projectionMatrix", this._scene.getProjectionMatrix());
571
+ effect.setVector2("texelSize", texelSize);
572
+ effect.setFloat("density", this.density);
573
+ effect.setFloat("refractionStrength", this.refractionStrength);
574
+ effect.setFloat("fresnelClamp", this.fresnelClamp);
575
+ effect.setFloat("specularPower", this.specularPower);
576
+ effect.setVector3("dirLight", this.dirLight);
577
+ effect.setFloat("cameraFar", this._camera.maxZ);
578
+ if (this._debug) {
579
+ let texture = null;
580
+ switch (this._debugFeature) {
581
+ case FluidRenderingDebug.DepthTexture:
582
+ texture = this._depthRenderTarget.texture;
583
+ break;
584
+ case FluidRenderingDebug.DepthBlurredTexture:
585
+ texture = this._depthRenderTarget.enableBlur ? this._depthRenderTarget.textureBlur : this._depthRenderTarget.texture;
586
+ break;
587
+ case FluidRenderingDebug.ThicknessTexture:
588
+ texture = (_s = (_r = this._thicknessRenderTarget) === null || _r === void 0 ? void 0 : _r.texture) !== null && _s !== void 0 ? _s : null;
589
+ break;
590
+ case FluidRenderingDebug.ThicknessBlurredTexture:
591
+ texture = ((_t = this._thicknessRenderTarget) === null || _t === void 0 ? void 0 : _t.enableBlur) ? (_v = (_u = this._thicknessRenderTarget) === null || _u === void 0 ? void 0 : _u.textureBlur) !== null && _v !== void 0 ? _v : null : (_x = (_w = this._thicknessRenderTarget) === null || _w === void 0 ? void 0 : _w.texture) !== null && _x !== void 0 ? _x : null;
592
+ break;
593
+ case FluidRenderingDebug.DiffuseTexture:
594
+ if (this._diffuseRenderTarget) {
595
+ texture = this._diffuseRenderTarget.texture;
596
+ }
597
+ break;
598
+ }
599
+ if (this._debugFeature !== FluidRenderingDebug.Normals) {
600
+ effect.setTexture("debugSampler", texture);
601
+ if (engine.isWebGPU) {
602
+ effect.setTextureSampler("debugSamplerSampler", (_y = texture === null || texture === void 0 ? void 0 : texture.getInternalTexture()) !== null && _y !== void 0 ? _y : null);
603
+ }
604
+ }
605
+ }
606
+ });
607
+ }
608
+ /** @internal */
609
+ _clearTargets() {
610
+ var _a, _b, _c;
611
+ if ((_a = this._depthRenderTarget) === null || _a === void 0 ? void 0 : _a.renderTarget) {
612
+ this._engine.bindFramebuffer(this._depthRenderTarget.renderTarget);
613
+ this._engine.clear(this._depthClearColor, true, true, false);
614
+ this._engine.unBindFramebuffer(this._depthRenderTarget.renderTarget);
615
+ }
616
+ if ((_b = this._diffuseRenderTarget) === null || _b === void 0 ? void 0 : _b.renderTarget) {
617
+ this._engine.bindFramebuffer(this._diffuseRenderTarget.renderTarget);
618
+ this._engine.clear(this._thicknessClearColor, true, true, false);
619
+ this._engine.unBindFramebuffer(this._diffuseRenderTarget.renderTarget);
620
+ }
621
+ if ((_c = this._thicknessRenderTarget) === null || _c === void 0 ? void 0 : _c.renderTarget) {
622
+ this._engine.bindFramebuffer(this._thicknessRenderTarget.renderTarget);
623
+ // we don't clear the depth buffer because it is the depth buffer that is coming from the scene and that we reuse in the thickness rendering pass
624
+ this._engine.clear(this._thicknessClearColor, true, false, false);
625
+ this._engine.unBindFramebuffer(this._thicknessRenderTarget.renderTarget);
626
+ }
627
+ }
628
+ /** @internal */
629
+ _render(fluidObject) {
630
+ var _a, _b, _c, _d, _e, _f;
631
+ if (this._needInitialization || !fluidObject.isReady()) {
632
+ return;
633
+ }
634
+ const currentRenderTarget = this._engine._currentRenderTarget;
635
+ this._engine.setState(false, undefined, undefined, undefined, true);
636
+ this._engine.setDepthBuffer(true);
637
+ this._engine.setDepthWrite(true);
638
+ this._engine.setAlphaMode(0);
639
+ // Render the particles in the depth texture
640
+ if ((_a = this._depthRenderTarget) === null || _a === void 0 ? void 0 : _a.renderTarget) {
641
+ this._engine.bindFramebuffer(this._depthRenderTarget.renderTarget);
642
+ fluidObject.renderDepthTexture();
643
+ this._engine.unbindInstanceAttributes();
644
+ this._engine.unBindFramebuffer(this._depthRenderTarget.renderTarget);
645
+ }
646
+ // Render the particles in the diffuse texture
647
+ if ((_b = this._diffuseRenderTarget) === null || _b === void 0 ? void 0 : _b.renderTarget) {
648
+ this._engine.bindFramebuffer(this._diffuseRenderTarget.renderTarget);
649
+ fluidObject.renderDiffuseTexture();
650
+ this._engine.unbindInstanceAttributes();
651
+ this._engine.unBindFramebuffer(this._diffuseRenderTarget.renderTarget);
652
+ }
653
+ // Render the particles in the thickness texture
654
+ if ((_c = this._thicknessRenderTarget) === null || _c === void 0 ? void 0 : _c.renderTarget) {
655
+ this._engine.bindFramebuffer(this._thicknessRenderTarget.renderTarget);
656
+ fluidObject.renderThicknessTexture();
657
+ this._engine.unbindInstanceAttributes();
658
+ this._engine.unBindFramebuffer(this._thicknessRenderTarget.renderTarget);
659
+ }
660
+ // Run the blur post processes
661
+ (_d = this._depthRenderTarget) === null || _d === void 0 ? void 0 : _d.applyBlurPostProcesses();
662
+ (_e = this._diffuseRenderTarget) === null || _e === void 0 ? void 0 : _e.applyBlurPostProcesses();
663
+ (_f = this._thicknessRenderTarget) === null || _f === void 0 ? void 0 : _f.applyBlurPostProcesses();
664
+ if (currentRenderTarget) {
665
+ this._engine.bindFramebuffer(currentRenderTarget);
666
+ }
667
+ }
668
+ /**
669
+ * Releases all the ressources used by the class
670
+ * @param onlyPostProcesses If true, releases only the ressources used by the render post processes
671
+ */
672
+ dispose(onlyPostProcesses = false) {
673
+ var _a, _b, _c, _d;
674
+ if (!onlyPostProcesses) {
675
+ (_a = this._depthRenderTarget) === null || _a === void 0 ? void 0 : _a.dispose();
676
+ this._depthRenderTarget = null;
677
+ (_b = this._diffuseRenderTarget) === null || _b === void 0 ? void 0 : _b.dispose();
678
+ this._diffuseRenderTarget = null;
679
+ (_c = this._thicknessRenderTarget) === null || _c === void 0 ? void 0 : _c.dispose();
680
+ this._thicknessRenderTarget = null;
681
+ }
682
+ if (this._renderPostProcess && this._camera) {
683
+ this._camera.detachPostProcess(this._renderPostProcess);
684
+ }
685
+ (_d = this._renderPostProcess) === null || _d === void 0 ? void 0 : _d.dispose();
686
+ this._renderPostProcess = null;
687
+ this._needInitialization = false;
688
+ }
689
+ }
690
+ //# sourceMappingURL=fluidRenderingTargetRenderer.js.map