@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,104 @@
1
+
2
+ import { FluidRenderingObject } from "./fluidRenderingObject.js";
3
+ /**
4
+ * Defines a rendering object based on a particle system
5
+ */
6
+ export class FluidRenderingObjectParticleSystem extends FluidRenderingObject {
7
+ /**
8
+ * Creates a new instance of the class
9
+ * @param scene The scene the particle system is part of
10
+ * @param ps The particle system
11
+ */
12
+ constructor(scene, ps) {
13
+ super(scene);
14
+ this._useTrueRenderingForDiffuseTexture = true;
15
+ this._particleSystem = ps;
16
+ this._originalRender = ps.render.bind(ps);
17
+ this._blendMode = ps.blendMode;
18
+ this._onBeforeDrawParticleObserver = null;
19
+ this._updateInAnimate = this._particleSystem.updateInAnimate;
20
+ this._particleSystem.updateInAnimate = true;
21
+ this._particleSystem.render = () => 0;
22
+ this.particleSize = (ps.minSize + ps.maxSize) / 2;
23
+ this.useTrueRenderingForDiffuseTexture = false;
24
+ }
25
+ /** Gets the particle system */
26
+ get particleSystem() {
27
+ return this._particleSystem;
28
+ }
29
+ /**
30
+ * Gets the name of the class
31
+ */
32
+ getClassName() {
33
+ return "FluidRenderingObjectParticleSystem";
34
+ }
35
+ /**
36
+ * Gets or sets a boolean indicating that the diffuse texture should be generated based on the regular rendering of the particle system (default: true).
37
+ * Sometimes, generating the diffuse texture this way may be sub-optimal. In that case, you can disable this property, in which case the particle system will be
38
+ * rendered using a ALPHA_COMBINE mode instead of the one used by the particle system.
39
+ */
40
+ get useTrueRenderingForDiffuseTexture() {
41
+ return this._useTrueRenderingForDiffuseTexture;
42
+ }
43
+ set useTrueRenderingForDiffuseTexture(use) {
44
+ if (this._useTrueRenderingForDiffuseTexture === use) {
45
+ return;
46
+ }
47
+ this._useTrueRenderingForDiffuseTexture = use;
48
+ if (use) {
49
+ this._particleSystem.blendMode = this._blendMode;
50
+ this._particleSystem.onBeforeDrawParticlesObservable.remove(this._onBeforeDrawParticleObserver);
51
+ this._onBeforeDrawParticleObserver = null;
52
+ }
53
+ else {
54
+ this._particleSystem.blendMode = -1;
55
+ this._onBeforeDrawParticleObserver = this._particleSystem.onBeforeDrawParticlesObservable.add(() => {
56
+ this._engine.setAlphaMode(2);
57
+ });
58
+ }
59
+ }
60
+ /**
61
+ * Gets the vertex buffers
62
+ */
63
+ get vertexBuffers() {
64
+ return this._particleSystem.vertexBuffers;
65
+ }
66
+ /**
67
+ * Gets the index buffer (or null if the object is using instancing)
68
+ */
69
+ get indexBuffer() {
70
+ return this._particleSystem.indexBuffer;
71
+ }
72
+ /**
73
+ * Indicates if the object is ready to be rendered
74
+ * @returns True if everything is ready for the object to be rendered, otherwise false
75
+ */
76
+ isReady() {
77
+ return super.isReady() && this._particleSystem.isReady();
78
+ }
79
+ /**
80
+ * Gets the number of particles in this particle system
81
+ * @returns The number of particles
82
+ */
83
+ get numParticles() {
84
+ return this._particleSystem.getActiveCount();
85
+ }
86
+ /**
87
+ * Render the diffuse texture for this object
88
+ */
89
+ renderDiffuseTexture() {
90
+ this._originalRender();
91
+ }
92
+ /**
93
+ * Releases the ressources used by the class
94
+ */
95
+ dispose() {
96
+ super.dispose();
97
+ this._particleSystem.onBeforeDrawParticlesObservable.remove(this._onBeforeDrawParticleObserver);
98
+ this._onBeforeDrawParticleObserver = null;
99
+ this._particleSystem.render = this._originalRender;
100
+ this._particleSystem.blendMode = this._blendMode;
101
+ this._particleSystem.updateInAnimate = this._updateInAnimate;
102
+ }
103
+ }
104
+ //# sourceMappingURL=fluidRenderingObjectParticleSystem.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fluidRenderingObjectParticleSystem.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Rendering/fluidRenderer/fluidRenderingObjectParticleSystem.ts"],"names":[],"mappings":"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","sourcesContent":["import type { VertexBuffer } from \"core/Buffers/buffer\";\r\nimport type { DataBuffer } from \"core/Buffers/dataBuffer\";\r\nimport { Constants } from \"core/Engines/constants\";\r\nimport type { Effect } from \"core/Materials/effect\";\r\nimport type { Observer } from \"core/Misc/observable\";\r\nimport type { IParticleSystem } from \"core/Particles/IParticleSystem\";\r\nimport type { Scene } from \"core/scene\";\r\nimport type { Nullable } from \"core/types\";\r\n\r\nimport { FluidRenderingObject } from \"./fluidRenderingObject\";\r\n\r\n/**\r\n * Defines a rendering object based on a particle system\r\n */\r\nexport class FluidRenderingObjectParticleSystem extends FluidRenderingObject {\r\n private _particleSystem: IParticleSystem;\r\n private _originalRender: () => number;\r\n private _blendMode: number;\r\n private _onBeforeDrawParticleObserver: Nullable<Observer<Nullable<Effect>>>;\r\n private _updateInAnimate: boolean;\r\n\r\n /** Gets the particle system */\r\n public get particleSystem() {\r\n return this._particleSystem;\r\n }\r\n\r\n /**\r\n * Gets the name of the class\r\n */\r\n public getClassName(): string {\r\n return \"FluidRenderingObjectParticleSystem\";\r\n }\r\n\r\n private _useTrueRenderingForDiffuseTexture = true;\r\n\r\n /**\r\n * Gets or sets a boolean indicating that the diffuse texture should be generated based on the regular rendering of the particle system (default: true).\r\n * Sometimes, generating the diffuse texture this way may be sub-optimal. In that case, you can disable this property, in which case the particle system will be\r\n * rendered using a ALPHA_COMBINE mode instead of the one used by the particle system.\r\n */\r\n public get useTrueRenderingForDiffuseTexture() {\r\n return this._useTrueRenderingForDiffuseTexture;\r\n }\r\n\r\n public set useTrueRenderingForDiffuseTexture(use: boolean) {\r\n if (this._useTrueRenderingForDiffuseTexture === use) {\r\n return;\r\n }\r\n\r\n this._useTrueRenderingForDiffuseTexture = use;\r\n\r\n if (use) {\r\n this._particleSystem.blendMode = this._blendMode;\r\n this._particleSystem.onBeforeDrawParticlesObservable.remove(this._onBeforeDrawParticleObserver);\r\n this._onBeforeDrawParticleObserver = null;\r\n } else {\r\n this._particleSystem.blendMode = -1;\r\n this._onBeforeDrawParticleObserver = this._particleSystem.onBeforeDrawParticlesObservable.add(() => {\r\n this._engine.setAlphaMode(Constants.ALPHA_COMBINE);\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * Gets the vertex buffers\r\n */\r\n public get vertexBuffers(): { [key: string]: VertexBuffer } {\r\n return this._particleSystem.vertexBuffers as { [key: string]: VertexBuffer };\r\n }\r\n\r\n /**\r\n * Gets the index buffer (or null if the object is using instancing)\r\n */\r\n public get indexBuffer(): Nullable<DataBuffer> {\r\n return this._particleSystem.indexBuffer;\r\n }\r\n\r\n /**\r\n * Creates a new instance of the class\r\n * @param scene The scene the particle system is part of\r\n * @param ps The particle system\r\n */\r\n constructor(scene: Scene, ps: IParticleSystem) {\r\n super(scene);\r\n\r\n this._particleSystem = ps;\r\n\r\n this._originalRender = ps.render.bind(ps);\r\n this._blendMode = ps.blendMode;\r\n this._onBeforeDrawParticleObserver = null;\r\n this._updateInAnimate = this._particleSystem.updateInAnimate;\r\n this._particleSystem.updateInAnimate = true;\r\n this._particleSystem.render = () => 0;\r\n\r\n this.particleSize = (ps.minSize + ps.maxSize) / 2;\r\n\r\n this.useTrueRenderingForDiffuseTexture = false;\r\n }\r\n\r\n /**\r\n * Indicates if the object is ready to be rendered\r\n * @returns True if everything is ready for the object to be rendered, otherwise false\r\n */\r\n public isReady(): boolean {\r\n return super.isReady() && this._particleSystem.isReady();\r\n }\r\n\r\n /**\r\n * Gets the number of particles in this particle system\r\n * @returns The number of particles\r\n */\r\n public get numParticles(): number {\r\n return this._particleSystem.getActiveCount();\r\n }\r\n\r\n /**\r\n * Render the diffuse texture for this object\r\n */\r\n public renderDiffuseTexture(): void {\r\n this._originalRender();\r\n }\r\n\r\n /**\r\n * Releases the ressources used by the class\r\n */\r\n public dispose() {\r\n super.dispose();\r\n\r\n this._particleSystem.onBeforeDrawParticlesObservable.remove(this._onBeforeDrawParticleObserver);\r\n this._onBeforeDrawParticleObserver = null;\r\n this._particleSystem.render = this._originalRender;\r\n this._particleSystem.blendMode = this._blendMode;\r\n this._particleSystem.updateInAnimate = this._updateInAnimate;\r\n }\r\n}\r\n"]}
@@ -0,0 +1,234 @@
1
+ import type { Camera } from "../../Cameras/camera.js";
2
+ import type { Engine } from "../../Engines/engine.js";
3
+ import type { BaseTexture } from "../../Materials/Textures/baseTexture.js";
4
+ import type { InternalTexture } from "../../Materials/Textures/internalTexture.js";
5
+ import { Color3, Color4 } from "../../Maths/math.color.js";
6
+ import { Matrix, Vector3 } from "../../Maths/math.vector.js";
7
+ import { Observable } from "../../Misc/observable.js";
8
+ import { PostProcess } from "../../PostProcesses/postProcess.js";
9
+ import type { Scene } from "../../scene.js";
10
+ import type { Nullable } from "../../types.js";
11
+ import type { FluidRenderingObject } from "./fluidRenderingObject";
12
+ import { FluidRenderingTextures } from "./fluidRenderingTextures";
13
+ /**
14
+ * Textures that can be displayed as a debugging tool
15
+ */
16
+ export declare enum FluidRenderingDebug {
17
+ DepthTexture = 0,
18
+ DepthBlurredTexture = 1,
19
+ ThicknessTexture = 2,
20
+ ThicknessBlurredTexture = 3,
21
+ DiffuseTexture = 4,
22
+ Normals = 5,
23
+ DiffuseRendering = 6
24
+ }
25
+ /**
26
+ * Class used to render an object as a fluid thanks to different render target textures (depth, thickness, diffuse)
27
+ */
28
+ export declare class FluidRenderingTargetRenderer {
29
+ protected _scene: Scene;
30
+ protected _camera: Nullable<Camera>;
31
+ protected _engine: Engine;
32
+ protected _invProjectionMatrix: Matrix;
33
+ protected _depthClearColor: Color4;
34
+ protected _thicknessClearColor: Color4;
35
+ protected _needInitialization: boolean;
36
+ /**
37
+ * Returns true if the class needs to be reinitialized (because of changes in parameterization)
38
+ */
39
+ get needInitialization(): boolean;
40
+ private _generateDiffuseTexture;
41
+ /**
42
+ * Gets or sets a boolean indicating that the diffuse texture should be generated and used for the rendering
43
+ */
44
+ get generateDiffuseTexture(): boolean;
45
+ set generateDiffuseTexture(generate: boolean);
46
+ /**
47
+ * Fluid color. Not used if generateDiffuseTexture is true
48
+ */
49
+ fluidColor: Color3;
50
+ /**
51
+ * Density of the fluid (positive number). The higher the value, the more opaque the fluid.
52
+ */
53
+ density: number;
54
+ /**
55
+ * Strength of the refraction (positive number, but generally between 0 and 0.3).
56
+ */
57
+ refractionStrength: number;
58
+ /**
59
+ * Strength of the fresnel effect (value between 0 and 1). Lower the value if you want to soften the specular effect
60
+ */
61
+ fresnelClamp: number;
62
+ /**
63
+ * Strength of the specular power (positive number). Increase the value to make the specular effect more concentrated
64
+ */
65
+ specularPower: number;
66
+ /**
67
+ * Minimum thickness of the particles (positive number). If useFixedThickness is true, minimumThickness is the thickness used
68
+ */
69
+ minimumThickness: number;
70
+ /**
71
+ * Direction of the light. The fluid is assumed to be lit by a directional light
72
+ */
73
+ dirLight: Vector3;
74
+ private _debugFeature;
75
+ /**
76
+ * Gets or sets the feature (texture) to be debugged. Not used if debug is false
77
+ */
78
+ get debugFeature(): FluidRenderingDebug;
79
+ set debugFeature(feature: FluidRenderingDebug);
80
+ private _debug;
81
+ /**
82
+ * Gets or sets a boolean indicating if we should display a specific texture (given by debugFeature) for debugging purpose
83
+ */
84
+ get debug(): boolean;
85
+ set debug(debug: boolean);
86
+ private _environmentMap?;
87
+ /**
88
+ * Gets or sets the environment map used for the reflection part of the shading
89
+ * If null, no map will be used. If undefined, the scene.environmentMap will be used (if defined)
90
+ */
91
+ get environmentMap(): Nullable<BaseTexture> | undefined;
92
+ set environmentMap(map: Nullable<BaseTexture> | undefined);
93
+ private _enableBlurDepth;
94
+ /**
95
+ * Gets or sets a boolean indicating that the depth texture should be blurred
96
+ */
97
+ get enableBlurDepth(): boolean;
98
+ set enableBlurDepth(enable: boolean);
99
+ private _blurDepthSizeDivisor;
100
+ /**
101
+ * 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
102
+ * For eg. if blurDepthSizeDivisor=2, the texture used to blur the depth will be half the size of the depth texture
103
+ */
104
+ get blurDepthSizeDivisor(): number;
105
+ set blurDepthSizeDivisor(scale: number);
106
+ private _blurDepthFilterSize;
107
+ /**
108
+ * 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)
109
+ */
110
+ get blurDepthFilterSize(): number;
111
+ set blurDepthFilterSize(filterSize: number);
112
+ private _blurDepthNumIterations;
113
+ /**
114
+ * 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)
115
+ */
116
+ get blurDepthNumIterations(): number;
117
+ set blurDepthNumIterations(numIterations: number);
118
+ private _blurDepthMaxFilterSize;
119
+ /**
120
+ * 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)
121
+ */
122
+ get blurDepthMaxFilterSize(): number;
123
+ set blurDepthMaxFilterSize(maxFilterSize: number);
124
+ private _blurDepthDepthScale;
125
+ /**
126
+ * Depth weight in the calculation when applying the bilateral blur to generate the depth blur texture (positive number, generally between 0 and 100)
127
+ */
128
+ get blurDepthDepthScale(): number;
129
+ set blurDepthDepthScale(scale: number);
130
+ private _enableBlurThickness;
131
+ /**
132
+ * Gets or sets a boolean indicating that the thickness texture should be blurred
133
+ */
134
+ get enableBlurThickness(): boolean;
135
+ set enableBlurThickness(enable: boolean);
136
+ private _blurThicknessSizeDivisor;
137
+ /**
138
+ * 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
139
+ * For eg. if blurThicknessSizeDivisor=2, the texture used to blur the thickness will be half the size of the thickness texture
140
+ */
141
+ get blurThicknessSizeDivisor(): number;
142
+ set blurThicknessSizeDivisor(scale: number);
143
+ private _blurThicknessFilterSize;
144
+ /**
145
+ * 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)
146
+ */
147
+ get blurThicknessFilterSize(): number;
148
+ set blurThicknessFilterSize(filterSize: number);
149
+ private _blurThicknessNumIterations;
150
+ /**
151
+ * 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)
152
+ */
153
+ get blurThicknessNumIterations(): number;
154
+ set blurThicknessNumIterations(numIterations: number);
155
+ private _useFixedThickness;
156
+ /**
157
+ * Gets or sets a boolean indicating that a fixed thickness should be used instead of generating a thickness texture
158
+ */
159
+ get useFixedThickness(): boolean;
160
+ set useFixedThickness(use: boolean);
161
+ /** @internal */
162
+ _bgDepthTexture: Nullable<InternalTexture>;
163
+ /** @internal */
164
+ _onUseVelocityChanged: Observable<FluidRenderingTargetRenderer>;
165
+ private _useVelocity;
166
+ /**
167
+ * Gets or sets a boolean indicating that the velocity should be used when rendering the particles as a fluid.
168
+ * Note: the vertex buffers must contain a "velocity" buffer for this to work!
169
+ */
170
+ get useVelocity(): boolean;
171
+ set useVelocity(use: boolean);
172
+ private _depthMapSize;
173
+ /**
174
+ * Defines the size of the depth texture.
175
+ * If null, the texture will have the size of the screen
176
+ */
177
+ get depthMapSize(): Nullable<number>;
178
+ set depthMapSize(size: Nullable<number>);
179
+ private _thicknessMapSize;
180
+ /**
181
+ * Defines the size of the thickness texture.
182
+ * If null, the texture will have the size of the screen
183
+ */
184
+ get thicknessMapSize(): Nullable<number>;
185
+ set thicknessMapSize(size: Nullable<number>);
186
+ private _diffuseMapSize;
187
+ /**
188
+ * Defines the size of the diffuse texture.
189
+ * If null, the texture will have the size of the screen
190
+ */
191
+ get diffuseMapSize(): Nullable<number>;
192
+ set diffuseMapSize(size: Nullable<number>);
193
+ private _samples;
194
+ /**
195
+ * Gets or sets the number of samples used by MSAA
196
+ * 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)
197
+ */
198
+ get samples(): number;
199
+ set samples(samples: number);
200
+ /**
201
+ * Gets the camera used for the rendering
202
+ */
203
+ get camera(): Nullable<Camera>;
204
+ /** @internal */
205
+ _renderPostProcess: Nullable<PostProcess>;
206
+ /** @internal */
207
+ _depthRenderTarget: Nullable<FluidRenderingTextures>;
208
+ /** @internal */
209
+ _diffuseRenderTarget: Nullable<FluidRenderingTextures>;
210
+ /** @internal */
211
+ _thicknessRenderTarget: Nullable<FluidRenderingTextures>;
212
+ /**
213
+ * Creates an instance of the class
214
+ * @param scene Scene used to render the fluid object into
215
+ * @param camera Camera used to render the fluid object. If not provided, use the active camera of the scene instead
216
+ */
217
+ constructor(scene: Scene, camera?: Camera);
218
+ /** @internal */
219
+ _initialize(): void;
220
+ protected _setBlurParameters(renderTarget?: Nullable<FluidRenderingTextures>): void;
221
+ protected _setBlurDepthParameters(): void;
222
+ protected _setBlurThicknessParameters(): void;
223
+ protected _initializeRenderTarget(renderTarget: FluidRenderingTextures): void;
224
+ protected _createLiquidRenderingPostProcess(): void;
225
+ /** @internal */
226
+ _clearTargets(): void;
227
+ /** @internal */
228
+ _render(fluidObject: FluidRenderingObject): void;
229
+ /**
230
+ * Releases all the ressources used by the class
231
+ * @param onlyPostProcesses If true, releases only the ressources used by the render post processes
232
+ */
233
+ dispose(onlyPostProcesses?: boolean): void;
234
+ }