@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.
- package/Actions/abstractActionManager.d.ts +6 -6
- package/Actions/abstractActionManager.js +1 -1
- package/Actions/abstractActionManager.js.map +1 -1
- package/Actions/actionManager.d.ts +5 -5
- package/Actions/actionManager.js +5 -5
- package/Actions/actionManager.js.map +1 -1
- package/Animations/animatable.js +2 -1
- package/Animations/animatable.js.map +1 -1
- package/Animations/animation.js +137 -139
- package/Animations/animation.js.map +1 -1
- package/Animations/animationGroup.d.ts +3 -3
- package/Animations/animationGroup.js +3 -3
- package/Animations/animationGroup.js.map +1 -1
- package/Animations/runtimeAnimation.js +6 -7
- package/Animations/runtimeAnimation.js.map +1 -1
- package/Audio/audioSceneComponent.d.ts +1 -1
- package/Audio/audioSceneComponent.js.map +1 -1
- package/Audio/sound.d.ts +2 -1
- package/Audio/sound.js +21 -9
- package/Audio/sound.js.map +1 -1
- package/Behaviors/Cameras/autoRotationBehavior.d.ts +1 -1
- package/Behaviors/Cameras/autoRotationBehavior.js +1 -1
- package/Behaviors/Cameras/autoRotationBehavior.js.map +1 -1
- package/Behaviors/Cameras/bouncingBehavior.d.ts +1 -1
- package/Behaviors/Cameras/bouncingBehavior.js +1 -1
- package/Behaviors/Cameras/bouncingBehavior.js.map +1 -1
- package/Behaviors/Cameras/framingBehavior.d.ts +1 -1
- package/Behaviors/Cameras/framingBehavior.js +1 -1
- package/Behaviors/Cameras/framingBehavior.js.map +1 -1
- package/Bones/bone.d.ts +1 -1
- package/Bones/bone.js +1 -1
- package/Bones/bone.js.map +1 -1
- package/Bones/skeleton.d.ts +2 -2
- package/Bones/skeleton.js +11 -5
- package/Bones/skeleton.js.map +1 -1
- package/Cameras/Inputs/BaseCameraMouseWheelInput.js +3 -22
- package/Cameras/Inputs/BaseCameraMouseWheelInput.js.map +1 -1
- package/Cameras/Inputs/BaseCameraPointersInput.js +3 -3
- package/Cameras/Inputs/BaseCameraPointersInput.js.map +1 -1
- package/Cameras/Inputs/arcRotateCameraMouseWheelInput.js +1 -11
- package/Cameras/Inputs/arcRotateCameraMouseWheelInput.js.map +1 -1
- package/Cameras/Inputs/flyCameraMouseInput.js +3 -3
- package/Cameras/Inputs/flyCameraMouseInput.js.map +1 -1
- package/Cameras/Inputs/followCameraMouseWheelInput.js +1 -4
- package/Cameras/Inputs/followCameraMouseWheelInput.js.map +1 -1
- package/Cameras/Inputs/freeCameraMouseInput.js +3 -3
- package/Cameras/Inputs/freeCameraMouseInput.js.map +1 -1
- package/Cameras/arcRotateCamera.d.ts +1 -1
- package/Cameras/arcRotateCamera.js +1 -1
- package/Cameras/arcRotateCamera.js.map +1 -1
- package/Cameras/camera.d.ts +2 -2
- package/Cameras/camera.js +2 -2
- package/Cameras/camera.js.map +1 -1
- package/Cameras/freeCamera.d.ts +1 -1
- package/Cameras/freeCamera.js +1 -1
- package/Cameras/freeCamera.js.map +1 -1
- package/Cameras/gamepadCamera.d.ts +1 -1
- package/Cameras/gamepadCamera.js +1 -1
- package/Cameras/gamepadCamera.js.map +1 -1
- package/Cameras/targetCamera.d.ts +1 -1
- package/Cameras/targetCamera.js +1 -1
- package/Cameras/targetCamera.js.map +1 -1
- package/Cameras/touchCamera.d.ts +1 -1
- package/Cameras/touchCamera.js +1 -1
- package/Cameras/touchCamera.js.map +1 -1
- package/Cameras/universalCamera.d.ts +1 -1
- package/Cameras/universalCamera.js +1 -1
- package/Cameras/universalCamera.js.map +1 -1
- package/Cameras/virtualJoysticksCamera.d.ts +1 -1
- package/Cameras/virtualJoysticksCamera.js +1 -1
- package/Cameras/virtualJoysticksCamera.js.map +1 -1
- package/Culling/boundingBox.d.ts +2 -2
- package/Culling/boundingBox.js +2 -2
- package/Culling/boundingBox.js.map +1 -1
- package/Culling/ray.d.ts +1 -1
- package/Culling/ray.js +1 -1
- package/Culling/ray.js.map +1 -1
- package/Debug/debugLayer.d.ts +1 -1
- package/Debug/debugLayer.js +1 -1
- package/Debug/debugLayer.js.map +1 -1
- package/DeviceInput/webDeviceInputSystem.js +20 -2
- package/DeviceInput/webDeviceInputSystem.js.map +1 -1
- package/Engines/Extensions/engine.multiRender.js +8 -10
- package/Engines/Extensions/engine.multiRender.js.map +1 -1
- package/Engines/Extensions/engine.query.d.ts +2 -2
- package/Engines/Extensions/engine.query.js.map +1 -1
- package/Engines/ICanvas.d.ts +11 -0
- package/Engines/ICanvas.js.map +1 -1
- package/Engines/WebGL/webGLPipelineContext.d.ts +29 -19
- package/Engines/WebGL/webGLPipelineContext.js +99 -311
- package/Engines/WebGL/webGLPipelineContext.js.map +1 -1
- package/Engines/WebGL/webGLRenderTargetWrapper.js +1 -1
- package/Engines/WebGL/webGLRenderTargetWrapper.js.map +1 -1
- package/Engines/engine.d.ts +2 -2
- package/Engines/engine.js +2 -2
- package/Engines/engine.js.map +1 -1
- package/Engines/nativeEngine.d.ts +2 -2
- package/Engines/nativeEngine.js +2 -2
- package/Engines/nativeEngine.js.map +1 -1
- package/Engines/renderTargetWrapper.d.ts +1 -0
- package/Engines/renderTargetWrapper.js +5 -2
- package/Engines/renderTargetWrapper.js.map +1 -1
- package/Engines/thinEngine.d.ts +6 -5
- package/Engines/thinEngine.js +11 -7
- package/Engines/thinEngine.js.map +1 -1
- package/Engines/webgpuEngine.js +4 -1
- package/Engines/webgpuEngine.js.map +1 -1
- package/Events/clipboardEvents.d.ts +1 -1
- package/Events/clipboardEvents.js +1 -1
- package/Events/clipboardEvents.js.map +1 -1
- package/Events/deviceInputEvents.d.ts +11 -4
- package/Events/deviceInputEvents.js.map +1 -1
- package/Gamepads/Controllers/windowsMotionController.d.ts +1 -1
- package/Gamepads/Controllers/windowsMotionController.js +1 -1
- package/Gamepads/Controllers/windowsMotionController.js.map +1 -1
- package/Gizmos/boundingBoxGizmo.d.ts +4 -0
- package/Gizmos/boundingBoxGizmo.js +6 -0
- package/Gizmos/boundingBoxGizmo.js.map +1 -1
- package/Inputs/scene.inputManager.js +4 -4
- package/Inputs/scene.inputManager.js.map +1 -1
- package/Layers/effectLayer.d.ts +3 -3
- package/Layers/effectLayer.js +1 -1
- package/Layers/effectLayer.js.map +1 -1
- package/Layers/glowLayer.d.ts +3 -3
- package/Layers/glowLayer.js +2 -2
- package/Layers/glowLayer.js.map +1 -1
- package/Layers/highlightLayer.d.ts +3 -3
- package/Layers/highlightLayer.js +2 -2
- package/Layers/highlightLayer.js.map +1 -1
- package/Lights/directionalLight.d.ts +2 -2
- package/Lights/directionalLight.js +2 -2
- package/Lights/directionalLight.js.map +1 -1
- package/Lights/hemisphericLight.d.ts +3 -3
- package/Lights/hemisphericLight.js +3 -3
- package/Lights/hemisphericLight.js.map +1 -1
- package/Lights/light.d.ts +2 -2
- package/Lights/light.js +2 -2
- package/Lights/light.js.map +1 -1
- package/Lights/lightConstants.d.ts +1 -1
- package/Lights/lightConstants.js +1 -1
- package/Lights/lightConstants.js.map +1 -1
- package/Loading/Plugins/babylonFileLoader.js +3 -0
- package/Loading/Plugins/babylonFileLoader.js.map +1 -1
- package/Loading/sceneLoader.d.ts +1 -1
- package/Loading/sceneLoader.js.map +1 -1
- package/Materials/Background/backgroundMaterial.js +4 -0
- package/Materials/Background/backgroundMaterial.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js +4 -1
- package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js.map +1 -1
- package/Materials/Node/nodeMaterial.d.ts +1 -1
- package/Materials/Node/nodeMaterial.js +5 -1
- package/Materials/Node/nodeMaterial.js.map +1 -1
- package/Materials/PBR/pbrBaseMaterial.js +4 -1
- package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
- package/Materials/Textures/Filtering/hdrFiltering.d.ts +1 -1
- package/Materials/Textures/Filtering/hdrFiltering.js +1 -1
- package/Materials/Textures/Filtering/hdrFiltering.js.map +1 -1
- package/Materials/Textures/Procedurals/customProceduralTexture.d.ts +2 -1
- package/Materials/Textures/Procedurals/customProceduralTexture.js +9 -3
- package/Materials/Textures/Procedurals/customProceduralTexture.js.map +1 -1
- package/Materials/Textures/Procedurals/proceduralTexture.d.ts +9 -9
- package/Materials/Textures/Procedurals/proceduralTexture.js +9 -9
- package/Materials/Textures/Procedurals/proceduralTexture.js.map +1 -1
- package/Materials/Textures/colorGradingTexture.d.ts +1 -1
- package/Materials/Textures/colorGradingTexture.js +1 -1
- package/Materials/Textures/colorGradingTexture.js.map +1 -1
- package/Materials/Textures/cubeTexture.d.ts +2 -2
- package/Materials/Textures/cubeTexture.js +2 -2
- package/Materials/Textures/cubeTexture.js.map +1 -1
- package/Materials/Textures/rawCubeTexture.d.ts +1 -1
- package/Materials/Textures/rawCubeTexture.js +1 -1
- package/Materials/Textures/rawCubeTexture.js.map +1 -1
- package/Materials/Textures/renderTargetTexture.d.ts +3 -5
- package/Materials/Textures/renderTargetTexture.js +19 -19
- package/Materials/Textures/renderTargetTexture.js.map +1 -1
- package/Materials/colorCurves.d.ts +3 -3
- package/Materials/colorCurves.js +3 -3
- package/Materials/colorCurves.js.map +1 -1
- package/Materials/effect.d.ts +27 -27
- package/Materials/effect.js +22 -288
- package/Materials/effect.js.map +1 -1
- package/Materials/fresnelParameters.d.ts +1 -1
- package/Materials/fresnelParameters.js +1 -1
- package/Materials/fresnelParameters.js.map +1 -1
- package/Materials/imageProcessingConfiguration.d.ts +4 -4
- package/Materials/imageProcessingConfiguration.js +4 -4
- package/Materials/imageProcessingConfiguration.js.map +1 -1
- package/Materials/shaderMaterial.d.ts +25 -25
- package/Materials/shaderMaterial.js +25 -25
- package/Materials/shaderMaterial.js.map +1 -1
- package/Materials/standardMaterial.js +4 -1
- package/Materials/standardMaterial.js.map +1 -1
- package/Maths/index.d.ts +1 -0
- package/Maths/index.js +1 -0
- package/Maths/index.js.map +1 -1
- package/Maths/math.functions.d.ts +2 -2
- package/Maths/math.functions.js +2 -2
- package/Maths/math.functions.js.map +1 -1
- package/Maths/math.polar.d.ts +77 -0
- package/Maths/math.polar.js +114 -0
- package/Maths/math.polar.js.map +1 -0
- package/Maths/math.scalar.d.ts +2 -2
- package/Maths/math.scalar.js +2 -2
- package/Maths/math.scalar.js.map +1 -1
- package/Maths/math.vector.d.ts +13 -12
- package/Maths/math.vector.js +13 -12
- package/Maths/math.vector.js.map +1 -1
- package/Meshes/abstractMesh.d.ts +1 -1
- package/Meshes/abstractMesh.js +13 -2
- package/Meshes/abstractMesh.js.map +1 -1
- package/Meshes/geometry.d.ts +3 -3
- package/Meshes/geometry.js +3 -3
- package/Meshes/geometry.js.map +1 -1
- package/Meshes/groundMesh.d.ts +5 -4
- package/Meshes/groundMesh.js +5 -4
- package/Meshes/groundMesh.js.map +1 -1
- package/Meshes/instancedMesh.d.ts +1 -1
- package/Meshes/instancedMesh.js +1 -1
- package/Meshes/instancedMesh.js.map +1 -1
- package/Meshes/mesh.d.ts +3 -3
- package/Meshes/mesh.js +7 -3
- package/Meshes/mesh.js.map +1 -1
- package/Meshes/subMesh.d.ts +1 -1
- package/Meshes/subMesh.js +1 -1
- package/Meshes/subMesh.js.map +1 -1
- package/Meshes/thinInstanceMesh.d.ts +1 -1
- package/Meshes/thinInstanceMesh.js.map +1 -1
- package/Meshes/transformNode.js +6 -0
- package/Meshes/transformNode.js.map +1 -1
- package/Misc/HighDynamicRange/cubemapToSphericalPolynomial.d.ts +2 -2
- package/Misc/HighDynamicRange/cubemapToSphericalPolynomial.js +2 -2
- package/Misc/HighDynamicRange/cubemapToSphericalPolynomial.js.map +1 -1
- package/Misc/HighDynamicRange/hdr.d.ts +3 -3
- package/Misc/HighDynamicRange/hdr.js +3 -3
- package/Misc/HighDynamicRange/hdr.js.map +1 -1
- package/Misc/HighDynamicRange/panoramaToCubemap.d.ts +1 -1
- package/Misc/HighDynamicRange/panoramaToCubemap.js +1 -1
- package/Misc/HighDynamicRange/panoramaToCubemap.js.map +1 -1
- package/Misc/arrayTools.d.ts +13 -12
- package/Misc/arrayTools.js +70 -39
- package/Misc/arrayTools.js.map +1 -1
- package/Misc/assetsManager.d.ts +3 -3
- package/Misc/assetsManager.js +3 -3
- package/Misc/assetsManager.js.map +1 -1
- package/Misc/basis.js +17 -3
- package/Misc/basis.js.map +1 -1
- package/Misc/environmentTextureTools.d.ts +4 -4
- package/Misc/environmentTextureTools.js +5 -5
- package/Misc/environmentTextureTools.js.map +1 -1
- package/Misc/fileTools.d.ts +3 -3
- package/Misc/fileTools.js +19 -12
- package/Misc/fileTools.js.map +1 -1
- package/Misc/logger.js +1 -1
- package/Misc/logger.js.map +1 -1
- package/Misc/observable.d.ts +1 -1
- package/Misc/observable.js +1 -1
- package/Misc/observable.js.map +1 -1
- package/Misc/performanceMonitor.d.ts +3 -3
- package/Misc/performanceMonitor.js +3 -3
- package/Misc/performanceMonitor.js.map +1 -1
- package/Misc/rgbdTextureTools.d.ts +1 -1
- package/Misc/rgbdTextureTools.js +1 -1
- package/Misc/rgbdTextureTools.js.map +1 -1
- package/Misc/sceneOptimizer.d.ts +7 -7
- package/Misc/sceneOptimizer.js +7 -7
- package/Misc/sceneOptimizer.js.map +1 -1
- package/Misc/stringDictionary.d.ts +6 -6
- package/Misc/stringDictionary.js +6 -6
- package/Misc/stringDictionary.js.map +1 -1
- package/Misc/textureTools.d.ts +4 -4
- package/Misc/textureTools.js +4 -4
- package/Misc/textureTools.js.map +1 -1
- package/Misc/tools.d.ts +6 -6
- package/Misc/tools.js +6 -6
- package/Misc/tools.js.map +1 -1
- package/Misc/videoRecorder.d.ts +1 -1
- package/Misc/videoRecorder.js +1 -1
- package/Misc/videoRecorder.js.map +1 -1
- package/Offline/database.js +3 -3
- package/Offline/database.js.map +1 -1
- package/Particles/IParticleSystem.d.ts +1 -1
- package/Particles/IParticleSystem.js.map +1 -1
- package/Particles/gpuParticleSystem.d.ts +1 -1
- package/Particles/gpuParticleSystem.js +1 -1
- package/Particles/gpuParticleSystem.js.map +1 -1
- package/Particles/particleSystem.d.ts +1 -1
- package/Particles/particleSystem.js +1 -1
- package/Particles/particleSystem.js.map +1 -1
- package/Particles/solidParticleSystem.d.ts +4 -0
- package/Particles/solidParticleSystem.js +25 -3
- package/Particles/solidParticleSystem.js.map +1 -1
- package/Physics/Plugins/ammoJSPlugin.d.ts +1 -1
- package/Physics/Plugins/ammoJSPlugin.js +1 -1
- package/Physics/Plugins/ammoJSPlugin.js.map +1 -1
- package/Physics/Plugins/oimoJSPlugin.js +1 -1
- package/Physics/Plugins/oimoJSPlugin.js.map +1 -1
- package/Physics/physicsEngineComponent.d.ts +1 -1
- package/Physics/physicsEngineComponent.js +1 -1
- package/Physics/physicsEngineComponent.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js +3 -3
- package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js.map +1 -1
- package/PostProcesses/RenderPipeline/postProcessRenderPipeline.js +1 -2
- package/PostProcesses/RenderPipeline/postProcessRenderPipeline.js.map +1 -1
- package/PostProcesses/blurPostProcess.d.ts +3 -3
- package/PostProcesses/blurPostProcess.js +3 -3
- package/PostProcesses/blurPostProcess.js.map +1 -1
- package/PostProcesses/volumetricLightScatteringPostProcess.d.ts +3 -3
- package/PostProcesses/volumetricLightScatteringPostProcess.js +3 -3
- package/PostProcesses/volumetricLightScatteringPostProcess.js.map +1 -1
- package/Rendering/depthPeelingRenderer.d.ts +1 -0
- package/Rendering/depthPeelingRenderer.js +32 -5
- package/Rendering/depthPeelingRenderer.js.map +1 -1
- package/Rendering/edgesRenderer.d.ts +2 -2
- package/Rendering/edgesRenderer.js +1 -1
- package/Rendering/edgesRenderer.js.map +1 -1
- package/Rendering/geometryBufferRenderer.d.ts +4 -2
- package/Rendering/geometryBufferRenderer.js +5 -3
- package/Rendering/geometryBufferRenderer.js.map +1 -1
- package/Rendering/geometryBufferRendererSceneComponent.d.ts +2 -1
- package/Rendering/geometryBufferRendererSceneComponent.js +3 -2
- package/Rendering/geometryBufferRendererSceneComponent.js.map +1 -1
- package/Rendering/prePassRenderer.d.ts +11 -3
- package/Rendering/prePassRenderer.js +18 -3
- package/Rendering/prePassRenderer.js.map +1 -1
- package/Rendering/subSurfaceConfiguration.d.ts +2 -2
- package/Rendering/subSurfaceConfiguration.js +2 -2
- package/Rendering/subSurfaceConfiguration.js.map +1 -1
- package/Sprites/spriteSceneComponent.js +4 -1
- package/Sprites/spriteSceneComponent.js.map +1 -1
- package/XR/features/WebXRControllerTeleportation.d.ts +4 -0
- package/XR/features/WebXRControllerTeleportation.js +24 -19
- package/XR/features/WebXRControllerTeleportation.js.map +1 -1
- package/XR/motionController/webXRAbstractMotionController.d.ts +2 -2
- package/XR/motionController/webXRAbstractMotionController.js +2 -2
- package/XR/motionController/webXRAbstractMotionController.js.map +1 -1
- package/XR/motionController/webXRControllerComponent.d.ts +1 -1
- package/XR/motionController/webXRControllerComponent.js +1 -1
- package/XR/motionController/webXRControllerComponent.js.map +1 -1
- package/XR/motionController/webXRMotionControllerManager.d.ts +3 -3
- package/XR/motionController/webXRMotionControllerManager.js +3 -3
- package/XR/motionController/webXRMotionControllerManager.js.map +1 -1
- package/node.d.ts +4 -4
- package/node.js +3 -3
- package/node.js.map +1 -1
- package/package.json +1 -1
- package/readme.md +0 -4
- package/scene.d.ts +80 -63
- package/scene.js +92 -46
- package/scene.js.map +1 -1
- package/sceneComponent.d.ts +1 -1
- package/sceneComponent.js.map +1 -1
package/Misc/sceneOptimizer.d.ts
CHANGED
|
@@ -101,7 +101,7 @@ export declare class HardwareScalingOptimization extends SceneOptimization {
|
|
|
101
101
|
private _directionOffset;
|
|
102
102
|
/**
|
|
103
103
|
* Gets a string describing the action executed by the current optimization
|
|
104
|
-
* @
|
|
104
|
+
* @returns description string
|
|
105
105
|
*/
|
|
106
106
|
getDescription(): string;
|
|
107
107
|
/**
|
|
@@ -138,7 +138,7 @@ export declare class HardwareScalingOptimization extends SceneOptimization {
|
|
|
138
138
|
export declare class ShadowsOptimization extends SceneOptimization {
|
|
139
139
|
/**
|
|
140
140
|
* Gets a string describing the action executed by the current optimization
|
|
141
|
-
* @
|
|
141
|
+
* @returns description string
|
|
142
142
|
*/
|
|
143
143
|
getDescription(): string;
|
|
144
144
|
/**
|
|
@@ -156,7 +156,7 @@ export declare class ShadowsOptimization extends SceneOptimization {
|
|
|
156
156
|
export declare class PostProcessesOptimization extends SceneOptimization {
|
|
157
157
|
/**
|
|
158
158
|
* Gets a string describing the action executed by the current optimization
|
|
159
|
-
* @
|
|
159
|
+
* @returns description string
|
|
160
160
|
*/
|
|
161
161
|
getDescription(): string;
|
|
162
162
|
/**
|
|
@@ -174,7 +174,7 @@ export declare class PostProcessesOptimization extends SceneOptimization {
|
|
|
174
174
|
export declare class LensFlaresOptimization extends SceneOptimization {
|
|
175
175
|
/**
|
|
176
176
|
* Gets a string describing the action executed by the current optimization
|
|
177
|
-
* @
|
|
177
|
+
* @returns description string
|
|
178
178
|
*/
|
|
179
179
|
getDescription(): string;
|
|
180
180
|
/**
|
|
@@ -218,7 +218,7 @@ export declare class CustomOptimization extends SceneOptimization {
|
|
|
218
218
|
export declare class ParticlesOptimization extends SceneOptimization {
|
|
219
219
|
/**
|
|
220
220
|
* Gets a string describing the action executed by the current optimization
|
|
221
|
-
* @
|
|
221
|
+
* @returns description string
|
|
222
222
|
*/
|
|
223
223
|
getDescription(): string;
|
|
224
224
|
/**
|
|
@@ -236,7 +236,7 @@ export declare class ParticlesOptimization extends SceneOptimization {
|
|
|
236
236
|
export declare class RenderTargetsOptimization extends SceneOptimization {
|
|
237
237
|
/**
|
|
238
238
|
* Gets a string describing the action executed by the current optimization
|
|
239
|
-
* @
|
|
239
|
+
* @returns description string
|
|
240
240
|
*/
|
|
241
241
|
getDescription(): string;
|
|
242
242
|
/**
|
|
@@ -263,7 +263,7 @@ export declare class MergeMeshesOptimization extends SceneOptimization {
|
|
|
263
263
|
static set UpdateSelectionTree(value: boolean);
|
|
264
264
|
/**
|
|
265
265
|
* Gets a string describing the action executed by the current optimization
|
|
266
|
-
* @
|
|
266
|
+
* @returns description string
|
|
267
267
|
*/
|
|
268
268
|
getDescription(): string;
|
|
269
269
|
private _canBeMerged;
|
package/Misc/sceneOptimizer.js
CHANGED
|
@@ -126,7 +126,7 @@ export class HardwareScalingOptimization extends SceneOptimization {
|
|
|
126
126
|
}
|
|
127
127
|
/**
|
|
128
128
|
* Gets a string describing the action executed by the current optimization
|
|
129
|
-
* @
|
|
129
|
+
* @returns description string
|
|
130
130
|
*/
|
|
131
131
|
getDescription() {
|
|
132
132
|
return "Setting hardware scaling level to " + this._currentScale;
|
|
@@ -156,7 +156,7 @@ export class HardwareScalingOptimization extends SceneOptimization {
|
|
|
156
156
|
export class ShadowsOptimization extends SceneOptimization {
|
|
157
157
|
/**
|
|
158
158
|
* Gets a string describing the action executed by the current optimization
|
|
159
|
-
* @
|
|
159
|
+
* @returns description string
|
|
160
160
|
*/
|
|
161
161
|
getDescription() {
|
|
162
162
|
return "Turning shadows on/off";
|
|
@@ -179,7 +179,7 @@ export class ShadowsOptimization extends SceneOptimization {
|
|
|
179
179
|
export class PostProcessesOptimization extends SceneOptimization {
|
|
180
180
|
/**
|
|
181
181
|
* Gets a string describing the action executed by the current optimization
|
|
182
|
-
* @
|
|
182
|
+
* @returns description string
|
|
183
183
|
*/
|
|
184
184
|
getDescription() {
|
|
185
185
|
return "Turning post-processes on/off";
|
|
@@ -202,7 +202,7 @@ export class PostProcessesOptimization extends SceneOptimization {
|
|
|
202
202
|
export class LensFlaresOptimization extends SceneOptimization {
|
|
203
203
|
/**
|
|
204
204
|
* Gets a string describing the action executed by the current optimization
|
|
205
|
-
* @
|
|
205
|
+
* @returns description string
|
|
206
206
|
*/
|
|
207
207
|
getDescription() {
|
|
208
208
|
return "Turning lens flares on/off";
|
|
@@ -253,7 +253,7 @@ export class CustomOptimization extends SceneOptimization {
|
|
|
253
253
|
export class ParticlesOptimization extends SceneOptimization {
|
|
254
254
|
/**
|
|
255
255
|
* Gets a string describing the action executed by the current optimization
|
|
256
|
-
* @
|
|
256
|
+
* @returns description string
|
|
257
257
|
*/
|
|
258
258
|
getDescription() {
|
|
259
259
|
return "Turning particles on/off";
|
|
@@ -276,7 +276,7 @@ export class ParticlesOptimization extends SceneOptimization {
|
|
|
276
276
|
export class RenderTargetsOptimization extends SceneOptimization {
|
|
277
277
|
/**
|
|
278
278
|
* Gets a string describing the action executed by the current optimization
|
|
279
|
-
* @
|
|
279
|
+
* @returns description string
|
|
280
280
|
*/
|
|
281
281
|
getDescription() {
|
|
282
282
|
return "Turning render targets off";
|
|
@@ -333,7 +333,7 @@ export class MergeMeshesOptimization extends SceneOptimization {
|
|
|
333
333
|
}
|
|
334
334
|
/**
|
|
335
335
|
* Gets a string describing the action executed by the current optimization
|
|
336
|
-
* @
|
|
336
|
+
* @returns description string
|
|
337
337
|
*/
|
|
338
338
|
getDescription() {
|
|
339
339
|
return "Merging similar meshes together";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sceneOptimizer.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Misc/sceneOptimizer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErD,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAGtC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C;;;GAGG;AACH,MAAM,OAAO,iBAAiB;IAmB1B;;;OAGG;IACH;IACI;;OAEG;IACI,WAAmB,CAAC;QAApB,aAAQ,GAAR,QAAQ,CAAY;IAC5B,CAAC;IA3BJ;;;OAGG;IACI,cAAc;QACjB,OAAO,EAAE,CAAC;IACd,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,KAAY,EAAE,SAAyB;QAChD,OAAO,IAAI,CAAC;IAChB,CAAC;CAYJ;AAED;;;GAGG;AACH,MAAM,OAAO,mBAAoB,SAAQ,iBAAiB;IAStD;;;;;OAKG;IACH;IACI;;OAEG;IACI,WAAmB,CAAC;IAC3B;;OAEG;IACI,cAAsB,IAAI;IACjC;;OAEG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S,CAAC,mBAAmB,CAAC,GAAG,CAAC,GAAG,EAAE;gBACnC,SAAS,EAAE,CAAC;YAChB,CAAC,CAAC,CAAC;SACN;QAED,IAAI,SAAS,EAAE;YACX,SAAS,CAAC,mBAAmB,CAAC,GAAG,CAAC,GAAG,EAAE;gBACnC,SAAS,EAAE,CAAC;YAChB,CAAC,CAAC,CAAC;SACN;QAED,SAAS,CAAC,KAAK,EAAE,CAAC;QAElB,OAAO,SAAS,CAAC;IACrB,CAAC;CACJ","sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\r\nimport type { Scene, IDisposable } from \"../scene\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport { Mesh } from \"../Meshes/mesh\";\r\nimport type { Nullable } from \"../types\";\r\nimport type { Observer } from \"./observable\";\r\nimport { Observable } from \"./observable\";\r\n\r\n/**\r\n * Defines the root class used to create scene optimization to use with SceneOptimizer\r\n * @description More details at https://doc.babylonjs.com/how_to/how_to_use_sceneoptimizer\r\n */\r\nexport class SceneOptimization {\r\n /**\r\n * Gets a string describing the action executed by the current optimization\r\n * @returns description string\r\n */\r\n public getDescription(): string {\r\n return \"\";\r\n }\r\n\r\n /**\r\n * This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization\r\n * @param scene defines the current scene where to apply this optimization\r\n * @param optimizer defines the current optimizer\r\n * @returns true if everything that can be done was applied\r\n */\r\n public apply(scene: Scene, optimizer: SceneOptimizer): boolean {\r\n return true;\r\n }\r\n\r\n /**\r\n * Creates the SceneOptimization object\r\n * @param priority defines the priority of this optimization (0 by default which means first in the list)\r\n */\r\n constructor(\r\n /**\r\n * Defines the priority of this optimization (0 by default which means first in the list)\r\n */\r\n public priority: number = 0\r\n ) {}\r\n}\r\n\r\n/**\r\n * Defines an optimization used to reduce the size of render target textures\r\n * @description More details at https://doc.babylonjs.com/how_to/how_to_use_sceneoptimizer\r\n */\r\nexport class TextureOptimization extends SceneOptimization {\r\n /**\r\n * Gets a string describing the action executed by the current optimization\r\n * @returns description string\r\n */\r\n public getDescription(): string {\r\n return \"Reducing render target texture size to \" + this.maximumSize;\r\n }\r\n\r\n /**\r\n * Creates the TextureOptimization object\r\n * @param priority defines the priority of this optimization (0 by default which means first in the list)\r\n * @param maximumSize defines the maximum sized allowed for textures (1024 is the default value). If a texture is bigger, it will be scaled down using a factor defined by the step parameter\r\n * @param step defines the factor (0.5 by default) used to scale down textures bigger than maximum sized allowed.\r\n */\r\n constructor(\r\n /**\r\n * Defines the priority of this optimization (0 by default which means first in the list)\r\n */\r\n public priority: number = 0,\r\n /**\r\n * Defines the maximum sized allowed for textures (1024 is the default value). If a texture is bigger, it will be scaled down using a factor defined by the step parameter\r\n */\r\n public maximumSize: number = 1024,\r\n /**\r\n * Defines the factor (0.5 by default) used to scale down textures bigger than maximum sized allowed.\r\n */\r\n public step = 0.5\r\n ) {\r\n super(priority);\r\n }\r\n\r\n /**\r\n * This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization\r\n * @param scene defines the current scene where to apply this optimization\r\n * @param optimizer defines the current optimizer\r\n * @returns true if everything that can be done was applied\r\n */\r\n public apply(scene: Scene, optimizer: SceneOptimizer): boolean {\r\n let allDone = true;\r\n for (let index = 0; index < scene.textures.length; index++) {\r\n const texture = scene.textures[index];\r\n\r\n if (!texture.canRescale || (<any>texture).getContext) {\r\n continue;\r\n }\r\n\r\n const currentSize = texture.getSize();\r\n const maxDimension = Math.max(currentSize.width, currentSize.height);\r\n\r\n if (maxDimension > this.maximumSize) {\r\n texture.scale(this.step);\r\n allDone = false;\r\n }\r\n }\r\n\r\n return allDone;\r\n }\r\n}\r\n\r\n/**\r\n * Defines an optimization used to increase or decrease the rendering resolution\r\n * @description More details at https://doc.babylonjs.com/how_to/how_to_use_sceneoptimizer\r\n */\r\nexport class HardwareScalingOptimization extends SceneOptimization {\r\n private _currentScale = -1;\r\n private _directionOffset = 1;\r\n\r\n /**\r\n * Gets a string describing the action executed by the current optimization\r\n * @return description string\r\n */\r\n public getDescription(): string {\r\n return \"Setting hardware scaling level to \" + this._currentScale;\r\n }\r\n\r\n /**\r\n * Creates the HardwareScalingOptimization object\r\n * @param priority defines the priority of this optimization (0 by default which means first in the list)\r\n * @param maximumScale defines the maximum scale to use (2 by default)\r\n * @param step defines the step to use between two passes (0.5 by default)\r\n */\r\n constructor(\r\n /**\r\n * Defines the priority of this optimization (0 by default which means first in the list)\r\n */\r\n public priority: number = 0,\r\n /**\r\n * Defines the maximum scale to use (2 by default)\r\n */\r\n public maximumScale: number = 2,\r\n /**\r\n * Defines the step to use between two passes (0.5 by default)\r\n */\r\n public step: number = 0.25\r\n ) {\r\n super(priority);\r\n }\r\n\r\n /**\r\n * This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization\r\n * @param scene defines the current scene where to apply this optimization\r\n * @param optimizer defines the current optimizer\r\n * @returns true if everything that can be done was applied\r\n */\r\n public apply(scene: Scene, optimizer: SceneOptimizer): boolean {\r\n if (this._currentScale === -1) {\r\n this._currentScale = scene.getEngine().getHardwareScalingLevel();\r\n if (this._currentScale > this.maximumScale) {\r\n this._directionOffset = -1;\r\n }\r\n }\r\n\r\n this._currentScale += this._directionOffset * this.step;\r\n\r\n scene.getEngine().setHardwareScalingLevel(this._currentScale);\r\n\r\n return this._directionOffset === 1 ? this._currentScale >= this.maximumScale : this._currentScale <= this.maximumScale;\r\n }\r\n}\r\n\r\n/**\r\n * Defines an optimization used to remove shadows\r\n * @description More details at https://doc.babylonjs.com/how_to/how_to_use_sceneoptimizer\r\n */\r\nexport class ShadowsOptimization extends SceneOptimization {\r\n /**\r\n * Gets a string describing the action executed by the current optimization\r\n * @return description string\r\n */\r\n public getDescription(): string {\r\n return \"Turning shadows on/off\";\r\n }\r\n\r\n /**\r\n * This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization\r\n * @param scene defines the current scene where to apply this optimization\r\n * @param optimizer defines the current optimizer\r\n * @returns true if everything that can be done was applied\r\n */\r\n public apply(scene: Scene, optimizer: SceneOptimizer): boolean {\r\n scene.shadowsEnabled = optimizer.isInImprovementMode;\r\n return true;\r\n }\r\n}\r\n\r\n/**\r\n * Defines an optimization used to turn post-processes off\r\n * @description More details at https://doc.babylonjs.com/how_to/how_to_use_sceneoptimizer\r\n */\r\nexport class PostProcessesOptimization extends SceneOptimization {\r\n /**\r\n * Gets a string describing the action executed by the current optimization\r\n * @return description string\r\n */\r\n public getDescription(): string {\r\n return \"Turning post-processes on/off\";\r\n }\r\n\r\n /**\r\n * This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization\r\n * @param scene defines the current scene where to apply this optimization\r\n * @param optimizer defines the current optimizer\r\n * @returns true if everything that can be done was applied\r\n */\r\n public apply(scene: Scene, optimizer: SceneOptimizer): boolean {\r\n scene.postProcessesEnabled = optimizer.isInImprovementMode;\r\n return true;\r\n }\r\n}\r\n\r\n/**\r\n * Defines an optimization used to turn lens flares off\r\n * @description More details at https://doc.babylonjs.com/how_to/how_to_use_sceneoptimizer\r\n */\r\nexport class LensFlaresOptimization extends SceneOptimization {\r\n /**\r\n * Gets a string describing the action executed by the current optimization\r\n * @return description string\r\n */\r\n public getDescription(): string {\r\n return \"Turning lens flares on/off\";\r\n }\r\n\r\n /**\r\n * This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization\r\n * @param scene defines the current scene where to apply this optimization\r\n * @param optimizer defines the current optimizer\r\n * @returns true if everything that can be done was applied\r\n */\r\n public apply(scene: Scene, optimizer: SceneOptimizer): boolean {\r\n scene.lensFlaresEnabled = optimizer.isInImprovementMode;\r\n return true;\r\n }\r\n}\r\n\r\n/**\r\n * Defines an optimization based on user defined callback.\r\n * @description More details at https://doc.babylonjs.com/how_to/how_to_use_sceneoptimizer\r\n */\r\nexport class CustomOptimization extends SceneOptimization {\r\n /**\r\n * Callback called to apply the custom optimization.\r\n */\r\n public onApply: (scene: Scene, optimizer: SceneOptimizer) => boolean;\r\n\r\n /**\r\n * Callback called to get custom description\r\n */\r\n public onGetDescription: () => string;\r\n\r\n /**\r\n * Gets a string describing the action executed by the current optimization\r\n * @returns description string\r\n */\r\n public getDescription(): string {\r\n if (this.onGetDescription) {\r\n return this.onGetDescription();\r\n }\r\n\r\n return \"Running user defined callback\";\r\n }\r\n\r\n /**\r\n * This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization\r\n * @param scene defines the current scene where to apply this optimization\r\n * @param optimizer defines the current optimizer\r\n * @returns true if everything that can be done was applied\r\n */\r\n public apply(scene: Scene, optimizer: SceneOptimizer): boolean {\r\n if (this.onApply) {\r\n return this.onApply(scene, optimizer);\r\n }\r\n return true;\r\n }\r\n}\r\n\r\n/**\r\n * Defines an optimization used to turn particles off\r\n * @description More details at https://doc.babylonjs.com/how_to/how_to_use_sceneoptimizer\r\n */\r\nexport class ParticlesOptimization extends SceneOptimization {\r\n /**\r\n * Gets a string describing the action executed by the current optimization\r\n * @return description string\r\n */\r\n public getDescription(): string {\r\n return \"Turning particles on/off\";\r\n }\r\n\r\n /**\r\n * This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization\r\n * @param scene defines the current scene where to apply this optimization\r\n * @param optimizer defines the current optimizer\r\n * @returns true if everything that can be done was applied\r\n */\r\n public apply(scene: Scene, optimizer: SceneOptimizer): boolean {\r\n scene.particlesEnabled = optimizer.isInImprovementMode;\r\n return true;\r\n }\r\n}\r\n\r\n/**\r\n * Defines an optimization used to turn render targets off\r\n * @description More details at https://doc.babylonjs.com/how_to/how_to_use_sceneoptimizer\r\n */\r\nexport class RenderTargetsOptimization extends SceneOptimization {\r\n /**\r\n * Gets a string describing the action executed by the current optimization\r\n * @return description string\r\n */\r\n public getDescription(): string {\r\n return \"Turning render targets off\";\r\n }\r\n\r\n /**\r\n * This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization\r\n * @param scene defines the current scene where to apply this optimization\r\n * @param optimizer defines the current optimizer\r\n * @returns true if everything that can be done was applied\r\n */\r\n public apply(scene: Scene, optimizer: SceneOptimizer): boolean {\r\n scene.renderTargetsEnabled = optimizer.isInImprovementMode;\r\n return true;\r\n }\r\n}\r\n\r\n/**\r\n * Defines an optimization used to merge meshes with compatible materials\r\n * @description More details at https://doc.babylonjs.com/how_to/how_to_use_sceneoptimizer\r\n */\r\nexport class MergeMeshesOptimization extends SceneOptimization {\r\n private static _UpdateSelectionTree = false;\r\n\r\n /**\r\n * Gets or sets a boolean which defines if optimization octree has to be updated\r\n */\r\n public static get UpdateSelectionTree(): boolean {\r\n return MergeMeshesOptimization._UpdateSelectionTree;\r\n }\r\n\r\n /**\r\n * Gets or sets a boolean which defines if optimization octree has to be updated\r\n */\r\n public static set UpdateSelectionTree(value: boolean) {\r\n MergeMeshesOptimization._UpdateSelectionTree = value;\r\n }\r\n\r\n /**\r\n * Gets a string describing the action executed by the current optimization\r\n * @return description string\r\n */\r\n public getDescription(): string {\r\n return \"Merging similar meshes together\";\r\n }\r\n\r\n private _canBeMerged = (abstractMesh: AbstractMesh): boolean => {\r\n if (!(abstractMesh instanceof Mesh)) {\r\n return false;\r\n }\r\n\r\n const mesh = <Mesh>abstractMesh;\r\n\r\n if (mesh.isDisposed()) {\r\n return false;\r\n }\r\n\r\n if (!mesh.isVisible || !mesh.isEnabled()) {\r\n return false;\r\n }\r\n\r\n if (mesh.instances.length > 0) {\r\n return false;\r\n }\r\n\r\n if (mesh.skeleton || mesh.hasLODLevels) {\r\n return false;\r\n }\r\n\r\n return true;\r\n };\r\n\r\n /**\r\n * This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization\r\n * @param scene defines the current scene where to apply this optimization\r\n * @param optimizer defines the current optimizer\r\n * @param updateSelectionTree defines that the selection octree has to be updated (false by default)\r\n * @returns true if everything that can be done was applied\r\n */\r\n public apply(scene: Scene, optimizer: SceneOptimizer, updateSelectionTree?: boolean): boolean {\r\n const globalPool = scene.meshes.slice(0);\r\n let globalLength = globalPool.length;\r\n\r\n for (let index = 0; index < globalLength; index++) {\r\n const currentPool = new Array<Mesh>();\r\n const current = globalPool[index];\r\n\r\n // Checks\r\n if (!this._canBeMerged(current)) {\r\n continue;\r\n }\r\n\r\n currentPool.push(<Mesh>current);\r\n\r\n // Find compatible meshes\r\n for (let subIndex = index + 1; subIndex < globalLength; subIndex++) {\r\n const otherMesh = globalPool[subIndex];\r\n\r\n if (!this._canBeMerged(otherMesh)) {\r\n continue;\r\n }\r\n\r\n if (otherMesh.material !== current.material) {\r\n continue;\r\n }\r\n\r\n if (otherMesh.checkCollisions !== current.checkCollisions) {\r\n continue;\r\n }\r\n\r\n currentPool.push(<Mesh>otherMesh);\r\n globalLength--;\r\n\r\n globalPool.splice(subIndex, 1);\r\n\r\n subIndex--;\r\n }\r\n\r\n if (currentPool.length < 2) {\r\n continue;\r\n }\r\n\r\n // Merge meshes\r\n Mesh.MergeMeshes(currentPool, undefined, true);\r\n }\r\n\r\n // Call the octree system optimization if it is defined.\r\n const sceneAsAny = scene as any;\r\n if (sceneAsAny.createOrUpdateSelectionOctree) {\r\n if (updateSelectionTree != undefined) {\r\n if (updateSelectionTree) {\r\n sceneAsAny.createOrUpdateSelectionOctree();\r\n }\r\n } else if (MergeMeshesOptimization.UpdateSelectionTree) {\r\n sceneAsAny.createOrUpdateSelectionOctree();\r\n }\r\n }\r\n\r\n return true;\r\n }\r\n}\r\n\r\n/**\r\n * Defines a list of options used by SceneOptimizer\r\n * @description More details at https://doc.babylonjs.com/how_to/how_to_use_sceneoptimizer\r\n */\r\nexport class SceneOptimizerOptions {\r\n /**\r\n * Gets the list of optimizations to apply\r\n */\r\n public optimizations = new Array<SceneOptimization>();\r\n\r\n /**\r\n * Creates a new list of options used by SceneOptimizer\r\n * @param targetFrameRate defines the target frame rate to reach (60 by default)\r\n * @param trackerDuration defines the interval between two checks (2000ms by default)\r\n */\r\n constructor(\r\n /**\r\n * Defines the target frame rate to reach (60 by default)\r\n */\r\n public targetFrameRate: number = 60,\r\n /**\r\n * Defines the interval between two checks (2000ms by default)\r\n */\r\n public trackerDuration: number = 2000\r\n ) {}\r\n\r\n /**\r\n * Add a new optimization\r\n * @param optimization defines the SceneOptimization to add to the list of active optimizations\r\n * @returns the current SceneOptimizerOptions\r\n */\r\n public addOptimization(optimization: SceneOptimization): SceneOptimizerOptions {\r\n this.optimizations.push(optimization);\r\n return this;\r\n }\r\n\r\n /**\r\n * Add a new custom optimization\r\n * @param onApply defines the callback called to apply the custom optimization (true if everything that can be done was applied)\r\n * @param onGetDescription defines the callback called to get the description attached with the optimization.\r\n * @param priority defines the priority of this optimization (0 by default which means first in the list)\r\n * @returns the current SceneOptimizerOptions\r\n */\r\n public addCustomOptimization(onApply: (scene: Scene, optimizer: SceneOptimizer) => boolean, onGetDescription: () => string, priority: number = 0): SceneOptimizerOptions {\r\n const optimization = new CustomOptimization(priority);\r\n optimization.onApply = onApply;\r\n optimization.onGetDescription = onGetDescription;\r\n\r\n this.optimizations.push(optimization);\r\n return this;\r\n }\r\n\r\n /**\r\n * Creates a list of pre-defined optimizations aimed to reduce the visual impact on the scene\r\n * @param targetFrameRate defines the target frame rate (60 by default)\r\n * @returns a SceneOptimizerOptions object\r\n */\r\n public static LowDegradationAllowed(targetFrameRate?: number): SceneOptimizerOptions {\r\n const result = new SceneOptimizerOptions(targetFrameRate);\r\n\r\n let priority = 0;\r\n result.addOptimization(new MergeMeshesOptimization(priority));\r\n result.addOptimization(new ShadowsOptimization(priority));\r\n result.addOptimization(new LensFlaresOptimization(priority));\r\n\r\n // Next priority\r\n priority++;\r\n result.addOptimization(new PostProcessesOptimization(priority));\r\n result.addOptimization(new ParticlesOptimization(priority));\r\n\r\n // Next priority\r\n priority++;\r\n result.addOptimization(new TextureOptimization(priority, 1024));\r\n\r\n return result;\r\n }\r\n\r\n /**\r\n * Creates a list of pre-defined optimizations aimed to have a moderate impact on the scene visual\r\n * @param targetFrameRate defines the target frame rate (60 by default)\r\n * @returns a SceneOptimizerOptions object\r\n */\r\n public static ModerateDegradationAllowed(targetFrameRate?: number): SceneOptimizerOptions {\r\n const result = new SceneOptimizerOptions(targetFrameRate);\r\n\r\n let priority = 0;\r\n result.addOptimization(new MergeMeshesOptimization(priority));\r\n result.addOptimization(new ShadowsOptimization(priority));\r\n result.addOptimization(new LensFlaresOptimization(priority));\r\n\r\n // Next priority\r\n priority++;\r\n result.addOptimization(new PostProcessesOptimization(priority));\r\n result.addOptimization(new ParticlesOptimization(priority));\r\n\r\n // Next priority\r\n priority++;\r\n result.addOptimization(new TextureOptimization(priority, 512));\r\n\r\n // Next priority\r\n priority++;\r\n result.addOptimization(new RenderTargetsOptimization(priority));\r\n\r\n // Next priority\r\n priority++;\r\n result.addOptimization(new HardwareScalingOptimization(priority, 2));\r\n\r\n return result;\r\n }\r\n\r\n /**\r\n * Creates a list of pre-defined optimizations aimed to have a big impact on the scene visual\r\n * @param targetFrameRate defines the target frame rate (60 by default)\r\n * @returns a SceneOptimizerOptions object\r\n */\r\n public static HighDegradationAllowed(targetFrameRate?: number): SceneOptimizerOptions {\r\n const result = new SceneOptimizerOptions(targetFrameRate);\r\n\r\n let priority = 0;\r\n result.addOptimization(new MergeMeshesOptimization(priority));\r\n result.addOptimization(new ShadowsOptimization(priority));\r\n result.addOptimization(new LensFlaresOptimization(priority));\r\n\r\n // Next priority\r\n priority++;\r\n result.addOptimization(new PostProcessesOptimization(priority));\r\n result.addOptimization(new ParticlesOptimization(priority));\r\n\r\n // Next priority\r\n priority++;\r\n result.addOptimization(new TextureOptimization(priority, 256));\r\n\r\n // Next priority\r\n priority++;\r\n result.addOptimization(new RenderTargetsOptimization(priority));\r\n\r\n // Next priority\r\n priority++;\r\n result.addOptimization(new HardwareScalingOptimization(priority, 4));\r\n\r\n return result;\r\n }\r\n}\r\n\r\n/**\r\n * Class used to run optimizations in order to reach a target frame rate\r\n * @description More details at https://doc.babylonjs.com/how_to/how_to_use_sceneoptimizer\r\n */\r\nexport class SceneOptimizer implements IDisposable {\r\n private _isRunning = false;\r\n private _options: SceneOptimizerOptions;\r\n private _scene: Scene;\r\n private _currentPriorityLevel = 0;\r\n private _targetFrameRate = 60;\r\n private _trackerDuration = 2000;\r\n private _currentFrameRate = 0;\r\n private _sceneDisposeObserver: Nullable<Observer<Scene>>;\r\n private _improvementMode = false;\r\n\r\n /**\r\n * Defines an observable called when the optimizer reaches the target frame rate\r\n */\r\n public onSuccessObservable = new Observable<SceneOptimizer>();\r\n /**\r\n * Defines an observable called when the optimizer enables an optimization\r\n */\r\n public onNewOptimizationAppliedObservable = new Observable<SceneOptimization>();\r\n /**\r\n * Defines an observable called when the optimizer is not able to reach the target frame rate\r\n */\r\n public onFailureObservable = new Observable<SceneOptimizer>();\r\n\r\n /**\r\n * Gets or sets a boolean indicating if the optimizer is in improvement mode\r\n */\r\n public get isInImprovementMode(): boolean {\r\n return this._improvementMode;\r\n }\r\n\r\n public set isInImprovementMode(value: boolean) {\r\n this._improvementMode = value;\r\n }\r\n\r\n /**\r\n * Gets the current priority level (0 at start)\r\n */\r\n public get currentPriorityLevel(): number {\r\n return this._currentPriorityLevel;\r\n }\r\n\r\n /**\r\n * Gets the current frame rate checked by the SceneOptimizer\r\n */\r\n public get currentFrameRate(): number {\r\n return this._currentFrameRate;\r\n }\r\n\r\n /**\r\n * Gets or sets the current target frame rate (60 by default)\r\n */\r\n public get targetFrameRate(): number {\r\n return this._targetFrameRate;\r\n }\r\n\r\n /**\r\n * Gets or sets the current target frame rate (60 by default)\r\n */\r\n public set targetFrameRate(value: number) {\r\n this._targetFrameRate = value;\r\n }\r\n\r\n /**\r\n * Gets or sets the current interval between two checks (every 2000ms by default)\r\n */\r\n public get trackerDuration(): number {\r\n return this._trackerDuration;\r\n }\r\n\r\n /**\r\n * Gets or sets the current interval between two checks (every 2000ms by default)\r\n */\r\n public set trackerDuration(value: number) {\r\n this._trackerDuration = value;\r\n }\r\n\r\n /**\r\n * Gets the list of active optimizations\r\n */\r\n public get optimizations(): SceneOptimization[] {\r\n return this._options.optimizations;\r\n }\r\n\r\n /**\r\n * Creates a new SceneOptimizer\r\n * @param scene defines the scene to work on\r\n * @param options defines the options to use with the SceneOptimizer\r\n * @param autoGeneratePriorities defines if priorities must be generated and not read from SceneOptimization property (true by default)\r\n * @param improvementMode defines if the scene optimizer must run the maximum optimization while staying over a target frame instead of trying to reach the target framerate (false by default)\r\n */\r\n public constructor(scene: Scene, options?: SceneOptimizerOptions, autoGeneratePriorities = true, improvementMode = false) {\r\n if (!options) {\r\n this._options = new SceneOptimizerOptions();\r\n } else {\r\n this._options = options;\r\n }\r\n\r\n if (this._options.targetFrameRate) {\r\n this._targetFrameRate = this._options.targetFrameRate;\r\n }\r\n\r\n if (this._options.trackerDuration) {\r\n this._trackerDuration = this._options.trackerDuration;\r\n }\r\n\r\n if (autoGeneratePriorities) {\r\n let priority = 0;\r\n for (const optim of this._options.optimizations) {\r\n optim.priority = priority++;\r\n }\r\n }\r\n\r\n this._improvementMode = improvementMode;\r\n this._scene = scene || EngineStore.LastCreatedScene;\r\n this._sceneDisposeObserver = this._scene.onDisposeObservable.add(() => {\r\n this._sceneDisposeObserver = null;\r\n this.dispose();\r\n });\r\n }\r\n\r\n /**\r\n * Stops the current optimizer\r\n */\r\n public stop() {\r\n this._isRunning = false;\r\n }\r\n\r\n /**\r\n * Reset the optimizer to initial step (current priority level = 0)\r\n */\r\n public reset() {\r\n this._currentPriorityLevel = 0;\r\n }\r\n\r\n /**\r\n * Start the optimizer. By default it will try to reach a specific framerate\r\n * but if the optimizer is set with improvementMode === true then it will run all optimization while frame rate is above the target frame rate\r\n */\r\n public start() {\r\n if (this._isRunning) {\r\n return;\r\n }\r\n\r\n this._isRunning = true;\r\n\r\n // Let's wait for the scene to be ready before running our check\r\n this._scene.executeWhenReady(() => {\r\n setTimeout(() => {\r\n this._checkCurrentState();\r\n }, this._trackerDuration);\r\n });\r\n }\r\n\r\n private _checkCurrentState() {\r\n if (!this._isRunning) {\r\n return;\r\n }\r\n\r\n const scene = this._scene;\r\n const options = this._options;\r\n\r\n this._currentFrameRate = Math.round(scene.getEngine().getFps());\r\n\r\n if ((this._improvementMode && this._currentFrameRate <= this._targetFrameRate) || (!this._improvementMode && this._currentFrameRate >= this._targetFrameRate)) {\r\n this._isRunning = false;\r\n this.onSuccessObservable.notifyObservers(this);\r\n return;\r\n }\r\n\r\n // Apply current level of optimizations\r\n let allDone = true;\r\n let noOptimizationApplied = true;\r\n for (let index = 0; index < options.optimizations.length; index++) {\r\n const optimization = options.optimizations[index];\r\n\r\n if (optimization.priority === this._currentPriorityLevel) {\r\n noOptimizationApplied = false;\r\n allDone = allDone && optimization.apply(scene, this);\r\n this.onNewOptimizationAppliedObservable.notifyObservers(optimization);\r\n }\r\n }\r\n\r\n // If no optimization was applied, this is a failure :(\r\n if (noOptimizationApplied) {\r\n this._isRunning = false;\r\n this.onFailureObservable.notifyObservers(this);\r\n\r\n return;\r\n }\r\n\r\n // If all optimizations were done, move to next level\r\n if (allDone) {\r\n this._currentPriorityLevel++;\r\n }\r\n\r\n // Let's the system running for a specific amount of time before checking FPS\r\n scene.executeWhenReady(() => {\r\n setTimeout(() => {\r\n this._checkCurrentState();\r\n }, this._trackerDuration);\r\n });\r\n }\r\n\r\n /**\r\n * Release all resources\r\n */\r\n public dispose(): void {\r\n this.stop();\r\n this.onSuccessObservable.clear();\r\n this.onFailureObservable.clear();\r\n this.onNewOptimizationAppliedObservable.clear();\r\n if (this._sceneDisposeObserver) {\r\n this._scene.onDisposeObservable.remove(this._sceneDisposeObserver);\r\n }\r\n }\r\n\r\n /**\r\n * Helper function to create a SceneOptimizer with one single line of code\r\n * @param scene defines the scene to work on\r\n * @param options defines the options to use with the SceneOptimizer\r\n * @param onSuccess defines a callback to call on success\r\n * @param onFailure defines a callback to call on failure\r\n * @returns the new SceneOptimizer object\r\n */\r\n public static OptimizeAsync(scene: Scene, options?: SceneOptimizerOptions, onSuccess?: () => void, onFailure?: () => void): SceneOptimizer {\r\n const optimizer = new SceneOptimizer(scene, options || SceneOptimizerOptions.ModerateDegradationAllowed(), false);\r\n\r\n if (onSuccess) {\r\n optimizer.onSuccessObservable.add(() => {\r\n onSuccess();\r\n });\r\n }\r\n\r\n if (onFailure) {\r\n optimizer.onFailureObservable.add(() => {\r\n onFailure();\r\n });\r\n }\r\n\r\n optimizer.start();\r\n\r\n return optimizer;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"sceneOptimizer.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Misc/sceneOptimizer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErD,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAGtC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C;;;GAGG;AACH,MAAM,OAAO,iBAAiB;IAmB1B;;;OAGG;IACH;IACI;;OAEG;IACI,WAAmB,CAAC;QAApB,aAAQ,GAAR,QAAQ,CAAY;IAC5B,CAAC;IA3BJ;;;OAGG;IACI,cAAc;QACjB,OAAO,EAAE,CAAC;IACd,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,KAAY,EAAE,SAAyB;QAChD,OAAO,IAAI,CAAC;IAChB,CAAC;CAYJ;AAED;;;GAGG;AACH,MAAM,OAAO,mBAAoB,SAAQ,iBAAiB;IAStD;;;;;OAKG;IACH;IACI;;OAEG;IACI,WAAmB,CAAC;IAC3B;;OAEG;IACI,cAAsB,IAAI;IACjC;;OAEG;IACI,OAAO,GAAG;QAEjB,KAAK,CAAC,QAAQ,CAAC,CAAC;QAVT,aAAQ,GAAR,QAAQ,CAAY;QAIpB,gBAAW,GAAX,WAAW,CAAe;QAI1B,SAAI,GAAJ,IAAI,CAAM;IAGrB,CAAC;IA7BD;;;OAGG;IACI,cAAc;QACjB,OAAO,yCAAyC,GAAG,IAAI,CAAC,WAAW,CAAC;IACxE,CAAC;IAyBD;;;;;OAKG;IACI,KAAK,CAAC,KAAY,EA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AAC;CACJ","sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\r\nimport type { Scene, IDisposable } from \"../scene\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport { Mesh } from \"../Meshes/mesh\";\r\nimport type { Nullable } from \"../types\";\r\nimport type { Observer } from \"./observable\";\r\nimport { Observable } from \"./observable\";\r\n\r\n/**\r\n * Defines the root class used to create scene optimization to use with SceneOptimizer\r\n * @description More details at https://doc.babylonjs.com/how_to/how_to_use_sceneoptimizer\r\n */\r\nexport class SceneOptimization {\r\n /**\r\n * Gets a string describing the action executed by the current optimization\r\n * @returns description string\r\n */\r\n public getDescription(): string {\r\n return \"\";\r\n }\r\n\r\n /**\r\n * This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization\r\n * @param scene defines the current scene where to apply this optimization\r\n * @param optimizer defines the current optimizer\r\n * @returns true if everything that can be done was applied\r\n */\r\n public apply(scene: Scene, optimizer: SceneOptimizer): boolean {\r\n return true;\r\n }\r\n\r\n /**\r\n * Creates the SceneOptimization object\r\n * @param priority defines the priority of this optimization (0 by default which means first in the list)\r\n */\r\n constructor(\r\n /**\r\n * Defines the priority of this optimization (0 by default which means first in the list)\r\n */\r\n public priority: number = 0\r\n ) {}\r\n}\r\n\r\n/**\r\n * Defines an optimization used to reduce the size of render target textures\r\n * @description More details at https://doc.babylonjs.com/how_to/how_to_use_sceneoptimizer\r\n */\r\nexport class TextureOptimization extends SceneOptimization {\r\n /**\r\n * Gets a string describing the action executed by the current optimization\r\n * @returns description string\r\n */\r\n public getDescription(): string {\r\n return \"Reducing render target texture size to \" + this.maximumSize;\r\n }\r\n\r\n /**\r\n * Creates the TextureOptimization object\r\n * @param priority defines the priority of this optimization (0 by default which means first in the list)\r\n * @param maximumSize defines the maximum sized allowed for textures (1024 is the default value). If a texture is bigger, it will be scaled down using a factor defined by the step parameter\r\n * @param step defines the factor (0.5 by default) used to scale down textures bigger than maximum sized allowed.\r\n */\r\n constructor(\r\n /**\r\n * Defines the priority of this optimization (0 by default which means first in the list)\r\n */\r\n public priority: number = 0,\r\n /**\r\n * Defines the maximum sized allowed for textures (1024 is the default value). If a texture is bigger, it will be scaled down using a factor defined by the step parameter\r\n */\r\n public maximumSize: number = 1024,\r\n /**\r\n * Defines the factor (0.5 by default) used to scale down textures bigger than maximum sized allowed.\r\n */\r\n public step = 0.5\r\n ) {\r\n super(priority);\r\n }\r\n\r\n /**\r\n * This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization\r\n * @param scene defines the current scene where to apply this optimization\r\n * @param optimizer defines the current optimizer\r\n * @returns true if everything that can be done was applied\r\n */\r\n public apply(scene: Scene, optimizer: SceneOptimizer): boolean {\r\n let allDone = true;\r\n for (let index = 0; index < scene.textures.length; index++) {\r\n const texture = scene.textures[index];\r\n\r\n if (!texture.canRescale || (<any>texture).getContext) {\r\n continue;\r\n }\r\n\r\n const currentSize = texture.getSize();\r\n const maxDimension = Math.max(currentSize.width, currentSize.height);\r\n\r\n if (maxDimension > this.maximumSize) {\r\n texture.scale(this.step);\r\n allDone = false;\r\n }\r\n }\r\n\r\n return allDone;\r\n }\r\n}\r\n\r\n/**\r\n * Defines an optimization used to increase or decrease the rendering resolution\r\n * @description More details at https://doc.babylonjs.com/how_to/how_to_use_sceneoptimizer\r\n */\r\nexport class HardwareScalingOptimization extends SceneOptimization {\r\n private _currentScale = -1;\r\n private _directionOffset = 1;\r\n\r\n /**\r\n * Gets a string describing the action executed by the current optimization\r\n * @returns description string\r\n */\r\n public getDescription(): string {\r\n return \"Setting hardware scaling level to \" + this._currentScale;\r\n }\r\n\r\n /**\r\n * Creates the HardwareScalingOptimization object\r\n * @param priority defines the priority of this optimization (0 by default which means first in the list)\r\n * @param maximumScale defines the maximum scale to use (2 by default)\r\n * @param step defines the step to use between two passes (0.5 by default)\r\n */\r\n constructor(\r\n /**\r\n * Defines the priority of this optimization (0 by default which means first in the list)\r\n */\r\n public priority: number = 0,\r\n /**\r\n * Defines the maximum scale to use (2 by default)\r\n */\r\n public maximumScale: number = 2,\r\n /**\r\n * Defines the step to use between two passes (0.5 by default)\r\n */\r\n public step: number = 0.25\r\n ) {\r\n super(priority);\r\n }\r\n\r\n /**\r\n * This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization\r\n * @param scene defines the current scene where to apply this optimization\r\n * @param optimizer defines the current optimizer\r\n * @returns true if everything that can be done was applied\r\n */\r\n public apply(scene: Scene, optimizer: SceneOptimizer): boolean {\r\n if (this._currentScale === -1) {\r\n this._currentScale = scene.getEngine().getHardwareScalingLevel();\r\n if (this._currentScale > this.maximumScale) {\r\n this._directionOffset = -1;\r\n }\r\n }\r\n\r\n this._currentScale += this._directionOffset * this.step;\r\n\r\n scene.getEngine().setHardwareScalingLevel(this._currentScale);\r\n\r\n return this._directionOffset === 1 ? this._currentScale >= this.maximumScale : this._currentScale <= this.maximumScale;\r\n }\r\n}\r\n\r\n/**\r\n * Defines an optimization used to remove shadows\r\n * @description More details at https://doc.babylonjs.com/how_to/how_to_use_sceneoptimizer\r\n */\r\nexport class ShadowsOptimization extends SceneOptimization {\r\n /**\r\n * Gets a string describing the action executed by the current optimization\r\n * @returns description string\r\n */\r\n public getDescription(): string {\r\n return \"Turning shadows on/off\";\r\n }\r\n\r\n /**\r\n * This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization\r\n * @param scene defines the current scene where to apply this optimization\r\n * @param optimizer defines the current optimizer\r\n * @returns true if everything that can be done was applied\r\n */\r\n public apply(scene: Scene, optimizer: SceneOptimizer): boolean {\r\n scene.shadowsEnabled = optimizer.isInImprovementMode;\r\n return true;\r\n }\r\n}\r\n\r\n/**\r\n * Defines an optimization used to turn post-processes off\r\n * @description More details at https://doc.babylonjs.com/how_to/how_to_use_sceneoptimizer\r\n */\r\nexport class PostProcessesOptimization extends SceneOptimization {\r\n /**\r\n * Gets a string describing the action executed by the current optimization\r\n * @returns description string\r\n */\r\n public getDescription(): string {\r\n return \"Turning post-processes on/off\";\r\n }\r\n\r\n /**\r\n * This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization\r\n * @param scene defines the current scene where to apply this optimization\r\n * @param optimizer defines the current optimizer\r\n * @returns true if everything that can be done was applied\r\n */\r\n public apply(scene: Scene, optimizer: SceneOptimizer): boolean {\r\n scene.postProcessesEnabled = optimizer.isInImprovementMode;\r\n return true;\r\n }\r\n}\r\n\r\n/**\r\n * Defines an optimization used to turn lens flares off\r\n * @description More details at https://doc.babylonjs.com/how_to/how_to_use_sceneoptimizer\r\n */\r\nexport class LensFlaresOptimization extends SceneOptimization {\r\n /**\r\n * Gets a string describing the action executed by the current optimization\r\n * @returns description string\r\n */\r\n public getDescription(): string {\r\n return \"Turning lens flares on/off\";\r\n }\r\n\r\n /**\r\n * This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization\r\n * @param scene defines the current scene where to apply this optimization\r\n * @param optimizer defines the current optimizer\r\n * @returns true if everything that can be done was applied\r\n */\r\n public apply(scene: Scene, optimizer: SceneOptimizer): boolean {\r\n scene.lensFlaresEnabled = optimizer.isInImprovementMode;\r\n return true;\r\n }\r\n}\r\n\r\n/**\r\n * Defines an optimization based on user defined callback.\r\n * @description More details at https://doc.babylonjs.com/how_to/how_to_use_sceneoptimizer\r\n */\r\nexport class CustomOptimization extends SceneOptimization {\r\n /**\r\n * Callback called to apply the custom optimization.\r\n */\r\n public onApply: (scene: Scene, optimizer: SceneOptimizer) => boolean;\r\n\r\n /**\r\n * Callback called to get custom description\r\n */\r\n public onGetDescription: () => string;\r\n\r\n /**\r\n * Gets a string describing the action executed by the current optimization\r\n * @returns description string\r\n */\r\n public getDescription(): string {\r\n if (this.onGetDescription) {\r\n return this.onGetDescription();\r\n }\r\n\r\n return \"Running user defined callback\";\r\n }\r\n\r\n /**\r\n * This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization\r\n * @param scene defines the current scene where to apply this optimization\r\n * @param optimizer defines the current optimizer\r\n * @returns true if everything that can be done was applied\r\n */\r\n public apply(scene: Scene, optimizer: SceneOptimizer): boolean {\r\n if (this.onApply) {\r\n return this.onApply(scene, optimizer);\r\n }\r\n return true;\r\n }\r\n}\r\n\r\n/**\r\n * Defines an optimization used to turn particles off\r\n * @description More details at https://doc.babylonjs.com/how_to/how_to_use_sceneoptimizer\r\n */\r\nexport class ParticlesOptimization extends SceneOptimization {\r\n /**\r\n * Gets a string describing the action executed by the current optimization\r\n * @returns description string\r\n */\r\n public getDescription(): string {\r\n return \"Turning particles on/off\";\r\n }\r\n\r\n /**\r\n * This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization\r\n * @param scene defines the current scene where to apply this optimization\r\n * @param optimizer defines the current optimizer\r\n * @returns true if everything that can be done was applied\r\n */\r\n public apply(scene: Scene, optimizer: SceneOptimizer): boolean {\r\n scene.particlesEnabled = optimizer.isInImprovementMode;\r\n return true;\r\n }\r\n}\r\n\r\n/**\r\n * Defines an optimization used to turn render targets off\r\n * @description More details at https://doc.babylonjs.com/how_to/how_to_use_sceneoptimizer\r\n */\r\nexport class RenderTargetsOptimization extends SceneOptimization {\r\n /**\r\n * Gets a string describing the action executed by the current optimization\r\n * @returns description string\r\n */\r\n public getDescription(): string {\r\n return \"Turning render targets off\";\r\n }\r\n\r\n /**\r\n * This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization\r\n * @param scene defines the current scene where to apply this optimization\r\n * @param optimizer defines the current optimizer\r\n * @returns true if everything that can be done was applied\r\n */\r\n public apply(scene: Scene, optimizer: SceneOptimizer): boolean {\r\n scene.renderTargetsEnabled = optimizer.isInImprovementMode;\r\n return true;\r\n }\r\n}\r\n\r\n/**\r\n * Defines an optimization used to merge meshes with compatible materials\r\n * @description More details at https://doc.babylonjs.com/how_to/how_to_use_sceneoptimizer\r\n */\r\nexport class MergeMeshesOptimization extends SceneOptimization {\r\n private static _UpdateSelectionTree = false;\r\n\r\n /**\r\n * Gets or sets a boolean which defines if optimization octree has to be updated\r\n */\r\n public static get UpdateSelectionTree(): boolean {\r\n return MergeMeshesOptimization._UpdateSelectionTree;\r\n }\r\n\r\n /**\r\n * Gets or sets a boolean which defines if optimization octree has to be updated\r\n */\r\n public static set UpdateSelectionTree(value: boolean) {\r\n MergeMeshesOptimization._UpdateSelectionTree = value;\r\n }\r\n\r\n /**\r\n * Gets a string describing the action executed by the current optimization\r\n * @returns description string\r\n */\r\n public getDescription(): string {\r\n return \"Merging similar meshes together\";\r\n }\r\n\r\n private _canBeMerged = (abstractMesh: AbstractMesh): boolean => {\r\n if (!(abstractMesh instanceof Mesh)) {\r\n return false;\r\n }\r\n\r\n const mesh = <Mesh>abstractMesh;\r\n\r\n if (mesh.isDisposed()) {\r\n return false;\r\n }\r\n\r\n if (!mesh.isVisible || !mesh.isEnabled()) {\r\n return false;\r\n }\r\n\r\n if (mesh.instances.length > 0) {\r\n return false;\r\n }\r\n\r\n if (mesh.skeleton || mesh.hasLODLevels) {\r\n return false;\r\n }\r\n\r\n return true;\r\n };\r\n\r\n /**\r\n * This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization\r\n * @param scene defines the current scene where to apply this optimization\r\n * @param optimizer defines the current optimizer\r\n * @param updateSelectionTree defines that the selection octree has to be updated (false by default)\r\n * @returns true if everything that can be done was applied\r\n */\r\n public apply(scene: Scene, optimizer: SceneOptimizer, updateSelectionTree?: boolean): boolean {\r\n const globalPool = scene.meshes.slice(0);\r\n let globalLength = globalPool.length;\r\n\r\n for (let index = 0; index < globalLength; index++) {\r\n const currentPool = new Array<Mesh>();\r\n const current = globalPool[index];\r\n\r\n // Checks\r\n if (!this._canBeMerged(current)) {\r\n continue;\r\n }\r\n\r\n currentPool.push(<Mesh>current);\r\n\r\n // Find compatible meshes\r\n for (let subIndex = index + 1; subIndex < globalLength; subIndex++) {\r\n const otherMesh = globalPool[subIndex];\r\n\r\n if (!this._canBeMerged(otherMesh)) {\r\n continue;\r\n }\r\n\r\n if (otherMesh.material !== current.material) {\r\n continue;\r\n }\r\n\r\n if (otherMesh.checkCollisions !== current.checkCollisions) {\r\n continue;\r\n }\r\n\r\n currentPool.push(<Mesh>otherMesh);\r\n globalLength--;\r\n\r\n globalPool.splice(subIndex, 1);\r\n\r\n subIndex--;\r\n }\r\n\r\n if (currentPool.length < 2) {\r\n continue;\r\n }\r\n\r\n // Merge meshes\r\n Mesh.MergeMeshes(currentPool, undefined, true);\r\n }\r\n\r\n // Call the octree system optimization if it is defined.\r\n const sceneAsAny = scene as any;\r\n if (sceneAsAny.createOrUpdateSelectionOctree) {\r\n if (updateSelectionTree != undefined) {\r\n if (updateSelectionTree) {\r\n sceneAsAny.createOrUpdateSelectionOctree();\r\n }\r\n } else if (MergeMeshesOptimization.UpdateSelectionTree) {\r\n sceneAsAny.createOrUpdateSelectionOctree();\r\n }\r\n }\r\n\r\n return true;\r\n }\r\n}\r\n\r\n/**\r\n * Defines a list of options used by SceneOptimizer\r\n * @description More details at https://doc.babylonjs.com/how_to/how_to_use_sceneoptimizer\r\n */\r\nexport class SceneOptimizerOptions {\r\n /**\r\n * Gets the list of optimizations to apply\r\n */\r\n public optimizations = new Array<SceneOptimization>();\r\n\r\n /**\r\n * Creates a new list of options used by SceneOptimizer\r\n * @param targetFrameRate defines the target frame rate to reach (60 by default)\r\n * @param trackerDuration defines the interval between two checks (2000ms by default)\r\n */\r\n constructor(\r\n /**\r\n * Defines the target frame rate to reach (60 by default)\r\n */\r\n public targetFrameRate: number = 60,\r\n /**\r\n * Defines the interval between two checks (2000ms by default)\r\n */\r\n public trackerDuration: number = 2000\r\n ) {}\r\n\r\n /**\r\n * Add a new optimization\r\n * @param optimization defines the SceneOptimization to add to the list of active optimizations\r\n * @returns the current SceneOptimizerOptions\r\n */\r\n public addOptimization(optimization: SceneOptimization): SceneOptimizerOptions {\r\n this.optimizations.push(optimization);\r\n return this;\r\n }\r\n\r\n /**\r\n * Add a new custom optimization\r\n * @param onApply defines the callback called to apply the custom optimization (true if everything that can be done was applied)\r\n * @param onGetDescription defines the callback called to get the description attached with the optimization.\r\n * @param priority defines the priority of this optimization (0 by default which means first in the list)\r\n * @returns the current SceneOptimizerOptions\r\n */\r\n public addCustomOptimization(onApply: (scene: Scene, optimizer: SceneOptimizer) => boolean, onGetDescription: () => string, priority: number = 0): SceneOptimizerOptions {\r\n const optimization = new CustomOptimization(priority);\r\n optimization.onApply = onApply;\r\n optimization.onGetDescription = onGetDescription;\r\n\r\n this.optimizations.push(optimization);\r\n return this;\r\n }\r\n\r\n /**\r\n * Creates a list of pre-defined optimizations aimed to reduce the visual impact on the scene\r\n * @param targetFrameRate defines the target frame rate (60 by default)\r\n * @returns a SceneOptimizerOptions object\r\n */\r\n public static LowDegradationAllowed(targetFrameRate?: number): SceneOptimizerOptions {\r\n const result = new SceneOptimizerOptions(targetFrameRate);\r\n\r\n let priority = 0;\r\n result.addOptimization(new MergeMeshesOptimization(priority));\r\n result.addOptimization(new ShadowsOptimization(priority));\r\n result.addOptimization(new LensFlaresOptimization(priority));\r\n\r\n // Next priority\r\n priority++;\r\n result.addOptimization(new PostProcessesOptimization(priority));\r\n result.addOptimization(new ParticlesOptimization(priority));\r\n\r\n // Next priority\r\n priority++;\r\n result.addOptimization(new TextureOptimization(priority, 1024));\r\n\r\n return result;\r\n }\r\n\r\n /**\r\n * Creates a list of pre-defined optimizations aimed to have a moderate impact on the scene visual\r\n * @param targetFrameRate defines the target frame rate (60 by default)\r\n * @returns a SceneOptimizerOptions object\r\n */\r\n public static ModerateDegradationAllowed(targetFrameRate?: number): SceneOptimizerOptions {\r\n const result = new SceneOptimizerOptions(targetFrameRate);\r\n\r\n let priority = 0;\r\n result.addOptimization(new MergeMeshesOptimization(priority));\r\n result.addOptimization(new ShadowsOptimization(priority));\r\n result.addOptimization(new LensFlaresOptimization(priority));\r\n\r\n // Next priority\r\n priority++;\r\n result.addOptimization(new PostProcessesOptimization(priority));\r\n result.addOptimization(new ParticlesOptimization(priority));\r\n\r\n // Next priority\r\n priority++;\r\n result.addOptimization(new TextureOptimization(priority, 512));\r\n\r\n // Next priority\r\n priority++;\r\n result.addOptimization(new RenderTargetsOptimization(priority));\r\n\r\n // Next priority\r\n priority++;\r\n result.addOptimization(new HardwareScalingOptimization(priority, 2));\r\n\r\n return result;\r\n }\r\n\r\n /**\r\n * Creates a list of pre-defined optimizations aimed to have a big impact on the scene visual\r\n * @param targetFrameRate defines the target frame rate (60 by default)\r\n * @returns a SceneOptimizerOptions object\r\n */\r\n public static HighDegradationAllowed(targetFrameRate?: number): SceneOptimizerOptions {\r\n const result = new SceneOptimizerOptions(targetFrameRate);\r\n\r\n let priority = 0;\r\n result.addOptimization(new MergeMeshesOptimization(priority));\r\n result.addOptimization(new ShadowsOptimization(priority));\r\n result.addOptimization(new LensFlaresOptimization(priority));\r\n\r\n // Next priority\r\n priority++;\r\n result.addOptimization(new PostProcessesOptimization(priority));\r\n result.addOptimization(new ParticlesOptimization(priority));\r\n\r\n // Next priority\r\n priority++;\r\n result.addOptimization(new TextureOptimization(priority, 256));\r\n\r\n // Next priority\r\n priority++;\r\n result.addOptimization(new RenderTargetsOptimization(priority));\r\n\r\n // Next priority\r\n priority++;\r\n result.addOptimization(new HardwareScalingOptimization(priority, 4));\r\n\r\n return result;\r\n }\r\n}\r\n\r\n/**\r\n * Class used to run optimizations in order to reach a target frame rate\r\n * @description More details at https://doc.babylonjs.com/how_to/how_to_use_sceneoptimizer\r\n */\r\nexport class SceneOptimizer implements IDisposable {\r\n private _isRunning = false;\r\n private _options: SceneOptimizerOptions;\r\n private _scene: Scene;\r\n private _currentPriorityLevel = 0;\r\n private _targetFrameRate = 60;\r\n private _trackerDuration = 2000;\r\n private _currentFrameRate = 0;\r\n private _sceneDisposeObserver: Nullable<Observer<Scene>>;\r\n private _improvementMode = false;\r\n\r\n /**\r\n * Defines an observable called when the optimizer reaches the target frame rate\r\n */\r\n public onSuccessObservable = new Observable<SceneOptimizer>();\r\n /**\r\n * Defines an observable called when the optimizer enables an optimization\r\n */\r\n public onNewOptimizationAppliedObservable = new Observable<SceneOptimization>();\r\n /**\r\n * Defines an observable called when the optimizer is not able to reach the target frame rate\r\n */\r\n public onFailureObservable = new Observable<SceneOptimizer>();\r\n\r\n /**\r\n * Gets or sets a boolean indicating if the optimizer is in improvement mode\r\n */\r\n public get isInImprovementMode(): boolean {\r\n return this._improvementMode;\r\n }\r\n\r\n public set isInImprovementMode(value: boolean) {\r\n this._improvementMode = value;\r\n }\r\n\r\n /**\r\n * Gets the current priority level (0 at start)\r\n */\r\n public get currentPriorityLevel(): number {\r\n return this._currentPriorityLevel;\r\n }\r\n\r\n /**\r\n * Gets the current frame rate checked by the SceneOptimizer\r\n */\r\n public get currentFrameRate(): number {\r\n return this._currentFrameRate;\r\n }\r\n\r\n /**\r\n * Gets or sets the current target frame rate (60 by default)\r\n */\r\n public get targetFrameRate(): number {\r\n return this._targetFrameRate;\r\n }\r\n\r\n /**\r\n * Gets or sets the current target frame rate (60 by default)\r\n */\r\n public set targetFrameRate(value: number) {\r\n this._targetFrameRate = value;\r\n }\r\n\r\n /**\r\n * Gets or sets the current interval between two checks (every 2000ms by default)\r\n */\r\n public get trackerDuration(): number {\r\n return this._trackerDuration;\r\n }\r\n\r\n /**\r\n * Gets or sets the current interval between two checks (every 2000ms by default)\r\n */\r\n public set trackerDuration(value: number) {\r\n this._trackerDuration = value;\r\n }\r\n\r\n /**\r\n * Gets the list of active optimizations\r\n */\r\n public get optimizations(): SceneOptimization[] {\r\n return this._options.optimizations;\r\n }\r\n\r\n /**\r\n * Creates a new SceneOptimizer\r\n * @param scene defines the scene to work on\r\n * @param options defines the options to use with the SceneOptimizer\r\n * @param autoGeneratePriorities defines if priorities must be generated and not read from SceneOptimization property (true by default)\r\n * @param improvementMode defines if the scene optimizer must run the maximum optimization while staying over a target frame instead of trying to reach the target framerate (false by default)\r\n */\r\n public constructor(scene: Scene, options?: SceneOptimizerOptions, autoGeneratePriorities = true, improvementMode = false) {\r\n if (!options) {\r\n this._options = new SceneOptimizerOptions();\r\n } else {\r\n this._options = options;\r\n }\r\n\r\n if (this._options.targetFrameRate) {\r\n this._targetFrameRate = this._options.targetFrameRate;\r\n }\r\n\r\n if (this._options.trackerDuration) {\r\n this._trackerDuration = this._options.trackerDuration;\r\n }\r\n\r\n if (autoGeneratePriorities) {\r\n let priority = 0;\r\n for (const optim of this._options.optimizations) {\r\n optim.priority = priority++;\r\n }\r\n }\r\n\r\n this._improvementMode = improvementMode;\r\n this._scene = scene || EngineStore.LastCreatedScene;\r\n this._sceneDisposeObserver = this._scene.onDisposeObservable.add(() => {\r\n this._sceneDisposeObserver = null;\r\n this.dispose();\r\n });\r\n }\r\n\r\n /**\r\n * Stops the current optimizer\r\n */\r\n public stop() {\r\n this._isRunning = false;\r\n }\r\n\r\n /**\r\n * Reset the optimizer to initial step (current priority level = 0)\r\n */\r\n public reset() {\r\n this._currentPriorityLevel = 0;\r\n }\r\n\r\n /**\r\n * Start the optimizer. By default it will try to reach a specific framerate\r\n * but if the optimizer is set with improvementMode === true then it will run all optimization while frame rate is above the target frame rate\r\n */\r\n public start() {\r\n if (this._isRunning) {\r\n return;\r\n }\r\n\r\n this._isRunning = true;\r\n\r\n // Let's wait for the scene to be ready before running our check\r\n this._scene.executeWhenReady(() => {\r\n setTimeout(() => {\r\n this._checkCurrentState();\r\n }, this._trackerDuration);\r\n });\r\n }\r\n\r\n private _checkCurrentState() {\r\n if (!this._isRunning) {\r\n return;\r\n }\r\n\r\n const scene = this._scene;\r\n const options = this._options;\r\n\r\n this._currentFrameRate = Math.round(scene.getEngine().getFps());\r\n\r\n if ((this._improvementMode && this._currentFrameRate <= this._targetFrameRate) || (!this._improvementMode && this._currentFrameRate >= this._targetFrameRate)) {\r\n this._isRunning = false;\r\n this.onSuccessObservable.notifyObservers(this);\r\n return;\r\n }\r\n\r\n // Apply current level of optimizations\r\n let allDone = true;\r\n let noOptimizationApplied = true;\r\n for (let index = 0; index < options.optimizations.length; index++) {\r\n const optimization = options.optimizations[index];\r\n\r\n if (optimization.priority === this._currentPriorityLevel) {\r\n noOptimizationApplied = false;\r\n allDone = allDone && optimization.apply(scene, this);\r\n this.onNewOptimizationAppliedObservable.notifyObservers(optimization);\r\n }\r\n }\r\n\r\n // If no optimization was applied, this is a failure :(\r\n if (noOptimizationApplied) {\r\n this._isRunning = false;\r\n this.onFailureObservable.notifyObservers(this);\r\n\r\n return;\r\n }\r\n\r\n // If all optimizations were done, move to next level\r\n if (allDone) {\r\n this._currentPriorityLevel++;\r\n }\r\n\r\n // Let's the system running for a specific amount of time before checking FPS\r\n scene.executeWhenReady(() => {\r\n setTimeout(() => {\r\n this._checkCurrentState();\r\n }, this._trackerDuration);\r\n });\r\n }\r\n\r\n /**\r\n * Release all resources\r\n */\r\n public dispose(): void {\r\n this.stop();\r\n this.onSuccessObservable.clear();\r\n this.onFailureObservable.clear();\r\n this.onNewOptimizationAppliedObservable.clear();\r\n if (this._sceneDisposeObserver) {\r\n this._scene.onDisposeObservable.remove(this._sceneDisposeObserver);\r\n }\r\n }\r\n\r\n /**\r\n * Helper function to create a SceneOptimizer with one single line of code\r\n * @param scene defines the scene to work on\r\n * @param options defines the options to use with the SceneOptimizer\r\n * @param onSuccess defines a callback to call on success\r\n * @param onFailure defines a callback to call on failure\r\n * @returns the new SceneOptimizer object\r\n */\r\n public static OptimizeAsync(scene: Scene, options?: SceneOptimizerOptions, onSuccess?: () => void, onFailure?: () => void): SceneOptimizer {\r\n const optimizer = new SceneOptimizer(scene, options || SceneOptimizerOptions.ModerateDegradationAllowed(), false);\r\n\r\n if (onSuccess) {\r\n optimizer.onSuccessObservable.add(() => {\r\n onSuccess();\r\n });\r\n }\r\n\r\n if (onFailure) {\r\n optimizer.onFailureObservable.add(() => {\r\n onFailure();\r\n });\r\n }\r\n\r\n optimizer.start();\r\n\r\n return optimizer;\r\n }\r\n}\r\n"]}
|
|
@@ -14,7 +14,7 @@ export declare class StringDictionary<T> {
|
|
|
14
14
|
/**
|
|
15
15
|
* Get a value based from its key
|
|
16
16
|
* @param key the given key to get the matching value from
|
|
17
|
-
* @
|
|
17
|
+
* @returns the value if found, otherwise undefined is returned
|
|
18
18
|
*/
|
|
19
19
|
get(key: string): T | undefined;
|
|
20
20
|
/**
|
|
@@ -23,27 +23,27 @@ export declare class StringDictionary<T> {
|
|
|
23
23
|
* @param key the given key to get the matching value from
|
|
24
24
|
* @param factory the factory that will create the value if the key is not present in the dictionary.
|
|
25
25
|
* The factory will only be invoked if there's no data for the given key.
|
|
26
|
-
* @
|
|
26
|
+
* @returns the value corresponding to the key.
|
|
27
27
|
*/
|
|
28
28
|
getOrAddWithFactory(key: string, factory: (key: string) => T): T;
|
|
29
29
|
/**
|
|
30
30
|
* Get a value from its key if present in the dictionary otherwise add it
|
|
31
31
|
* @param key the key to get the value from
|
|
32
32
|
* @param val if there's no such key/value pair in the dictionary add it with this value
|
|
33
|
-
* @
|
|
33
|
+
* @returns the value corresponding to the key
|
|
34
34
|
*/
|
|
35
35
|
getOrAdd(key: string, val: T): T;
|
|
36
36
|
/**
|
|
37
37
|
* Check if there's a given key in the dictionary
|
|
38
38
|
* @param key the key to check for
|
|
39
|
-
* @
|
|
39
|
+
* @returns true if the key is present, false otherwise
|
|
40
40
|
*/
|
|
41
41
|
contains(key: string): boolean;
|
|
42
42
|
/**
|
|
43
43
|
* Add a new key and its corresponding value
|
|
44
44
|
* @param key the key to add
|
|
45
45
|
* @param value the value corresponding to the key
|
|
46
|
-
* @
|
|
46
|
+
* @returns true if the operation completed successfully, false if we couldn't insert the key/value because there was already this key in the dictionary
|
|
47
47
|
*/
|
|
48
48
|
add(key: string, value: T): boolean;
|
|
49
49
|
/**
|
|
@@ -62,7 +62,7 @@ export declare class StringDictionary<T> {
|
|
|
62
62
|
/**
|
|
63
63
|
* Remove a key/value from the dictionary.
|
|
64
64
|
* @param key the key to remove
|
|
65
|
-
* @
|
|
65
|
+
* @returns true if the item was successfully deleted, false if no item with such key exist in the dictionary
|
|
66
66
|
*/
|
|
67
67
|
remove(key: string): boolean;
|
|
68
68
|
/**
|
package/Misc/stringDictionary.js
CHANGED
|
@@ -20,7 +20,7 @@ export class StringDictionary {
|
|
|
20
20
|
/**
|
|
21
21
|
* Get a value based from its key
|
|
22
22
|
* @param key the given key to get the matching value from
|
|
23
|
-
* @
|
|
23
|
+
* @returns the value if found, otherwise undefined is returned
|
|
24
24
|
*/
|
|
25
25
|
get(key) {
|
|
26
26
|
const val = this._data[key];
|
|
@@ -35,7 +35,7 @@ export class StringDictionary {
|
|
|
35
35
|
* @param key the given key to get the matching value from
|
|
36
36
|
* @param factory the factory that will create the value if the key is not present in the dictionary.
|
|
37
37
|
* The factory will only be invoked if there's no data for the given key.
|
|
38
|
-
* @
|
|
38
|
+
* @returns the value corresponding to the key.
|
|
39
39
|
*/
|
|
40
40
|
getOrAddWithFactory(key, factory) {
|
|
41
41
|
let val = this.get(key);
|
|
@@ -52,7 +52,7 @@ export class StringDictionary {
|
|
|
52
52
|
* Get a value from its key if present in the dictionary otherwise add it
|
|
53
53
|
* @param key the key to get the value from
|
|
54
54
|
* @param val if there's no such key/value pair in the dictionary add it with this value
|
|
55
|
-
* @
|
|
55
|
+
* @returns the value corresponding to the key
|
|
56
56
|
*/
|
|
57
57
|
getOrAdd(key, val) {
|
|
58
58
|
const curVal = this.get(key);
|
|
@@ -65,7 +65,7 @@ export class StringDictionary {
|
|
|
65
65
|
/**
|
|
66
66
|
* Check if there's a given key in the dictionary
|
|
67
67
|
* @param key the key to check for
|
|
68
|
-
* @
|
|
68
|
+
* @returns true if the key is present, false otherwise
|
|
69
69
|
*/
|
|
70
70
|
contains(key) {
|
|
71
71
|
return this._data[key] !== undefined;
|
|
@@ -74,7 +74,7 @@ export class StringDictionary {
|
|
|
74
74
|
* Add a new key and its corresponding value
|
|
75
75
|
* @param key the key to add
|
|
76
76
|
* @param value the value corresponding to the key
|
|
77
|
-
* @
|
|
77
|
+
* @returns true if the operation completed successfully, false if we couldn't insert the key/value because there was already this key in the dictionary
|
|
78
78
|
*/
|
|
79
79
|
add(key, value) {
|
|
80
80
|
if (this._data[key] !== undefined) {
|
|
@@ -114,7 +114,7 @@ export class StringDictionary {
|
|
|
114
114
|
/**
|
|
115
115
|
* Remove a key/value from the dictionary.
|
|
116
116
|
* @param key the key to remove
|
|
117
|
-
* @
|
|
117
|
+
* @returns true if the item was successfully deleted, false if no item with such key exist in the dictionary
|
|
118
118
|
*/
|
|
119
119
|
remove(key) {
|
|
120
120
|
if (this.contains(key)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stringDictionary.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Misc/stringDictionary.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,OAAO,gBAAgB;IAA7B;QA8KY,WAAM,GAAG,CAAC,CAAC;QACX,UAAK,GAAyB,EAAE,CAAC;IAC7C,CAAC;IA/KG;;;;OAIG;IACI,QAAQ,CAAC,MAA2B;QACvC,IAAI,CAAC,KAAK,EAAE,CAAC;QACb,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAC7C,CAAC;IAED;;;;OAIG;IACI,GAAG,CAAC,GAAW;QAClB,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC5B,IAAI,GAAG,KAAK,SAAS,EAAE;YACnB,OAAO,GAAG,CAAC;SACd;QACD,OAAO,SAAS,CAAC;IACrB,CAAC;IAED;;;;;;;OAOG;IACI,mBAAmB,CAAC,GAAW,EAAE,OAA2B;QAC/D,IAAI,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACxB,IAAI,GAAG,KAAK,SAAS,EAAE;YACnB,OAAO,GAAG,CAAC;SACd;QAED,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;QACn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CAAC;YACvB,EAAE,IAAI,CAAC,MAAM,CAAC;YACd,OAAO,GAAG,CAAC;SACd;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,GAAW;QACrB,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;YACpB,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACvB,EAAE,IAAI,CAAC,MAAM,CAAC;YACd,OAAO,IAAI,CAAC;SACf;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;IAED;;OAEG;IACI,KAAK;QACR,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;QAChB,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;IACpB,CAAC;IAED;;OAEG;IACH,IAAW,KAAK;QACZ,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IAED;;;;OAIG;IACI,OAAO,CAAC,QAAuC;QAClD,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,KAAK,EAAE;YAC1B,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAC5B,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;SACtB;IACL,CAAC;IAED;;;;;;OAMG;IACI,KAAK,CAAO,QAAuC;QACtD,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,KAAK,EAAE;YAC1B,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAC5B,MAAM,GAAG,GAAG,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;YAC/B,IAAI,GAAG,EAAE;gBACL,OAAO,GAAG,CAAC;aACd;SACJ;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;CAIJ","sourcesContent":["import type { Nullable } from \"../types\";\r\n\r\n/**\r\n * This class implement a typical dictionary using a string as key and the generic type T as value.\r\n * The underlying implementation relies on an associative array to ensure the best performances.\r\n * The value can be anything including 'null' but except 'undefined'\r\n */\r\nexport class StringDictionary<T> {\r\n /**\r\n * This will clear this dictionary and copy the content from the 'source' one.\r\n * If the T value is a custom object, it won't be copied/cloned, the same object will be used\r\n * @param source the dictionary to take the content from and copy to this dictionary\r\n */\r\n public copyFrom(source: StringDictionary<T>) {\r\n this.clear();\r\n source.forEach((t, v) => this.add(t, v));\r\n }\r\n\r\n /**\r\n * Get a value based from its key\r\n * @param key the given key to get the matching value from\r\n * @
|
|
1
|
+
{"version":3,"file":"stringDictionary.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Misc/stringDictionary.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,OAAO,gBAAgB;IAA7B;QA8KY,WAAM,GAAG,CAAC,CAAC;QACX,UAAK,GAAyB,EAAE,CAAC;IAC7C,CAAC;IA/KG;;;;OAIG;IACI,QAAQ,CAAC,MAA2B;QACvC,IAAI,CAAC,KAAK,EAAE,CAAC;QACb,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAC7C,CAAC;IAED;;;;OAIG;IACI,GAAG,CAAC,GAAW;QAClB,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC5B,IAAI,GAAG,KAAK,SAAS,EAAE;YACnB,OAAO,GAAG,CAAC;SACd;QACD,OAAO,SAAS,CAAC;IACrB,CAAC;IAED;;;;;;;OAOG;IACI,mBAAmB,CAAC,GAAW,EAAE,OAA2B;QAC/D,IAAI,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACxB,IAAI,GAAG,KAAK,SAAS,EAAE;YACnB,OAAO,GAAG,CAAC;SACd;QAED,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;QACnB,IAAI,GAAG,EAAE;YACL,IAAI,CAAC,GAAG,CAAC,GAAG,EAA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CAAC;SACd;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,GAAW;QACrB,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;YACpB,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACvB,EAAE,IAAI,CAAC,MAAM,CAAC;YACd,OAAO,IAAI,CAAC;SACf;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;IAED;;OAEG;IACI,KAAK;QACR,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;QAChB,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;IACpB,CAAC;IAED;;OAEG;IACH,IAAW,KAAK;QACZ,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IAED;;;;OAIG;IACI,OAAO,CAAC,QAAuC;QAClD,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,KAAK,EAAE;YAC1B,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAC5B,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;SACtB;IACL,CAAC;IAED;;;;;;OAMG;IACI,KAAK,CAAO,QAAuC;QACtD,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,KAAK,EAAE;YAC1B,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAC5B,MAAM,GAAG,GAAG,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;YAC/B,IAAI,GAAG,EAAE;gBACL,OAAO,GAAG,CAAC;aACd;SACJ;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;CAIJ","sourcesContent":["import type { Nullable } from \"../types\";\r\n\r\n/**\r\n * This class implement a typical dictionary using a string as key and the generic type T as value.\r\n * The underlying implementation relies on an associative array to ensure the best performances.\r\n * The value can be anything including 'null' but except 'undefined'\r\n */\r\nexport class StringDictionary<T> {\r\n /**\r\n * This will clear this dictionary and copy the content from the 'source' one.\r\n * If the T value is a custom object, it won't be copied/cloned, the same object will be used\r\n * @param source the dictionary to take the content from and copy to this dictionary\r\n */\r\n public copyFrom(source: StringDictionary<T>) {\r\n this.clear();\r\n source.forEach((t, v) => this.add(t, v));\r\n }\r\n\r\n /**\r\n * Get a value based from its key\r\n * @param key the given key to get the matching value from\r\n * @returns the value if found, otherwise undefined is returned\r\n */\r\n public get(key: string): T | undefined {\r\n const val = this._data[key];\r\n if (val !== undefined) {\r\n return val;\r\n }\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Get a value from its key or add it if it doesn't exist.\r\n * This method will ensure you that a given key/data will be present in the dictionary.\r\n * @param key the given key to get the matching value from\r\n * @param factory the factory that will create the value if the key is not present in the dictionary.\r\n * The factory will only be invoked if there's no data for the given key.\r\n * @returns the value corresponding to the key.\r\n */\r\n public getOrAddWithFactory(key: string, factory: (key: string) => T): T {\r\n let val = this.get(key);\r\n if (val !== undefined) {\r\n return val;\r\n }\r\n\r\n val = factory(key);\r\n if (val) {\r\n this.add(key, val);\r\n }\r\n\r\n return val;\r\n }\r\n\r\n /**\r\n * Get a value from its key if present in the dictionary otherwise add it\r\n * @param key the key to get the value from\r\n * @param val if there's no such key/value pair in the dictionary add it with this value\r\n * @returns the value corresponding to the key\r\n */\r\n public getOrAdd(key: string, val: T): T {\r\n const curVal = this.get(key);\r\n if (curVal !== undefined) {\r\n return curVal;\r\n }\r\n\r\n this.add(key, val);\r\n return val;\r\n }\r\n\r\n /**\r\n * Check if there's a given key in the dictionary\r\n * @param key the key to check for\r\n * @returns true if the key is present, false otherwise\r\n */\r\n public contains(key: string): boolean {\r\n return this._data[key] !== undefined;\r\n }\r\n\r\n /**\r\n * Add a new key and its corresponding value\r\n * @param key the key to add\r\n * @param value the value corresponding to the key\r\n * @returns true if the operation completed successfully, false if we couldn't insert the key/value because there was already this key in the dictionary\r\n */\r\n public add(key: string, value: T): boolean {\r\n if (this._data[key] !== undefined) {\r\n return false;\r\n }\r\n this._data[key] = value;\r\n ++this._count;\r\n return true;\r\n }\r\n\r\n /**\r\n * Update a specific value associated to a key\r\n * @param key defines the key to use\r\n * @param value defines the value to store\r\n * @returns true if the value was updated (or false if the key was not found)\r\n */\r\n public set(key: string, value: T): boolean {\r\n if (this._data[key] === undefined) {\r\n return false;\r\n }\r\n this._data[key] = value;\r\n return true;\r\n }\r\n\r\n /**\r\n * Get the element of the given key and remove it from the dictionary\r\n * @param key defines the key to search\r\n * @returns the value associated with the key or null if not found\r\n */\r\n public getAndRemove(key: string): Nullable<T> {\r\n const val = this.get(key);\r\n if (val !== undefined) {\r\n delete this._data[key];\r\n --this._count;\r\n return val;\r\n }\r\n return null;\r\n }\r\n\r\n /**\r\n * Remove a key/value from the dictionary.\r\n * @param key the key to remove\r\n * @returns true if the item was successfully deleted, false if no item with such key exist in the dictionary\r\n */\r\n public remove(key: string): boolean {\r\n if (this.contains(key)) {\r\n delete this._data[key];\r\n --this._count;\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n /**\r\n * Clear the whole content of the dictionary\r\n */\r\n public clear() {\r\n this._data = {};\r\n this._count = 0;\r\n }\r\n\r\n /**\r\n * Gets the current count\r\n */\r\n public get count() {\r\n return this._count;\r\n }\r\n\r\n /**\r\n * Execute a callback on each key/val of the dictionary.\r\n * Note that you can remove any element in this dictionary in the callback implementation\r\n * @param callback the callback to execute on a given key/value pair\r\n */\r\n public forEach(callback: (key: string, val: T) => void) {\r\n for (const cur in this._data) {\r\n const val = this._data[cur];\r\n callback(cur, val);\r\n }\r\n }\r\n\r\n /**\r\n * Execute a callback on every occurrence of the dictionary until it returns a valid TRes object.\r\n * If the callback returns null or undefined the method will iterate to the next key/value pair\r\n * Note that you can remove any element in this dictionary in the callback implementation\r\n * @param callback the callback to execute, if it return a valid T instanced object the enumeration will stop and the object will be returned\r\n * @returns the first item\r\n */\r\n public first<TRes>(callback: (key: string, val: T) => TRes) {\r\n for (const cur in this._data) {\r\n const val = this._data[cur];\r\n const res = callback(cur, val);\r\n if (res) {\r\n return res;\r\n }\r\n }\r\n return null;\r\n }\r\n\r\n private _count = 0;\r\n private _data: { [key: string]: T } = {};\r\n}\r\n"]}
|
package/Misc/textureTools.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import type { Scene } from "../scene";
|
|
|
7
7
|
* @param width defines the desired width
|
|
8
8
|
* @param height defines the desired height
|
|
9
9
|
* @param useBilinearMode defines if bilinear mode has to be used
|
|
10
|
-
* @
|
|
10
|
+
* @returns the generated texture
|
|
11
11
|
*/
|
|
12
12
|
export declare function CreateResizedCopy(texture: Texture, width: number, height: number, useBilinearMode?: boolean): Texture;
|
|
13
13
|
/**
|
|
@@ -18,7 +18,7 @@ export declare function CreateResizedCopy(texture: Texture, width: number, heigh
|
|
|
18
18
|
* @param type type of the output texture. If not provided, use the one from internalTexture
|
|
19
19
|
* @param samplingMode sampling mode to use to sample the source texture. If not provided, use the one from internalTexture
|
|
20
20
|
* @param format format of the output texture. If not provided, use the one from internalTexture
|
|
21
|
-
* @
|
|
21
|
+
* @returns a promise with the internalTexture having its texture replaced by the result of the processing
|
|
22
22
|
*/
|
|
23
23
|
export declare function ApplyPostProcess(postProcessName: string, internalTexture: InternalTexture, scene: Scene, type?: number, samplingMode?: number, format?: number): Promise<InternalTexture>;
|
|
24
24
|
/**
|
|
@@ -43,7 +43,7 @@ export declare const TextureTools: {
|
|
|
43
43
|
* @param width defines the desired width
|
|
44
44
|
* @param height defines the desired height
|
|
45
45
|
* @param useBilinearMode defines if bilinear mode has to be used
|
|
46
|
-
* @
|
|
46
|
+
* @returns the generated texture
|
|
47
47
|
*/
|
|
48
48
|
CreateResizedCopy: typeof CreateResizedCopy;
|
|
49
49
|
/**
|
|
@@ -54,7 +54,7 @@ export declare const TextureTools: {
|
|
|
54
54
|
* @param type type of the output texture. If not provided, use the one from internalTexture
|
|
55
55
|
* @param samplingMode sampling mode to use to sample the source texture. If not provided, use the one from internalTexture
|
|
56
56
|
* @param format format of the output texture. If not provided, use the one from internalTexture
|
|
57
|
-
* @
|
|
57
|
+
* @returns a promise with the internalTexture having its texture replaced by the result of the processing
|
|
58
58
|
*/
|
|
59
59
|
ApplyPostProcess: typeof ApplyPostProcess;
|
|
60
60
|
/**
|
package/Misc/textureTools.js
CHANGED
|
@@ -9,7 +9,7 @@ import { PostProcess } from "../PostProcesses/postProcess.js";
|
|
|
9
9
|
* @param width defines the desired width
|
|
10
10
|
* @param height defines the desired height
|
|
11
11
|
* @param useBilinearMode defines if bilinear mode has to be used
|
|
12
|
-
* @
|
|
12
|
+
* @returns the generated texture
|
|
13
13
|
*/
|
|
14
14
|
export function CreateResizedCopy(texture, width, height, useBilinearMode = true) {
|
|
15
15
|
const scene = texture.getScene();
|
|
@@ -55,7 +55,7 @@ export function CreateResizedCopy(texture, width, height, useBilinearMode = true
|
|
|
55
55
|
* @param type type of the output texture. If not provided, use the one from internalTexture
|
|
56
56
|
* @param samplingMode sampling mode to use to sample the source texture. If not provided, use the one from internalTexture
|
|
57
57
|
* @param format format of the output texture. If not provided, use the one from internalTexture
|
|
58
|
-
* @
|
|
58
|
+
* @returns a promise with the internalTexture having its texture replaced by the result of the processing
|
|
59
59
|
*/
|
|
60
60
|
export function ApplyPostProcess(postProcessName, internalTexture, scene, type, samplingMode, format) {
|
|
61
61
|
// Gets everything ready.
|
|
@@ -173,7 +173,7 @@ export const TextureTools = {
|
|
|
173
173
|
* @param width defines the desired width
|
|
174
174
|
* @param height defines the desired height
|
|
175
175
|
* @param useBilinearMode defines if bilinear mode has to be used
|
|
176
|
-
* @
|
|
176
|
+
* @returns the generated texture
|
|
177
177
|
*/
|
|
178
178
|
CreateResizedCopy,
|
|
179
179
|
/**
|
|
@@ -184,7 +184,7 @@ export const TextureTools = {
|
|
|
184
184
|
* @param type type of the output texture. If not provided, use the one from internalTexture
|
|
185
185
|
* @param samplingMode sampling mode to use to sample the source texture. If not provided, use the one from internalTexture
|
|
186
186
|
* @param format format of the output texture. If not provided, use the one from internalTexture
|
|
187
|
-
* @
|
|
187
|
+
* @returns a promise with the internalTexture having its texture replaced by the result of the processing
|
|
188
188
|
*/
|
|
189
189
|
ApplyPostProcess,
|
|
190
190
|
/**
|