@babylonjs/core 5.22.1 → 5.24.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 (351) hide show
  1. package/Actions/abstractActionManager.d.ts +6 -6
  2. package/Actions/abstractActionManager.js +1 -1
  3. package/Actions/abstractActionManager.js.map +1 -1
  4. package/Actions/actionManager.d.ts +5 -5
  5. package/Actions/actionManager.js +5 -5
  6. package/Actions/actionManager.js.map +1 -1
  7. package/Animations/animatable.js +2 -1
  8. package/Animations/animatable.js.map +1 -1
  9. package/Animations/animation.js +137 -139
  10. package/Animations/animation.js.map +1 -1
  11. package/Animations/animationGroup.d.ts +3 -3
  12. package/Animations/animationGroup.js +3 -3
  13. package/Animations/animationGroup.js.map +1 -1
  14. package/Animations/runtimeAnimation.js +6 -7
  15. package/Animations/runtimeAnimation.js.map +1 -1
  16. package/Audio/audioSceneComponent.d.ts +1 -1
  17. package/Audio/audioSceneComponent.js.map +1 -1
  18. package/Audio/sound.d.ts +2 -1
  19. package/Audio/sound.js +21 -9
  20. package/Audio/sound.js.map +1 -1
  21. package/Behaviors/Cameras/autoRotationBehavior.d.ts +1 -1
  22. package/Behaviors/Cameras/autoRotationBehavior.js +1 -1
  23. package/Behaviors/Cameras/autoRotationBehavior.js.map +1 -1
  24. package/Behaviors/Cameras/bouncingBehavior.d.ts +1 -1
  25. package/Behaviors/Cameras/bouncingBehavior.js +1 -1
  26. package/Behaviors/Cameras/bouncingBehavior.js.map +1 -1
  27. package/Behaviors/Cameras/framingBehavior.d.ts +1 -1
  28. package/Behaviors/Cameras/framingBehavior.js +1 -1
  29. package/Behaviors/Cameras/framingBehavior.js.map +1 -1
  30. package/Bones/bone.d.ts +1 -1
  31. package/Bones/bone.js +1 -1
  32. package/Bones/bone.js.map +1 -1
  33. package/Bones/skeleton.d.ts +2 -2
  34. package/Bones/skeleton.js +11 -5
  35. package/Bones/skeleton.js.map +1 -1
  36. package/Cameras/Inputs/BaseCameraMouseWheelInput.js +3 -22
  37. package/Cameras/Inputs/BaseCameraMouseWheelInput.js.map +1 -1
  38. package/Cameras/Inputs/BaseCameraPointersInput.js +3 -3
  39. package/Cameras/Inputs/BaseCameraPointersInput.js.map +1 -1
  40. package/Cameras/Inputs/arcRotateCameraMouseWheelInput.js +1 -11
  41. package/Cameras/Inputs/arcRotateCameraMouseWheelInput.js.map +1 -1
  42. package/Cameras/Inputs/flyCameraMouseInput.js +3 -3
  43. package/Cameras/Inputs/flyCameraMouseInput.js.map +1 -1
  44. package/Cameras/Inputs/followCameraMouseWheelInput.js +1 -4
  45. package/Cameras/Inputs/followCameraMouseWheelInput.js.map +1 -1
  46. package/Cameras/Inputs/freeCameraMouseInput.js +3 -3
  47. package/Cameras/Inputs/freeCameraMouseInput.js.map +1 -1
  48. package/Cameras/arcRotateCamera.d.ts +1 -1
  49. package/Cameras/arcRotateCamera.js +1 -1
  50. package/Cameras/arcRotateCamera.js.map +1 -1
  51. package/Cameras/camera.d.ts +2 -2
  52. package/Cameras/camera.js +2 -2
  53. package/Cameras/camera.js.map +1 -1
  54. package/Cameras/freeCamera.d.ts +1 -1
  55. package/Cameras/freeCamera.js +1 -1
  56. package/Cameras/freeCamera.js.map +1 -1
  57. package/Cameras/gamepadCamera.d.ts +1 -1
  58. package/Cameras/gamepadCamera.js +1 -1
  59. package/Cameras/gamepadCamera.js.map +1 -1
  60. package/Cameras/targetCamera.d.ts +1 -1
  61. package/Cameras/targetCamera.js +1 -1
  62. package/Cameras/targetCamera.js.map +1 -1
  63. package/Cameras/touchCamera.d.ts +1 -1
  64. package/Cameras/touchCamera.js +1 -1
  65. package/Cameras/touchCamera.js.map +1 -1
  66. package/Cameras/universalCamera.d.ts +1 -1
  67. package/Cameras/universalCamera.js +1 -1
  68. package/Cameras/universalCamera.js.map +1 -1
  69. package/Cameras/virtualJoysticksCamera.d.ts +1 -1
  70. package/Cameras/virtualJoysticksCamera.js +1 -1
  71. package/Cameras/virtualJoysticksCamera.js.map +1 -1
  72. package/Culling/boundingBox.d.ts +2 -2
  73. package/Culling/boundingBox.js +2 -2
  74. package/Culling/boundingBox.js.map +1 -1
  75. package/Culling/ray.d.ts +1 -1
  76. package/Culling/ray.js +1 -1
  77. package/Culling/ray.js.map +1 -1
  78. package/Debug/debugLayer.d.ts +1 -1
  79. package/Debug/debugLayer.js +1 -1
  80. package/Debug/debugLayer.js.map +1 -1
  81. package/DeviceInput/webDeviceInputSystem.js +20 -2
  82. package/DeviceInput/webDeviceInputSystem.js.map +1 -1
  83. package/Engines/Extensions/engine.multiRender.js +8 -10
  84. package/Engines/Extensions/engine.multiRender.js.map +1 -1
  85. package/Engines/Extensions/engine.query.d.ts +2 -2
  86. package/Engines/Extensions/engine.query.js.map +1 -1
  87. package/Engines/ICanvas.d.ts +11 -0
  88. package/Engines/ICanvas.js.map +1 -1
  89. package/Engines/WebGL/webGLPipelineContext.d.ts +29 -19
  90. package/Engines/WebGL/webGLPipelineContext.js +99 -311
  91. package/Engines/WebGL/webGLPipelineContext.js.map +1 -1
  92. package/Engines/WebGL/webGLRenderTargetWrapper.js +1 -1
  93. package/Engines/WebGL/webGLRenderTargetWrapper.js.map +1 -1
  94. package/Engines/engine.d.ts +2 -2
  95. package/Engines/engine.js +2 -2
  96. package/Engines/engine.js.map +1 -1
  97. package/Engines/nativeEngine.d.ts +2 -2
  98. package/Engines/nativeEngine.js +2 -2
  99. package/Engines/nativeEngine.js.map +1 -1
  100. package/Engines/renderTargetWrapper.d.ts +1 -0
  101. package/Engines/renderTargetWrapper.js +5 -2
  102. package/Engines/renderTargetWrapper.js.map +1 -1
  103. package/Engines/thinEngine.d.ts +6 -5
  104. package/Engines/thinEngine.js +11 -7
  105. package/Engines/thinEngine.js.map +1 -1
  106. package/Engines/webgpuEngine.js +4 -1
  107. package/Engines/webgpuEngine.js.map +1 -1
  108. package/Events/clipboardEvents.d.ts +1 -1
  109. package/Events/clipboardEvents.js +1 -1
  110. package/Events/clipboardEvents.js.map +1 -1
  111. package/Events/deviceInputEvents.d.ts +11 -4
  112. package/Events/deviceInputEvents.js.map +1 -1
  113. package/Gamepads/Controllers/windowsMotionController.d.ts +1 -1
  114. package/Gamepads/Controllers/windowsMotionController.js +1 -1
  115. package/Gamepads/Controllers/windowsMotionController.js.map +1 -1
  116. package/Gizmos/boundingBoxGizmo.d.ts +4 -0
  117. package/Gizmos/boundingBoxGizmo.js +6 -0
  118. package/Gizmos/boundingBoxGizmo.js.map +1 -1
  119. package/Inputs/scene.inputManager.js +4 -4
  120. package/Inputs/scene.inputManager.js.map +1 -1
  121. package/Layers/effectLayer.d.ts +3 -3
  122. package/Layers/effectLayer.js +1 -1
  123. package/Layers/effectLayer.js.map +1 -1
  124. package/Layers/glowLayer.d.ts +3 -3
  125. package/Layers/glowLayer.js +2 -2
  126. package/Layers/glowLayer.js.map +1 -1
  127. package/Layers/highlightLayer.d.ts +3 -3
  128. package/Layers/highlightLayer.js +2 -2
  129. package/Layers/highlightLayer.js.map +1 -1
  130. package/Lights/directionalLight.d.ts +2 -2
  131. package/Lights/directionalLight.js +2 -2
  132. package/Lights/directionalLight.js.map +1 -1
  133. package/Lights/hemisphericLight.d.ts +3 -3
  134. package/Lights/hemisphericLight.js +3 -3
  135. package/Lights/hemisphericLight.js.map +1 -1
  136. package/Lights/light.d.ts +2 -2
  137. package/Lights/light.js +2 -2
  138. package/Lights/light.js.map +1 -1
  139. package/Lights/lightConstants.d.ts +1 -1
  140. package/Lights/lightConstants.js +1 -1
  141. package/Lights/lightConstants.js.map +1 -1
  142. package/Loading/Plugins/babylonFileLoader.js +3 -0
  143. package/Loading/Plugins/babylonFileLoader.js.map +1 -1
  144. package/Loading/sceneLoader.d.ts +1 -1
  145. package/Loading/sceneLoader.js.map +1 -1
  146. package/Materials/Background/backgroundMaterial.js +4 -0
  147. package/Materials/Background/backgroundMaterial.js.map +1 -1
  148. package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js +4 -1
  149. package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js.map +1 -1
  150. package/Materials/Node/nodeMaterial.d.ts +1 -1
  151. package/Materials/Node/nodeMaterial.js +5 -1
  152. package/Materials/Node/nodeMaterial.js.map +1 -1
  153. package/Materials/PBR/pbrBaseMaterial.js +4 -1
  154. package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
  155. package/Materials/Textures/Filtering/hdrFiltering.d.ts +1 -1
  156. package/Materials/Textures/Filtering/hdrFiltering.js +1 -1
  157. package/Materials/Textures/Filtering/hdrFiltering.js.map +1 -1
  158. package/Materials/Textures/Procedurals/customProceduralTexture.d.ts +2 -1
  159. package/Materials/Textures/Procedurals/customProceduralTexture.js +9 -3
  160. package/Materials/Textures/Procedurals/customProceduralTexture.js.map +1 -1
  161. package/Materials/Textures/Procedurals/proceduralTexture.d.ts +9 -9
  162. package/Materials/Textures/Procedurals/proceduralTexture.js +9 -9
  163. package/Materials/Textures/Procedurals/proceduralTexture.js.map +1 -1
  164. package/Materials/Textures/colorGradingTexture.d.ts +1 -1
  165. package/Materials/Textures/colorGradingTexture.js +1 -1
  166. package/Materials/Textures/colorGradingTexture.js.map +1 -1
  167. package/Materials/Textures/cubeTexture.d.ts +2 -2
  168. package/Materials/Textures/cubeTexture.js +2 -2
  169. package/Materials/Textures/cubeTexture.js.map +1 -1
  170. package/Materials/Textures/rawCubeTexture.d.ts +1 -1
  171. package/Materials/Textures/rawCubeTexture.js +1 -1
  172. package/Materials/Textures/rawCubeTexture.js.map +1 -1
  173. package/Materials/Textures/renderTargetTexture.d.ts +3 -5
  174. package/Materials/Textures/renderTargetTexture.js +19 -19
  175. package/Materials/Textures/renderTargetTexture.js.map +1 -1
  176. package/Materials/colorCurves.d.ts +3 -3
  177. package/Materials/colorCurves.js +3 -3
  178. package/Materials/colorCurves.js.map +1 -1
  179. package/Materials/effect.d.ts +27 -27
  180. package/Materials/effect.js +22 -288
  181. package/Materials/effect.js.map +1 -1
  182. package/Materials/fresnelParameters.d.ts +1 -1
  183. package/Materials/fresnelParameters.js +1 -1
  184. package/Materials/fresnelParameters.js.map +1 -1
  185. package/Materials/imageProcessingConfiguration.d.ts +4 -4
  186. package/Materials/imageProcessingConfiguration.js +4 -4
  187. package/Materials/imageProcessingConfiguration.js.map +1 -1
  188. package/Materials/shaderMaterial.d.ts +25 -25
  189. package/Materials/shaderMaterial.js +25 -25
  190. package/Materials/shaderMaterial.js.map +1 -1
  191. package/Materials/standardMaterial.js +4 -1
  192. package/Materials/standardMaterial.js.map +1 -1
  193. package/Maths/index.d.ts +1 -0
  194. package/Maths/index.js +1 -0
  195. package/Maths/index.js.map +1 -1
  196. package/Maths/math.functions.d.ts +2 -2
  197. package/Maths/math.functions.js +2 -2
  198. package/Maths/math.functions.js.map +1 -1
  199. package/Maths/math.polar.d.ts +77 -0
  200. package/Maths/math.polar.js +114 -0
  201. package/Maths/math.polar.js.map +1 -0
  202. package/Maths/math.scalar.d.ts +2 -2
  203. package/Maths/math.scalar.js +2 -2
  204. package/Maths/math.scalar.js.map +1 -1
  205. package/Maths/math.vector.d.ts +13 -12
  206. package/Maths/math.vector.js +13 -12
  207. package/Maths/math.vector.js.map +1 -1
  208. package/Meshes/abstractMesh.d.ts +1 -1
  209. package/Meshes/abstractMesh.js +13 -2
  210. package/Meshes/abstractMesh.js.map +1 -1
  211. package/Meshes/geometry.d.ts +3 -3
  212. package/Meshes/geometry.js +3 -3
  213. package/Meshes/geometry.js.map +1 -1
  214. package/Meshes/groundMesh.d.ts +5 -4
  215. package/Meshes/groundMesh.js +5 -4
  216. package/Meshes/groundMesh.js.map +1 -1
  217. package/Meshes/instancedMesh.d.ts +1 -1
  218. package/Meshes/instancedMesh.js +1 -1
  219. package/Meshes/instancedMesh.js.map +1 -1
  220. package/Meshes/mesh.d.ts +3 -3
  221. package/Meshes/mesh.js +7 -3
  222. package/Meshes/mesh.js.map +1 -1
  223. package/Meshes/subMesh.d.ts +1 -1
  224. package/Meshes/subMesh.js +1 -1
  225. package/Meshes/subMesh.js.map +1 -1
  226. package/Meshes/thinInstanceMesh.d.ts +1 -1
  227. package/Meshes/thinInstanceMesh.js.map +1 -1
  228. package/Meshes/transformNode.js +6 -0
  229. package/Meshes/transformNode.js.map +1 -1
  230. package/Misc/HighDynamicRange/cubemapToSphericalPolynomial.d.ts +2 -2
  231. package/Misc/HighDynamicRange/cubemapToSphericalPolynomial.js +2 -2
  232. package/Misc/HighDynamicRange/cubemapToSphericalPolynomial.js.map +1 -1
  233. package/Misc/HighDynamicRange/hdr.d.ts +3 -3
  234. package/Misc/HighDynamicRange/hdr.js +3 -3
  235. package/Misc/HighDynamicRange/hdr.js.map +1 -1
  236. package/Misc/HighDynamicRange/panoramaToCubemap.d.ts +1 -1
  237. package/Misc/HighDynamicRange/panoramaToCubemap.js +1 -1
  238. package/Misc/HighDynamicRange/panoramaToCubemap.js.map +1 -1
  239. package/Misc/arrayTools.d.ts +13 -12
  240. package/Misc/arrayTools.js +70 -39
  241. package/Misc/arrayTools.js.map +1 -1
  242. package/Misc/assetsManager.d.ts +3 -3
  243. package/Misc/assetsManager.js +3 -3
  244. package/Misc/assetsManager.js.map +1 -1
  245. package/Misc/basis.js +17 -3
  246. package/Misc/basis.js.map +1 -1
  247. package/Misc/environmentTextureTools.d.ts +4 -4
  248. package/Misc/environmentTextureTools.js +5 -5
  249. package/Misc/environmentTextureTools.js.map +1 -1
  250. package/Misc/fileTools.d.ts +3 -3
  251. package/Misc/fileTools.js +19 -12
  252. package/Misc/fileTools.js.map +1 -1
  253. package/Misc/logger.js +1 -1
  254. package/Misc/logger.js.map +1 -1
  255. package/Misc/observable.d.ts +1 -1
  256. package/Misc/observable.js +1 -1
  257. package/Misc/observable.js.map +1 -1
  258. package/Misc/performanceMonitor.d.ts +3 -3
  259. package/Misc/performanceMonitor.js +3 -3
  260. package/Misc/performanceMonitor.js.map +1 -1
  261. package/Misc/rgbdTextureTools.d.ts +1 -1
  262. package/Misc/rgbdTextureTools.js +1 -1
  263. package/Misc/rgbdTextureTools.js.map +1 -1
  264. package/Misc/sceneOptimizer.d.ts +7 -7
  265. package/Misc/sceneOptimizer.js +7 -7
  266. package/Misc/sceneOptimizer.js.map +1 -1
  267. package/Misc/stringDictionary.d.ts +6 -6
  268. package/Misc/stringDictionary.js +6 -6
  269. package/Misc/stringDictionary.js.map +1 -1
  270. package/Misc/textureTools.d.ts +4 -4
  271. package/Misc/textureTools.js +4 -4
  272. package/Misc/textureTools.js.map +1 -1
  273. package/Misc/tools.d.ts +6 -6
  274. package/Misc/tools.js +6 -6
  275. package/Misc/tools.js.map +1 -1
  276. package/Misc/videoRecorder.d.ts +1 -1
  277. package/Misc/videoRecorder.js +1 -1
  278. package/Misc/videoRecorder.js.map +1 -1
  279. package/Offline/database.js +3 -3
  280. package/Offline/database.js.map +1 -1
  281. package/Particles/IParticleSystem.d.ts +1 -1
  282. package/Particles/IParticleSystem.js.map +1 -1
  283. package/Particles/gpuParticleSystem.d.ts +1 -1
  284. package/Particles/gpuParticleSystem.js +1 -1
  285. package/Particles/gpuParticleSystem.js.map +1 -1
  286. package/Particles/particleSystem.d.ts +1 -1
  287. package/Particles/particleSystem.js +1 -1
  288. package/Particles/particleSystem.js.map +1 -1
  289. package/Particles/solidParticleSystem.d.ts +4 -0
  290. package/Particles/solidParticleSystem.js +25 -3
  291. package/Particles/solidParticleSystem.js.map +1 -1
  292. package/Physics/Plugins/ammoJSPlugin.d.ts +1 -1
  293. package/Physics/Plugins/ammoJSPlugin.js +1 -1
  294. package/Physics/Plugins/ammoJSPlugin.js.map +1 -1
  295. package/Physics/Plugins/oimoJSPlugin.js +1 -1
  296. package/Physics/Plugins/oimoJSPlugin.js.map +1 -1
  297. package/Physics/physicsEngineComponent.d.ts +1 -1
  298. package/Physics/physicsEngineComponent.js +1 -1
  299. package/Physics/physicsEngineComponent.js.map +1 -1
  300. package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js +3 -3
  301. package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js.map +1 -1
  302. package/PostProcesses/RenderPipeline/postProcessRenderPipeline.js +1 -2
  303. package/PostProcesses/RenderPipeline/postProcessRenderPipeline.js.map +1 -1
  304. package/PostProcesses/blurPostProcess.d.ts +3 -3
  305. package/PostProcesses/blurPostProcess.js +3 -3
  306. package/PostProcesses/blurPostProcess.js.map +1 -1
  307. package/PostProcesses/volumetricLightScatteringPostProcess.d.ts +3 -3
  308. package/PostProcesses/volumetricLightScatteringPostProcess.js +3 -3
  309. package/PostProcesses/volumetricLightScatteringPostProcess.js.map +1 -1
  310. package/Rendering/depthPeelingRenderer.d.ts +1 -0
  311. package/Rendering/depthPeelingRenderer.js +32 -5
  312. package/Rendering/depthPeelingRenderer.js.map +1 -1
  313. package/Rendering/edgesRenderer.d.ts +2 -2
  314. package/Rendering/edgesRenderer.js +1 -1
  315. package/Rendering/edgesRenderer.js.map +1 -1
  316. package/Rendering/geometryBufferRenderer.d.ts +4 -2
  317. package/Rendering/geometryBufferRenderer.js +5 -3
  318. package/Rendering/geometryBufferRenderer.js.map +1 -1
  319. package/Rendering/geometryBufferRendererSceneComponent.d.ts +2 -1
  320. package/Rendering/geometryBufferRendererSceneComponent.js +3 -2
  321. package/Rendering/geometryBufferRendererSceneComponent.js.map +1 -1
  322. package/Rendering/prePassRenderer.d.ts +11 -3
  323. package/Rendering/prePassRenderer.js +18 -3
  324. package/Rendering/prePassRenderer.js.map +1 -1
  325. package/Rendering/subSurfaceConfiguration.d.ts +2 -2
  326. package/Rendering/subSurfaceConfiguration.js +2 -2
  327. package/Rendering/subSurfaceConfiguration.js.map +1 -1
  328. package/Sprites/spriteSceneComponent.js +4 -1
  329. package/Sprites/spriteSceneComponent.js.map +1 -1
  330. package/XR/features/WebXRControllerTeleportation.d.ts +4 -0
  331. package/XR/features/WebXRControllerTeleportation.js +24 -19
  332. package/XR/features/WebXRControllerTeleportation.js.map +1 -1
  333. package/XR/motionController/webXRAbstractMotionController.d.ts +2 -2
  334. package/XR/motionController/webXRAbstractMotionController.js +2 -2
  335. package/XR/motionController/webXRAbstractMotionController.js.map +1 -1
  336. package/XR/motionController/webXRControllerComponent.d.ts +1 -1
  337. package/XR/motionController/webXRControllerComponent.js +1 -1
  338. package/XR/motionController/webXRControllerComponent.js.map +1 -1
  339. package/XR/motionController/webXRMotionControllerManager.d.ts +3 -3
  340. package/XR/motionController/webXRMotionControllerManager.js +3 -3
  341. package/XR/motionController/webXRMotionControllerManager.js.map +1 -1
  342. package/node.d.ts +4 -4
  343. package/node.js +3 -3
  344. package/node.js.map +1 -1
  345. package/package.json +1 -1
  346. package/readme.md +0 -4
  347. package/scene.d.ts +80 -63
  348. package/scene.js +92 -46
  349. package/scene.js.map +1 -1
  350. package/sceneComponent.d.ts +1 -1
  351. package/sceneComponent.js.map +1 -1
package/scene.js CHANGED
@@ -25,7 +25,19 @@ import { UniqueIdGenerator } from "./Misc/uniqueIdGenerator.js";
25
25
  import { ReadFile, RequestFile, LoadFile } from "./Misc/fileTools.js";
26
26
  import { LightConstants } from "./Lights/lightConstants.js";
27
27
  import { ComputePressureObserverWrapper } from "./Misc/computePressure.js";
28
- import { ArrayTools } from "./Misc/arrayTools.js";
28
+ import { _ObserveArray } from "./Misc/arrayTools.js";
29
+ /**
30
+ * Define how the scene should favor performance over ease of use
31
+ */
32
+ export var ScenePerformancePriority;
33
+ (function (ScenePerformancePriority) {
34
+ /** Default mode. No change. Performance will be treated as less important than backward compatibility */
35
+ ScenePerformancePriority[ScenePerformancePriority["BackwardCompatible"] = 0] = "BackwardCompatible";
36
+ /** Some performance options will be turned on trying to strike a balance between perf and ease of use */
37
+ ScenePerformancePriority[ScenePerformancePriority["Intermediate"] = 1] = "Intermediate";
38
+ /** Performance will be top priority */
39
+ ScenePerformancePriority[ScenePerformancePriority["Aggressive"] = 2] = "Aggressive";
40
+ })(ScenePerformancePriority || (ScenePerformancePriority = {}));
29
41
  /**
30
42
  * Represents a scene to be rendered by the engine.
31
43
  * @see https://doc.babylonjs.com/features/scene
@@ -70,6 +82,7 @@ export class Scene extends AbstractScene {
70
82
  * this is easier to reference from here than from all the materials.
71
83
  */
72
84
  this.environmentIntensity = 1;
85
+ this._performancePriority = ScenePerformancePriority.BackwardCompatible;
73
86
  this._forceWireframe = false;
74
87
  this._skipFrustumClipping = false;
75
88
  this._forcePointsCloud = false;
@@ -388,7 +401,7 @@ export class Scene extends AbstractScene {
388
401
  // Lights
389
402
  this._shadowsEnabled = true;
390
403
  this._lightsEnabled = true;
391
- this._activeCameras = ArrayTools.MakeObservableArray(this.onActiveCamerasChanged, []);
404
+ this._unObserveActiveCameras = null;
392
405
  // Textures
393
406
  this._texturesEnabled = true;
394
407
  // Physics
@@ -667,6 +680,7 @@ export class Scene extends AbstractScene {
667
680
  * Note: Compute pressure is an experimental API.
668
681
  */
669
682
  this.onComputePressureChanged = new Observable();
683
+ this.activeCameras = new Array();
670
684
  const fullOptions = {
671
685
  useGeometryUniqueIdsMap: true,
672
686
  useMaterialMeshMap: true,
@@ -762,6 +776,27 @@ export class Scene extends AbstractScene {
762
776
  get imageProcessingConfiguration() {
763
777
  return this._imageProcessingConfiguration;
764
778
  }
779
+ /**
780
+ * Gets or sets a value indicating how to treat performance relatively to ease of use and backward compatibility
781
+ */
782
+ get performancePriority() {
783
+ return this._performancePriority;
784
+ }
785
+ set performancePriority(value) {
786
+ if (value === this._performancePriority) {
787
+ return;
788
+ }
789
+ this._performancePriority = value;
790
+ switch (value) {
791
+ case ScenePerformancePriority.Aggressive:
792
+ this.skipFrustumClipping = true;
793
+ // eslint-disable-next-line no-fallthrough
794
+ case ScenePerformancePriority.Intermediate:
795
+ this.skipPointerMovePicking = true;
796
+ this.autoClear = false;
797
+ break;
798
+ }
799
+ }
765
800
  /**
766
801
  * Gets or sets a boolean indicating if all rendering must be done in wireframe
767
802
  */
@@ -893,7 +928,7 @@ export class Scene extends AbstractScene {
893
928
  * @param effect The effect to be bound
894
929
  * @param variableName name of the shader variable that will hold the eye position
895
930
  * @param isVector3 true to indicates that variableName is a Vector3 and not a Vector4
896
- * @return the computed eye position
931
+ * @returns the computed eye position
897
932
  */
898
933
  bindEyePosition(effect, variableName = "vEyePosition", isVector3 = false) {
899
934
  const eyePosition = this._forcedViewPosition
@@ -1033,7 +1068,16 @@ export class Scene extends AbstractScene {
1033
1068
  return this._activeCameras;
1034
1069
  }
1035
1070
  set activeCameras(cameras) {
1036
- this._activeCameras = ArrayTools.MakeObservableArray(this.onActiveCamerasChanged, cameras);
1071
+ if (this._unObserveActiveCameras) {
1072
+ this._unObserveActiveCameras();
1073
+ this._unObserveActiveCameras = null;
1074
+ }
1075
+ if (cameras) {
1076
+ this._unObserveActiveCameras = _ObserveArray(cameras, () => {
1077
+ this.onActiveCamerasChanged.notifyObservers(this);
1078
+ });
1079
+ }
1080
+ this._activeCameras = cameras;
1037
1081
  }
1038
1082
  /** Gets or sets the current active camera */
1039
1083
  get activeCamera() {
@@ -1385,7 +1429,7 @@ export class Scene extends AbstractScene {
1385
1429
  * This function will check if the scene can be rendered (textures are loaded, shaders are compiled)
1386
1430
  * Delay loaded resources are not taking in account
1387
1431
  * @param checkRenderTargets true to also check that the meshes rendered as part of a render target are ready (default: true)
1388
- * @return true if all required resources are ready
1432
+ * @returns true if all required resources are ready
1389
1433
  */
1390
1434
  isReady(checkRenderTargets = true) {
1391
1435
  if (this._isDisposed) {
@@ -2195,7 +2239,7 @@ export class Scene extends AbstractScene {
2195
2239
  /**
2196
2240
  * sets the active camera of the scene using its Id
2197
2241
  * @param id defines the camera's Id
2198
- * @return the new active camera or null if none found.
2242
+ * @returns the new active camera or null if none found.
2199
2243
  */
2200
2244
  setActiveCameraById(id) {
2201
2245
  const camera = this.getCameraById(id);
@@ -2221,7 +2265,7 @@ export class Scene extends AbstractScene {
2221
2265
  /**
2222
2266
  * get an animation group using its name
2223
2267
  * @param name defines the material's name
2224
- * @return the animation group or null if none found.
2268
+ * @returns the animation group or null if none found.
2225
2269
  */
2226
2270
  getAnimationGroupByName(name) {
2227
2271
  for (let index = 0; index < this.animationGroups.length; index++) {
@@ -2234,7 +2278,7 @@ export class Scene extends AbstractScene {
2234
2278
  /**
2235
2279
  * Get a material using its unique id
2236
2280
  * @param uniqueId defines the material's unique id
2237
- * @return the material or null if none found.
2281
+ * @returns the material or null if none found.
2238
2282
  */
2239
2283
  getMaterialByUniqueID(uniqueId) {
2240
2284
  for (let index = 0; index < this.materials.length; index++) {
@@ -2247,7 +2291,7 @@ export class Scene extends AbstractScene {
2247
2291
  /**
2248
2292
  * get a material using its id
2249
2293
  * @param id defines the material's Id
2250
- * @return the material or null if none found.
2294
+ * @returns the material or null if none found.
2251
2295
  */
2252
2296
  getMaterialById(id) {
2253
2297
  for (let index = 0; index < this.materials.length; index++) {
@@ -2261,7 +2305,7 @@ export class Scene extends AbstractScene {
2261
2305
  * Gets a the last added material using a given id
2262
2306
  * @param id defines the material's Id
2263
2307
  * @param allowMultiMaterials determines whether multimaterials should be considered
2264
- * @return the last material with the given id or null if none found.
2308
+ * @returns the last material with the given id or null if none found.
2265
2309
  */
2266
2310
  getLastMaterialById(id, allowMultiMaterials = false) {
2267
2311
  for (let index = this.materials.length - 1; index >= 0; index--) {
@@ -2281,7 +2325,7 @@ export class Scene extends AbstractScene {
2281
2325
  /**
2282
2326
  * Gets a material using its name
2283
2327
  * @param name defines the material's name
2284
- * @return the material or null if none found.
2328
+ * @returns the material or null if none found.
2285
2329
  */
2286
2330
  getMaterialByName(name) {
2287
2331
  for (let index = 0; index < this.materials.length; index++) {
@@ -2294,7 +2338,7 @@ export class Scene extends AbstractScene {
2294
2338
  /**
2295
2339
  * Get a texture using its unique id
2296
2340
  * @param uniqueId defines the texture's unique id
2297
- * @return the texture or null if none found.
2341
+ * @returns the texture or null if none found.
2298
2342
  */
2299
2343
  getTextureByUniqueId(uniqueId) {
2300
2344
  for (let index = 0; index < this.textures.length; index++) {
@@ -2307,7 +2351,7 @@ export class Scene extends AbstractScene {
2307
2351
  /**
2308
2352
  * Gets a texture using its name
2309
2353
  * @param name defines the texture's name
2310
- * @return the texture or null if none found.
2354
+ * @returns the texture or null if none found.
2311
2355
  */
2312
2356
  getTextureByName(name) {
2313
2357
  for (let index = 0; index < this.textures.length; index++) {
@@ -2346,7 +2390,7 @@ export class Scene extends AbstractScene {
2346
2390
  /**
2347
2391
  * Gets a camera using its name
2348
2392
  * @param name defines the camera's name
2349
- * @return the camera or null if none found.
2393
+ * @returns the camera or null if none found.
2350
2394
  */
2351
2395
  getCameraByName(name) {
2352
2396
  for (let index = 0; index < this.cameras.length; index++) {
@@ -2359,7 +2403,7 @@ export class Scene extends AbstractScene {
2359
2403
  /**
2360
2404
  * Gets a bone using its Id
2361
2405
  * @param id defines the bone's Id
2362
- * @return the bone or null if not found
2406
+ * @returns the bone or null if not found
2363
2407
  */
2364
2408
  getBoneById(id) {
2365
2409
  for (let skeletonIndex = 0; skeletonIndex < this.skeletons.length; skeletonIndex++) {
@@ -2375,7 +2419,7 @@ export class Scene extends AbstractScene {
2375
2419
  /**
2376
2420
  * Gets a bone using its id
2377
2421
  * @param name defines the bone's name
2378
- * @return the bone or null if not found
2422
+ * @returns the bone or null if not found
2379
2423
  */
2380
2424
  getBoneByName(name) {
2381
2425
  for (let skeletonIndex = 0; skeletonIndex < this.skeletons.length; skeletonIndex++) {
@@ -2391,7 +2435,7 @@ export class Scene extends AbstractScene {
2391
2435
  /**
2392
2436
  * Gets a light node using its name
2393
2437
  * @param name defines the the light's name
2394
- * @return the light or null if none found.
2438
+ * @returns the light or null if none found.
2395
2439
  */
2396
2440
  getLightByName(name) {
2397
2441
  for (let index = 0; index < this.lights.length; index++) {
@@ -2404,7 +2448,7 @@ export class Scene extends AbstractScene {
2404
2448
  /**
2405
2449
  * Gets a light node using its Id
2406
2450
  * @param id defines the light's Id
2407
- * @return the light or null if none found.
2451
+ * @returns the light or null if none found.
2408
2452
  */
2409
2453
  getLightById(id) {
2410
2454
  for (let index = 0; index < this.lights.length; index++) {
@@ -2417,7 +2461,7 @@ export class Scene extends AbstractScene {
2417
2461
  /**
2418
2462
  * Gets a light node using its scene-generated unique Id
2419
2463
  * @param uniqueId defines the light's unique Id
2420
- * @return the light or null if none found.
2464
+ * @returns the light or null if none found.
2421
2465
  */
2422
2466
  getLightByUniqueId(uniqueId) {
2423
2467
  for (let index = 0; index < this.lights.length; index++) {
@@ -2430,7 +2474,7 @@ export class Scene extends AbstractScene {
2430
2474
  /**
2431
2475
  * Gets a particle system by Id
2432
2476
  * @param id defines the particle system Id
2433
- * @return the corresponding system or null if none found
2477
+ * @returns the corresponding system or null if none found
2434
2478
  */
2435
2479
  getParticleSystemById(id) {
2436
2480
  for (let index = 0; index < this.particleSystems.length; index++) {
@@ -2443,7 +2487,7 @@ export class Scene extends AbstractScene {
2443
2487
  /**
2444
2488
  * Gets a geometry using its Id
2445
2489
  * @param id defines the geometry's Id
2446
- * @return the geometry or null if none found.
2490
+ * @returns the geometry or null if none found.
2447
2491
  */
2448
2492
  getGeometryById(id) {
2449
2493
  for (let index = 0; index < this.geometries.length; index++) {
@@ -2473,7 +2517,7 @@ export class Scene extends AbstractScene {
2473
2517
  * Add a new geometry to this scene
2474
2518
  * @param geometry defines the geometry to be added to the scene.
2475
2519
  * @param force defines if the geometry must be pushed even if a geometry with this id already exists
2476
- * @return a boolean defining if the geometry was added or not
2520
+ * @returns a boolean defining if the geometry was added or not
2477
2521
  */
2478
2522
  pushGeometry(geometry, force) {
2479
2523
  if (!force && this._getGeometryByUniqueId(geometry.uniqueId)) {
@@ -2486,7 +2530,7 @@ export class Scene extends AbstractScene {
2486
2530
  /**
2487
2531
  * Removes an existing geometry
2488
2532
  * @param geometry defines the geometry to be removed from the scene
2489
- * @return a boolean defining if the geometry was removed or not
2533
+ * @returns a boolean defining if the geometry was removed or not
2490
2534
  */
2491
2535
  removeGeometry(geometry) {
2492
2536
  let index;
@@ -2528,7 +2572,7 @@ export class Scene extends AbstractScene {
2528
2572
  /**
2529
2573
  * Gets the first added mesh found of a given Id
2530
2574
  * @param id defines the Id to search for
2531
- * @return the mesh found or null if not found at all
2575
+ * @returns the mesh found or null if not found at all
2532
2576
  */
2533
2577
  getMeshById(id) {
2534
2578
  for (let index = 0; index < this.meshes.length; index++) {
@@ -2551,7 +2595,7 @@ export class Scene extends AbstractScene {
2551
2595
  /**
2552
2596
  * Gets the first added transform node found of a given Id
2553
2597
  * @param id defines the Id to search for
2554
- * @return the found transform node or null if not found at all.
2598
+ * @returns the found transform node or null if not found at all.
2555
2599
  */
2556
2600
  getTransformNodeById(id) {
2557
2601
  for (let index = 0; index < this.transformNodes.length; index++) {
@@ -2564,7 +2608,7 @@ export class Scene extends AbstractScene {
2564
2608
  /**
2565
2609
  * Gets a transform node with its auto-generated unique Id
2566
2610
  * @param uniqueId defines the unique Id to search for
2567
- * @return the found transform node or null if not found at all.
2611
+ * @returns the found transform node or null if not found at all.
2568
2612
  */
2569
2613
  getTransformNodeByUniqueId(uniqueId) {
2570
2614
  for (let index = 0; index < this.transformNodes.length; index++) {
@@ -2587,7 +2631,7 @@ export class Scene extends AbstractScene {
2587
2631
  /**
2588
2632
  * Gets a mesh with its auto-generated unique Id
2589
2633
  * @param uniqueId defines the unique Id to search for
2590
- * @return the found mesh or null if not found at all.
2634
+ * @returns the found mesh or null if not found at all.
2591
2635
  */
2592
2636
  getMeshByUniqueId(uniqueId) {
2593
2637
  for (let index = 0; index < this.meshes.length; index++) {
@@ -2600,7 +2644,7 @@ export class Scene extends AbstractScene {
2600
2644
  /**
2601
2645
  * Gets a the last added mesh using a given Id
2602
2646
  * @param id defines the Id to search for
2603
- * @return the found mesh or null if not found at all.
2647
+ * @returns the found mesh or null if not found at all.
2604
2648
  */
2605
2649
  getLastMeshById(id) {
2606
2650
  for (let index = this.meshes.length - 1; index >= 0; index--) {
@@ -2613,7 +2657,7 @@ export class Scene extends AbstractScene {
2613
2657
  /**
2614
2658
  * Gets a the last added node (Mesh, Camera, Light) using a given Id
2615
2659
  * @param id defines the Id to search for
2616
- * @return the found node or null if not found at all
2660
+ * @returns the found node or null if not found at all
2617
2661
  */
2618
2662
  getLastEntryById(id) {
2619
2663
  let index;
@@ -2642,7 +2686,7 @@ export class Scene extends AbstractScene {
2642
2686
  /**
2643
2687
  * Gets a node (Mesh, Camera, Light) using a given Id
2644
2688
  * @param id defines the Id to search for
2645
- * @return the found node or null if not found at all
2689
+ * @returns the found node or null if not found at all
2646
2690
  */
2647
2691
  getNodeById(id) {
2648
2692
  const mesh = this.getMeshById(id);
@@ -2670,7 +2714,7 @@ export class Scene extends AbstractScene {
2670
2714
  /**
2671
2715
  * Gets a node (Mesh, Camera, Light) using a given name
2672
2716
  * @param name defines the name to search for
2673
- * @return the found node or null if not found at all.
2717
+ * @returns the found node or null if not found at all.
2674
2718
  */
2675
2719
  getNodeByName(name) {
2676
2720
  const mesh = this.getMeshByName(name);
@@ -2698,7 +2742,7 @@ export class Scene extends AbstractScene {
2698
2742
  /**
2699
2743
  * Gets a mesh using a given name
2700
2744
  * @param name defines the name to search for
2701
- * @return the found mesh or null if not found at all.
2745
+ * @returns the found mesh or null if not found at all.
2702
2746
  */
2703
2747
  getMeshByName(name) {
2704
2748
  for (let index = 0; index < this.meshes.length; index++) {
@@ -2711,7 +2755,7 @@ export class Scene extends AbstractScene {
2711
2755
  /**
2712
2756
  * Gets a transform node using a given name
2713
2757
  * @param name defines the name to search for
2714
- * @return the found transform node or null if not found at all.
2758
+ * @returns the found transform node or null if not found at all.
2715
2759
  */
2716
2760
  getTransformNodeByName(name) {
2717
2761
  for (let index = 0; index < this.transformNodes.length; index++) {
@@ -2724,7 +2768,7 @@ export class Scene extends AbstractScene {
2724
2768
  /**
2725
2769
  * Gets a skeleton using a given Id (if many are found, this function will pick the last one)
2726
2770
  * @param id defines the Id to search for
2727
- * @return the found skeleton or null if not found at all.
2771
+ * @returns the found skeleton or null if not found at all.
2728
2772
  */
2729
2773
  getLastSkeletonById(id) {
2730
2774
  for (let index = this.skeletons.length - 1; index >= 0; index--) {
@@ -2737,7 +2781,7 @@ export class Scene extends AbstractScene {
2737
2781
  /**
2738
2782
  * Gets a skeleton using a given auto generated unique id
2739
2783
  * @param uniqueId defines the unique id to search for
2740
- * @return the found skeleton or null if not found at all.
2784
+ * @returns the found skeleton or null if not found at all.
2741
2785
  */
2742
2786
  getSkeletonByUniqueId(uniqueId) {
2743
2787
  for (let index = 0; index < this.skeletons.length; index++) {
@@ -2750,7 +2794,7 @@ export class Scene extends AbstractScene {
2750
2794
  /**
2751
2795
  * Gets a skeleton using a given id (if many are found, this function will pick the first one)
2752
2796
  * @param id defines the id to search for
2753
- * @return the found skeleton or null if not found at all.
2797
+ * @returns the found skeleton or null if not found at all.
2754
2798
  */
2755
2799
  getSkeletonById(id) {
2756
2800
  for (let index = 0; index < this.skeletons.length; index++) {
@@ -2763,7 +2807,7 @@ export class Scene extends AbstractScene {
2763
2807
  /**
2764
2808
  * Gets a skeleton using a given name
2765
2809
  * @param name defines the name to search for
2766
- * @return the found skeleton or null if not found at all.
2810
+ * @returns the found skeleton or null if not found at all.
2767
2811
  */
2768
2812
  getSkeletonByName(name) {
2769
2813
  for (let index = 0; index < this.skeletons.length; index++) {
@@ -2776,7 +2820,7 @@ export class Scene extends AbstractScene {
2776
2820
  /**
2777
2821
  * Gets a morph target manager using a given id (if many are found, this function will pick the last one)
2778
2822
  * @param id defines the id to search for
2779
- * @return the found morph target manager or null if not found at all.
2823
+ * @returns the found morph target manager or null if not found at all.
2780
2824
  */
2781
2825
  getMorphTargetManagerById(id) {
2782
2826
  for (let index = 0; index < this.morphTargetManagers.length; index++) {
@@ -2789,7 +2833,7 @@ export class Scene extends AbstractScene {
2789
2833
  /**
2790
2834
  * Gets a morph target using a given id (if many are found, this function will pick the first one)
2791
2835
  * @param id defines the id to search for
2792
- * @return the found morph target or null if not found at all.
2836
+ * @returns the found morph target or null if not found at all.
2793
2837
  */
2794
2838
  getMorphTargetById(id) {
2795
2839
  for (let managerIndex = 0; managerIndex < this.morphTargetManagers.length; ++managerIndex) {
@@ -2806,7 +2850,7 @@ export class Scene extends AbstractScene {
2806
2850
  /**
2807
2851
  * Gets a morph target using a given name (if many are found, this function will pick the first one)
2808
2852
  * @param name defines the name to search for
2809
- * @return the found morph target or null if not found at all.
2853
+ * @returns the found morph target or null if not found at all.
2810
2854
  */
2811
2855
  getMorphTargetByName(name) {
2812
2856
  for (let managerIndex = 0; managerIndex < this.morphTargetManagers.length; ++managerIndex) {
@@ -2823,7 +2867,7 @@ export class Scene extends AbstractScene {
2823
2867
  /**
2824
2868
  * Gets a post process using a given name (if many are found, this function will pick the first one)
2825
2869
  * @param name defines the name to search for
2826
- * @return the found post process or null if not found at all.
2870
+ * @returns the found post process or null if not found at all.
2827
2871
  */
2828
2872
  getPostProcessByName(name) {
2829
2873
  for (let postProcessIndex = 0; postProcessIndex < this.postProcesses.length; ++postProcessIndex) {
@@ -2857,7 +2901,7 @@ export class Scene extends AbstractScene {
2857
2901
  * If you don't care and just want to get the data no matter what, use the more convenient getOrAddExternalDataWithFactory() method.
2858
2902
  * @param key the unique key that identifies the data
2859
2903
  * @param data the data object to associate to the key for this Engine instance
2860
- * @return true if no such key were already present and the data was added successfully, false otherwise
2904
+ * @returns true if no such key were already present and the data was added successfully, false otherwise
2861
2905
  */
2862
2906
  addExternalData(key, data) {
2863
2907
  if (!this._externalData) {
@@ -2868,7 +2912,7 @@ export class Scene extends AbstractScene {
2868
2912
  /**
2869
2913
  * Get an externally attached data from its key
2870
2914
  * @param key the unique key that identifies the data
2871
- * @return the associated data, if present (can be null), or undefined if not present
2915
+ * @returns the associated data, if present (can be null), or undefined if not present
2872
2916
  */
2873
2917
  getExternalData(key) {
2874
2918
  if (!this._externalData) {
@@ -2880,7 +2924,7 @@ export class Scene extends AbstractScene {
2880
2924
  * Get an externally attached data from its key, create it using a factory if it's not already present
2881
2925
  * @param key the unique key that identifies the data
2882
2926
  * @param factory the factory that will be called to create the instance if and only if it doesn't exists
2883
- * @return the associated data, can be null if the factory returned null.
2927
+ * @returns the associated data, can be null if the factory returned null.
2884
2928
  */
2885
2929
  getOrAddExternalDataWithFactory(key, factory) {
2886
2930
  if (!this._externalData) {
@@ -2891,7 +2935,7 @@ export class Scene extends AbstractScene {
2891
2935
  /**
2892
2936
  * Remove an externally attached data from the Engine instance
2893
2937
  * @param key the unique key that identifies the data
2894
- * @return true if the data was successfully removed, false if it doesn't exist
2938
+ * @returns true if the data was successfully removed, false if it doesn't exist
2895
2939
  */
2896
2940
  removeExternalData(key) {
2897
2941
  return this._externalData.remove(key);
@@ -3718,6 +3762,7 @@ export class Scene extends AbstractScene {
3718
3762
  this.activeCamera._activeMeshes.dispose();
3719
3763
  this.activeCamera = null;
3720
3764
  }
3765
+ this.activeCameras = null;
3721
3766
  this._activeMeshes.dispose();
3722
3767
  this._renderingManager.dispose();
3723
3768
  this._processedMaterials.dispose();
@@ -3801,7 +3846,8 @@ export class Scene extends AbstractScene {
3801
3846
  this._disposeList(this.meshes, (item) => item.dispose(true));
3802
3847
  this._disposeList(this.transformNodes, (item) => item.dispose(true));
3803
3848
  // Release cameras
3804
- this._disposeList(this.cameras);
3849
+ const cameras = this.cameras;
3850
+ this._disposeList(cameras);
3805
3851
  // Release materials
3806
3852
  if (this._defaultMaterial) {
3807
3853
  this._defaultMaterial.dispose();