@babylonjs/core 6.8.0 → 6.9.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.js.map +1 -1
- package/Actions/action.d.ts +4 -5
- package/Actions/action.js.map +1 -1
- package/Actions/condition.d.ts +1 -2
- package/Actions/condition.js.map +1 -1
- package/Actions/directActions.d.ts +1 -2
- package/Actions/directActions.js.map +1 -1
- package/Animations/animatable.interface.d.ts +1 -2
- package/Animations/animatable.interface.js.map +1 -1
- package/Animations/animation.d.ts +3 -4
- package/Animations/animation.js.map +1 -1
- package/Animations/animationGroup.d.ts +5 -0
- package/Animations/animationGroup.js +12 -0
- package/Animations/animationGroup.js.map +1 -1
- package/Animations/easing.js.map +1 -1
- package/Animations/runtimeAnimation.d.ts +1 -2
- package/Animations/runtimeAnimation.js.map +1 -1
- package/Audio/audioSceneComponent.js.map +1 -1
- package/Audio/sound.js.map +1 -1
- package/BakedVertexAnimation/bakedVertexAnimationManager.js.map +1 -1
- package/Behaviors/Cameras/bouncingBehavior.js.map +1 -1
- package/Behaviors/Cameras/framingBehavior.js.map +1 -1
- package/Behaviors/Meshes/fadeInOutBehavior.js.map +1 -1
- package/Behaviors/Meshes/pointerDragBehavior.js.map +1 -1
- package/Bones/bone.d.ts +3 -3
- package/Bones/bone.js.map +1 -1
- package/Bones/boneIKController.js.map +1 -1
- package/Bones/boneLookController.js.map +1 -1
- package/Buffers/dataBuffer.js.map +1 -1
- package/Cameras/Inputs/BaseCameraMouseWheelInput.js.map +1 -1
- package/Cameras/Inputs/BaseCameraPointersInput.js.map +1 -1
- package/Cameras/Inputs/arcRotateCameraGamepadInput.js.map +1 -1
- package/Cameras/Inputs/arcRotateCameraKeyboardMoveInput.js.map +1 -1
- package/Cameras/Inputs/arcRotateCameraMouseWheelInput.js.map +1 -1
- package/Cameras/Inputs/arcRotateCameraPointersInput.js.map +1 -1
- package/Cameras/Inputs/flyCameraKeyboardInput.js.map +1 -1
- package/Cameras/Inputs/flyCameraMouseInput.js.map +1 -1
- package/Cameras/Inputs/followCameraKeyboardMoveInput.js.map +1 -1
- package/Cameras/Inputs/followCameraMouseWheelInput.js.map +1 -1
- package/Cameras/Inputs/followCameraPointersInput.js.map +1 -1
- package/Cameras/Inputs/freeCameraGamepadInput.js.map +1 -1
- package/Cameras/Inputs/freeCameraKeyboardMoveInput.js.map +1 -1
- package/Cameras/Inputs/freeCameraMouseInput.js.map +1 -1
- package/Cameras/Inputs/freeCameraTouchInput.js.map +1 -1
- package/Cameras/VR/vrExperienceHelper.js.map +1 -1
- package/Cameras/arcRotateCamera.d.ts +1 -2
- package/Cameras/arcRotateCamera.js.map +1 -1
- package/Cameras/camera.d.ts +6 -7
- package/Cameras/camera.js.map +1 -1
- package/Cameras/flyCamera.js.map +1 -1
- package/Cameras/followCamera.js.map +1 -1
- package/Cameras/freeCamera.js.map +1 -1
- package/Cameras/targetCamera.js.map +1 -1
- package/Collisions/collider.js.map +1 -1
- package/Collisions/meshCollisionData.d.ts +1 -2
- package/Collisions/meshCollisionData.js.map +1 -1
- package/Collisions/pickingInfo.d.ts +1 -2
- package/Collisions/pickingInfo.js.map +1 -1
- package/Compute/computeEffect.d.ts +1 -2
- package/Compute/computeEffect.js.map +1 -1
- package/Compute/computeShader.js +1 -5
- package/Compute/computeShader.js.map +1 -1
- package/Culling/Octrees/octree.js.map +1 -1
- package/Culling/Octrees/octreeSceneComponent.d.ts +1 -2
- package/Culling/Octrees/octreeSceneComponent.js.map +1 -1
- package/Culling/boundingBox.d.ts +1 -2
- package/Culling/boundingBox.js.map +1 -1
- package/Culling/boundingInfo.d.ts +1 -2
- package/Culling/boundingInfo.js.map +1 -1
- package/Culling/boundingSphere.js.map +1 -1
- package/Culling/ray.js.map +1 -1
- package/Debug/debugLayer.js +1 -9
- package/Debug/debugLayer.js.map +1 -1
- package/Debug/skeletonViewer.js.map +1 -1
- package/Engines/Extensions/engine.cubeTexture.js +1 -6
- package/Engines/Extensions/engine.cubeTexture.js.map +1 -1
- package/Engines/Extensions/engine.multiRender.js.map +1 -1
- package/Engines/Extensions/engine.renderTarget.js +1 -6
- package/Engines/Extensions/engine.renderTarget.js.map +1 -1
- package/Engines/Extensions/engine.renderTargetCube.js +1 -9
- package/Engines/Extensions/engine.renderTargetCube.js.map +1 -1
- package/Engines/Extensions/engine.storageBuffer.d.ts +1 -2
- package/Engines/Extensions/engine.storageBuffer.js.map +1 -1
- package/Engines/Extensions/engine.textureSampler.d.ts +1 -2
- package/Engines/Extensions/engine.textureSampler.js.map +1 -1
- package/Engines/Extensions/engine.webVR.js +1 -5
- package/Engines/Extensions/engine.webVR.js.map +1 -1
- package/Engines/Processors/Expressions/Operators/shaderDefineArithmeticOperator.js +3 -0
- package/Engines/Processors/Expressions/Operators/shaderDefineArithmeticOperator.js.map +1 -1
- package/Engines/Processors/iShaderProcessor.d.ts +1 -2
- package/Engines/Processors/iShaderProcessor.js.map +1 -1
- package/Engines/Processors/shaderCodeInliner.js.map +1 -1
- package/Engines/Processors/shaderProcessor.d.ts +5 -6
- package/Engines/Processors/shaderProcessor.js +10 -3
- package/Engines/Processors/shaderProcessor.js.map +1 -1
- package/Engines/WebGL/webGLShaderProcessors.d.ts +1 -2
- package/Engines/WebGL/webGLShaderProcessors.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.cubeTexture.js +1 -7
- package/Engines/WebGPU/Extensions/engine.cubeTexture.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.query.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.rawTexture.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.renderTarget.js +1 -8
- package/Engines/WebGPU/Extensions/engine.renderTarget.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.renderTargetCube.js +1 -10
- package/Engines/WebGPU/Extensions/engine.renderTargetCube.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.storageBuffer.d.ts +1 -2
- package/Engines/WebGPU/Extensions/engine.storageBuffer.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.textureSampler.d.ts +1 -2
- package/Engines/WebGPU/Extensions/engine.textureSampler.js.map +1 -1
- package/Engines/WebGPU/webgpuCacheBindGroups.js.map +1 -1
- package/Engines/WebGPU/webgpuCacheRenderPipeline.js.map +1 -1
- package/Engines/WebGPU/webgpuCacheSampler.js +1 -6
- package/Engines/WebGPU/webgpuCacheSampler.js.map +1 -1
- package/Engines/WebGPU/webgpuHardwareTexture.d.ts +1 -2
- package/Engines/WebGPU/webgpuHardwareTexture.js.map +1 -1
- package/Engines/WebGPU/webgpuShaderProcessor.js.map +1 -1
- package/Engines/WebGPU/webgpuTintWASM.js +1 -4
- package/Engines/WebGPU/webgpuTintWASM.js.map +1 -1
- package/Engines/engine.d.ts +3 -3
- package/Engines/engine.js.map +1 -1
- package/Engines/engineStore.d.ts +4 -5
- package/Engines/engineStore.js.map +1 -1
- package/Engines/nativeEngine.js.map +1 -1
- package/Engines/nullEngine.js +1 -9
- package/Engines/nullEngine.js.map +1 -1
- package/Engines/thinEngine.js +3 -2
- package/Engines/thinEngine.js.map +1 -1
- package/Engines/webgpuEngine.d.ts +1 -2
- package/Engines/webgpuEngine.js +3 -14
- package/Engines/webgpuEngine.js.map +1 -1
- package/Events/pointerEvents.d.ts +1 -2
- package/Events/pointerEvents.js.map +1 -1
- package/Gamepads/Controllers/gearVRController.js.map +1 -1
- package/Gamepads/Controllers/oculusTouchController.js.map +1 -1
- package/Gamepads/Controllers/poseEnabledController.js.map +1 -1
- package/Gamepads/Controllers/windowsMotionController.js.map +1 -1
- package/Gamepads/gamepad.js.map +1 -1
- package/Gizmos/cameraGizmo.js.map +1 -1
- package/Gizmos/gizmo.js.map +1 -1
- package/Gizmos/lightGizmo.js.map +1 -1
- package/Gizmos/planeRotationGizmo.js.map +1 -1
- package/Helpers/environmentHelper.js +2 -8
- package/Helpers/environmentHelper.js.map +1 -1
- package/Helpers/textureDome.js.map +1 -1
- package/Inputs/scene.inputManager.d.ts +1 -2
- package/Inputs/scene.inputManager.js +4 -1
- package/Inputs/scene.inputManager.js.map +1 -1
- package/Layers/effectLayer.js +1 -8
- package/Layers/effectLayer.js.map +1 -1
- package/Layers/glowLayer.js +1 -12
- package/Layers/glowLayer.js.map +1 -1
- package/Layers/highlightLayer.js +1 -11
- package/Layers/highlightLayer.js.map +1 -1
- package/Legacy/legacy.js +1 -1
- package/Legacy/legacy.js.map +1 -1
- package/LensFlares/lensFlareSystem.js.map +1 -1
- package/Lights/Shadows/shadowGenerator.js +1 -4
- package/Lights/Shadows/shadowGenerator.js.map +1 -1
- package/Lights/directionalLight.js.map +1 -1
- package/Lights/hemisphericLight.js.map +1 -1
- package/Lights/light.js.map +1 -1
- package/Lights/spotLight.js.map +1 -1
- package/Loading/loadingScreen.js.map +1 -1
- package/Materials/Background/backgroundMaterial.js.map +1 -1
- package/Materials/Node/Blocks/Dual/currentScreenBlock.d.ts +2 -3
- package/Materials/Node/Blocks/Dual/currentScreenBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/lightBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/sceneDepthBlock.d.ts +2 -3
- package/Materials/Node/Blocks/Dual/sceneDepthBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.d.ts +3 -4
- package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/heightToNormalBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/imageProcessingBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/clearCoatBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/reflectionBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/refractionBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/sheenBlock.js.map +1 -1
- package/Materials/Node/Blocks/Particle/particleTextureBlock.d.ts +1 -2
- package/Materials/Node/Blocks/Particle/particleTextureBlock.js.map +1 -1
- package/Materials/Node/Blocks/Vertex/vertexOutputBlock.js.map +1 -1
- package/Materials/Node/Blocks/addBlock.js +2 -0
- package/Materials/Node/Blocks/addBlock.js.map +1 -1
- package/Materials/Node/Blocks/clampBlock.js.map +1 -1
- package/Materials/Node/Blocks/cloudBlock.js.map +1 -1
- package/Materials/Node/Blocks/customBlock.d.ts +1 -0
- package/Materials/Node/Blocks/customBlock.js +18 -2
- package/Materials/Node/Blocks/customBlock.js.map +1 -1
- package/Materials/Node/Blocks/divideBlock.js +2 -0
- package/Materials/Node/Blocks/divideBlock.js.map +1 -1
- package/Materials/Node/Blocks/meshAttributeExistsBlock.js.map +1 -1
- package/Materials/Node/Blocks/multiplyBlock.js +2 -0
- package/Materials/Node/Blocks/multiplyBlock.js.map +1 -1
- package/Materials/Node/Blocks/remapBlock.js.map +1 -1
- package/Materials/Node/Blocks/subtractBlock.js +2 -0
- package/Materials/Node/Blocks/subtractBlock.js.map +1 -1
- package/Materials/Node/Blocks/triPlanarBlock.js.map +1 -1
- package/Materials/Node/Blocks/worleyNoise3DBlock.js.map +1 -1
- package/Materials/Node/nodeMaterial.js +2 -8
- package/Materials/Node/nodeMaterial.js.map +1 -1
- package/Materials/Node/nodeMaterialDecorator.d.ts +2 -3
- package/Materials/Node/nodeMaterialDecorator.js.map +1 -1
- package/Materials/PBR/pbrAnisotropicConfiguration.d.ts +3 -4
- package/Materials/PBR/pbrAnisotropicConfiguration.js.map +1 -1
- package/Materials/PBR/pbrBRDFConfiguration.js.map +1 -1
- package/Materials/PBR/pbrBaseMaterial.js +1 -5
- package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
- package/Materials/PBR/pbrBaseSimpleMaterial.js.map +1 -1
- package/Materials/PBR/pbrClearCoatConfiguration.d.ts +3 -4
- package/Materials/PBR/pbrClearCoatConfiguration.js.map +1 -1
- package/Materials/PBR/pbrIridescenceConfiguration.d.ts +3 -4
- package/Materials/PBR/pbrIridescenceConfiguration.js.map +1 -1
- package/Materials/PBR/pbrMaterial.d.ts +2 -1
- package/Materials/PBR/pbrMaterial.js +6 -13
- package/Materials/PBR/pbrMaterial.js.map +1 -1
- package/Materials/PBR/pbrMetallicRoughnessMaterial.js.map +1 -1
- package/Materials/PBR/pbrSheenConfiguration.d.ts +3 -4
- package/Materials/PBR/pbrSheenConfiguration.js.map +1 -1
- package/Materials/PBR/pbrSpecularGlossinessMaterial.js.map +1 -1
- package/Materials/PBR/pbrSubSurfaceConfiguration.d.ts +3 -4
- package/Materials/PBR/pbrSubSurfaceConfiguration.js.map +1 -1
- package/Materials/Textures/Procedurals/proceduralTexture.js.map +1 -1
- package/Materials/Textures/baseTexture.d.ts +2 -1
- package/Materials/Textures/baseTexture.js.map +1 -1
- package/Materials/Textures/cubeTexture.js.map +1 -1
- package/Materials/Textures/equiRectangularCubeTexture.js.map +1 -1
- package/Materials/Textures/hdrCubeTexture.js.map +1 -1
- package/Materials/Textures/htmlElementTexture.d.ts +2 -3
- package/Materials/Textures/htmlElementTexture.js +1 -4
- package/Materials/Textures/htmlElementTexture.js.map +1 -1
- package/Materials/Textures/internalTexture.d.ts +3 -4
- package/Materials/Textures/internalTexture.js.map +1 -1
- package/Materials/Textures/rawTexture.d.ts +1 -2
- package/Materials/Textures/rawTexture.js.map +1 -1
- package/Materials/Textures/rawTexture2DArray.d.ts +1 -2
- package/Materials/Textures/rawTexture2DArray.js.map +1 -1
- package/Materials/Textures/renderTargetTexture.d.ts +1 -2
- package/Materials/Textures/renderTargetTexture.js.map +1 -1
- package/Materials/Textures/texture.d.ts +4 -5
- package/Materials/Textures/texture.js.map +1 -1
- package/Materials/Textures/videoTexture.js +9 -22
- package/Materials/Textures/videoTexture.js.map +1 -1
- package/Materials/colorCurves.js.map +1 -1
- package/Materials/drawWrapper.d.ts +3 -4
- package/Materials/drawWrapper.js.map +1 -1
- package/Materials/effect.d.ts +5 -6
- package/Materials/effect.js.map +1 -1
- package/Materials/effectFallbacks.d.ts +2 -3
- package/Materials/effectFallbacks.js.map +1 -1
- package/Materials/greasedLinePluginMaterial.d.ts +307 -0
- package/Materials/greasedLinePluginMaterial.js +553 -0
- package/Materials/greasedLinePluginMaterial.js.map +1 -0
- package/Materials/iEffectFallbacks.d.ts +1 -2
- package/Materials/iEffectFallbacks.js.map +1 -1
- package/Materials/imageProcessingConfiguration.d.ts +2 -3
- package/Materials/imageProcessingConfiguration.js.map +1 -1
- package/Materials/index.d.ts +1 -0
- package/Materials/index.js +1 -0
- package/Materials/index.js.map +1 -1
- package/Materials/material.d.ts +6 -4
- package/Materials/material.decalMapConfiguration.js.map +1 -1
- package/Materials/material.detailMapConfiguration.d.ts +4 -5
- package/Materials/material.detailMapConfiguration.js.map +1 -1
- package/Materials/material.js +40 -5
- package/Materials/material.js.map +1 -1
- package/Materials/materialPluginBase.d.ts +13 -14
- package/Materials/materialPluginBase.js +2 -2
- package/Materials/materialPluginBase.js.map +1 -1
- package/Materials/materialPluginEvent.d.ts +8 -9
- package/Materials/materialPluginEvent.js.map +1 -1
- package/Materials/materialPluginFactoryExport.d.ts +1 -2
- package/Materials/materialPluginFactoryExport.js.map +1 -1
- package/Materials/materialPluginManager.d.ts +6 -6
- package/Materials/materialPluginManager.js +3 -1
- package/Materials/materialPluginManager.js.map +1 -1
- package/Materials/materialStencilState.d.ts +1 -2
- package/Materials/materialStencilState.js.map +1 -1
- package/Materials/shaderMaterial.d.ts +4 -5
- package/Materials/shaderMaterial.js +6 -19
- package/Materials/shaderMaterial.js.map +1 -1
- package/Materials/standardMaterial.d.ts +2 -1
- package/Materials/standardMaterial.js +4 -1
- package/Materials/standardMaterial.js.map +1 -1
- package/Materials/uniformBuffer.js.map +1 -1
- package/Maths/math.vector.d.ts +2 -1
- package/Maths/math.vector.js +3 -2
- package/Maths/math.vector.js.map +1 -1
- package/Meshes/Builders/decalBuilder.js +4 -4
- package/Meshes/Builders/decalBuilder.js.map +1 -1
- package/Meshes/Builders/greasedLineBuilder.d.ts +105 -0
- package/Meshes/Builders/greasedLineBuilder.js +330 -0
- package/Meshes/Builders/greasedLineBuilder.js.map +1 -0
- package/Meshes/Builders/index.d.ts +1 -0
- package/Meshes/Builders/index.js +1 -0
- package/Meshes/Builders/index.js.map +1 -1
- package/Meshes/Builders/linesBuilder.d.ts +1 -2
- package/Meshes/Builders/linesBuilder.js.map +1 -1
- package/Meshes/Builders/textBuilder.d.ts +34 -0
- package/Meshes/Builders/textBuilder.js +10 -2
- package/Meshes/Builders/textBuilder.js.map +1 -1
- package/Meshes/abstractMesh.d.ts +6 -6
- package/Meshes/abstractMesh.js +3 -2
- package/Meshes/abstractMesh.js.map +1 -1
- package/Meshes/geometry.d.ts +1 -2
- package/Meshes/geometry.js.map +1 -1
- package/Meshes/greasedLineMesh.d.ts +189 -0
- package/Meshes/greasedLineMesh.js +437 -0
- package/Meshes/greasedLineMesh.js.map +1 -0
- package/Meshes/index.d.ts +1 -0
- package/Meshes/index.js +1 -0
- package/Meshes/index.js.map +1 -1
- package/Meshes/mesh.d.ts +10 -6
- package/Meshes/mesh.js +20 -10
- package/Meshes/mesh.js.map +1 -1
- package/Meshes/mesh.vertexData.d.ts +2 -3
- package/Meshes/mesh.vertexData.js.map +1 -1
- package/Meshes/meshUVSpaceRenderer.js +1 -8
- package/Meshes/meshUVSpaceRenderer.js.map +1 -1
- package/Meshes/subMesh.d.ts +7 -8
- package/Meshes/subMesh.js.map +1 -1
- package/Meshes/transformNode.js.map +1 -1
- package/Misc/basis.js.map +1 -1
- package/Misc/copyTools.d.ts +1 -2
- package/Misc/copyTools.js.map +1 -1
- package/Misc/decorators.d.ts +5 -6
- package/Misc/decorators.js.map +1 -1
- package/Misc/deepCopier.js +7 -1
- package/Misc/deepCopier.js.map +1 -1
- package/Misc/dumpTools.d.ts +4 -3
- package/Misc/dumpTools.js +5 -4
- package/Misc/dumpTools.js.map +1 -1
- package/Misc/environmentTextureTools.js +1 -1
- package/Misc/environmentTextureTools.js.map +1 -1
- package/Misc/fileTools.js +10 -10
- package/Misc/fileTools.js.map +1 -1
- package/Misc/greasedLineTools.d.ts +153 -0
- package/Misc/greasedLineTools.js +299 -0
- package/Misc/greasedLineTools.js.map +1 -0
- package/Misc/index.d.ts +1 -0
- package/Misc/index.js +1 -0
- package/Misc/index.js.map +1 -1
- package/Misc/khronosTextureContainer.js.map +1 -1
- package/Misc/rgbdTextureTools.d.ts +3 -4
- package/Misc/rgbdTextureTools.js.map +1 -1
- package/Misc/sceneOptimizer.js.map +1 -1
- package/Misc/screenshotTools.d.ts +16 -7
- package/Misc/screenshotTools.js +23 -13
- package/Misc/screenshotTools.js.map +1 -1
- package/Misc/smartArray.js.map +1 -1
- package/Misc/tools.d.ts +21 -9
- package/Misc/tools.js +21 -9
- package/Misc/tools.js.map +1 -1
- package/Misc/videoRecorder.js +1 -4
- package/Misc/videoRecorder.js.map +1 -1
- package/Misc/virtualJoystick.js +1 -4
- package/Misc/virtualJoystick.js.map +1 -1
- package/Misc/webRequest.js.map +1 -1
- package/Morph/morphTarget.d.ts +2 -1
- package/Morph/morphTarget.js.map +1 -1
- package/Morph/morphTargetManager.js.map +1 -1
- package/Offline/database.js.map +1 -1
- package/Particles/EmitterTypes/IParticleEmitterType.d.ts +1 -2
- package/Particles/EmitterTypes/IParticleEmitterType.js.map +1 -1
- package/Particles/IParticleSystem.d.ts +2 -3
- package/Particles/IParticleSystem.js.map +1 -1
- package/Particles/baseParticleSystem.js.map +1 -1
- package/Particles/gpuParticleSystem.d.ts +1 -2
- package/Particles/gpuParticleSystem.js +2 -6
- package/Particles/gpuParticleSystem.js.map +1 -1
- package/Particles/particle.js.map +1 -1
- package/Particles/particleSystem.d.ts +1 -2
- package/Particles/particleSystem.js +1 -1
- package/Particles/particleSystem.js.map +1 -1
- package/Particles/particleSystemSet.js.map +1 -1
- package/Particles/subEmitter.d.ts +2 -3
- package/Particles/subEmitter.js.map +1 -1
- package/Particles/webgl2ParticleSystem.js.map +1 -1
- package/Physics/physicsHelper.js +4 -4
- package/Physics/physicsHelper.js.map +1 -1
- package/Physics/physicsRaycastResult.d.ts +3 -1
- package/Physics/physicsRaycastResult.js +10 -1
- package/Physics/physicsRaycastResult.js.map +1 -1
- package/Physics/v1/Plugins/ammoJSPlugin.js.map +1 -1
- package/Physics/v1/physicsImpostor.js.map +1 -1
- package/Physics/v2/IPhysicsEnginePlugin.d.ts +10 -0
- package/Physics/v2/IPhysicsEnginePlugin.js.map +1 -1
- package/Physics/v2/Plugins/havokPlugin.d.ts +3 -2
- package/Physics/v2/Plugins/havokPlugin.js +9 -6
- package/Physics/v2/Plugins/havokPlugin.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.d.ts +1 -2
- package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/ssaoRenderingPipeline.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/ssrRenderingPipeline.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/standardRenderingPipeline.d.ts +1 -2
- package/PostProcesses/RenderPipeline/Pipelines/standardRenderingPipeline.js.map +1 -1
- package/PostProcesses/RenderPipeline/postProcessRenderPipeline.d.ts +1 -2
- package/PostProcesses/RenderPipeline/postProcessRenderPipeline.js.map +1 -1
- package/PostProcesses/blackAndWhitePostProcess.d.ts +1 -2
- package/PostProcesses/blackAndWhitePostProcess.js.map +1 -1
- package/PostProcesses/bloomMergePostProcess.js.map +1 -1
- package/PostProcesses/blurPostProcess.d.ts +1 -2
- package/PostProcesses/blurPostProcess.js.map +1 -1
- package/PostProcesses/chromaticAberrationPostProcess.d.ts +1 -2
- package/PostProcesses/chromaticAberrationPostProcess.js.map +1 -1
- package/PostProcesses/circleOfConfusionPostProcess.js.map +1 -1
- package/PostProcesses/colorCorrectionPostProcess.d.ts +1 -2
- package/PostProcesses/colorCorrectionPostProcess.js.map +1 -1
- package/PostProcesses/convolutionPostProcess.d.ts +1 -2
- package/PostProcesses/convolutionPostProcess.js.map +1 -1
- package/PostProcesses/depthOfFieldBlurPostProcess.js.map +1 -1
- package/PostProcesses/displayPassPostProcess.d.ts +1 -2
- package/PostProcesses/displayPassPostProcess.js.map +1 -1
- package/PostProcesses/extractHighlightsPostProcess.js.map +1 -1
- package/PostProcesses/filterPostProcess.d.ts +1 -2
- package/PostProcesses/filterPostProcess.js.map +1 -1
- package/PostProcesses/fxaaPostProcess.d.ts +1 -2
- package/PostProcesses/fxaaPostProcess.js.map +1 -1
- package/PostProcesses/grainPostProcess.d.ts +1 -2
- package/PostProcesses/grainPostProcess.js.map +1 -1
- package/PostProcesses/imageProcessingPostProcess.js.map +1 -1
- package/PostProcesses/motionBlurPostProcess.d.ts +2 -3
- package/PostProcesses/motionBlurPostProcess.js.map +1 -1
- package/PostProcesses/passPostProcess.d.ts +1 -2
- package/PostProcesses/passPostProcess.js.map +1 -1
- package/PostProcesses/postProcess.d.ts +6 -6
- package/PostProcesses/postProcess.js.map +1 -1
- package/PostProcesses/postProcessManager.d.ts +1 -2
- package/PostProcesses/postProcessManager.js.map +1 -1
- package/PostProcesses/refractionPostProcess.d.ts +1 -2
- package/PostProcesses/refractionPostProcess.js.map +1 -1
- package/PostProcesses/screenSpaceCurvaturePostProcess.d.ts +2 -3
- package/PostProcesses/screenSpaceCurvaturePostProcess.js.map +1 -1
- package/PostProcesses/screenSpaceReflectionPostProcess.d.ts +2 -3
- package/PostProcesses/screenSpaceReflectionPostProcess.js.map +1 -1
- package/PostProcesses/sharpenPostProcess.d.ts +2 -3
- package/PostProcesses/sharpenPostProcess.js.map +1 -1
- package/PostProcesses/tonemapPostProcess.d.ts +1 -2
- package/PostProcesses/tonemapPostProcess.js.map +1 -1
- package/PostProcesses/volumetricLightScatteringPostProcess.d.ts +1 -2
- package/PostProcesses/volumetricLightScatteringPostProcess.js.map +1 -1
- package/Probes/reflectionProbe.js.map +1 -1
- package/Rendering/depthPeelingRenderer.js.map +1 -1
- package/Rendering/depthRenderer.d.ts +2 -3
- package/Rendering/depthRenderer.js.map +1 -1
- package/Rendering/geometryBufferRenderer.js +2 -2
- package/Rendering/geometryBufferRenderer.js.map +1 -1
- package/Rendering/outlineRenderer.js.map +1 -1
- package/Rendering/prePassRenderer.js.map +1 -1
- package/Rendering/renderingGroup.js.map +1 -1
- package/Rendering/renderingManager.d.ts +5 -6
- package/Rendering/renderingManager.js.map +1 -1
- package/Rendering/subSurfaceConfiguration.js.map +1 -1
- package/Rendering/utilityLayerRenderer.js.map +1 -1
- package/Shaders/ShadersInclude/pbrBlockAlbedoOpacity.js +4 -2
- package/Shaders/ShadersInclude/pbrBlockAlbedoOpacity.js.map +1 -1
- package/Shaders/ShadersInclude/pbrDebug.js +3 -1
- package/Shaders/ShadersInclude/pbrDebug.js.map +1 -1
- package/Sprites/sprite.d.ts +1 -2
- package/Sprites/sprite.js.map +1 -1
- package/Sprites/spriteManager.d.ts +1 -2
- package/Sprites/spriteManager.js.map +1 -1
- package/Sprites/spriteRenderer.d.ts +2 -3
- package/Sprites/spriteRenderer.js.map +1 -1
- package/XR/features/WebXRAnchorSystem.js.map +1 -1
- package/XR/features/WebXRBackgroundRemover.js.map +1 -1
- package/XR/features/WebXRControllerMovement.js.map +1 -1
- package/XR/features/WebXRControllerPhysics.js +4 -13
- package/XR/features/WebXRControllerPhysics.js.map +1 -1
- package/XR/features/WebXRControllerPointerSelection.js.map +1 -1
- package/XR/features/WebXRControllerTeleportation.js.map +1 -1
- package/XR/features/WebXRDOMOverlay.js.map +1 -1
- package/XR/features/WebXRDepthSensing.js.map +1 -1
- package/XR/features/WebXREyeTracking.js.map +1 -1
- package/XR/features/WebXRFeaturePointSystem.js.map +1 -1
- package/XR/features/WebXRHandTracking.js +2 -8
- package/XR/features/WebXRHandTracking.js.map +1 -1
- package/XR/features/WebXRHitTest.js.map +1 -1
- package/XR/features/WebXRHitTestLegacy.js.map +1 -1
- package/XR/features/WebXRImageTracking.js.map +1 -1
- package/XR/features/WebXRLayers.js +2 -2
- package/XR/features/WebXRLayers.js.map +1 -1
- package/XR/features/WebXRLightEstimation.js.map +1 -1
- package/XR/features/WebXRMeshDetector.js.map +1 -1
- package/XR/features/WebXRNearInteraction.js.map +1 -1
- package/XR/features/WebXRPlaneDetector.js.map +1 -1
- package/XR/features/WebXRSpaceWarp.js.map +1 -1
- package/XR/motionController/webXRAbstractMotionController.js +1 -4
- package/XR/motionController/webXRAbstractMotionController.js.map +1 -1
- package/XR/motionController/webXRControllerComponent.js.map +1 -1
- package/XR/motionController/webXRGenericMotionController.js.map +1 -1
- package/XR/motionController/webXRHTCViveMotionController.js.map +1 -1
- package/XR/motionController/webXRMicrosoftMixedRealityController.js.map +1 -1
- package/XR/motionController/webXROculusTouchMotionController.js.map +1 -1
- package/XR/webXRCamera.js.map +1 -1
- package/XR/webXRDefaultExperience.js +6 -28
- package/XR/webXRDefaultExperience.js.map +1 -1
- package/XR/webXRExperienceHelper.js +1 -0
- package/XR/webXRExperienceHelper.js.map +1 -1
- package/XR/webXRFeaturesManager.js +1 -4
- package/XR/webXRFeaturesManager.js.map +1 -1
- package/XR/webXRInput.js +1 -6
- package/XR/webXRInput.js.map +1 -1
- package/abstractScene.d.ts +3 -3
- package/abstractScene.js.map +1 -1
- package/assetContainer.js +1 -4
- package/assetContainer.js.map +1 -1
- package/node.d.ts +6 -7
- package/node.js.map +1 -1
- package/package.json +2 -4
- package/scene.d.ts +49 -50
- package/scene.js +4 -10
- package/scene.js.map +1 -1
- package/sceneComponent.d.ts +6 -7
- package/sceneComponent.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"screenshotTools.js","sourceRoot":"","sources":["../../../../lts/core/generated/Misc/screenshotTools.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAA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J,0IAA0I;IAC1I,uEAAuE;IACvE,IAAI,KAAK,EAAE;QACP,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;KAC7B;IACD,IAAI,MAAM,EAAE;QACR,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;KAC/B;IACD,IAAI,UAAU,EAAE;QACZ,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;KACvC;IACD,IAAI,WAAW,EAAE;QACb,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;KACzC;IAED,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,CAAC,EAAE,KAAK,EAAE,KAAK,GAAG,CAAC,EAAE,UAAU,EAAE,UAAU,GAAG,CAAC,EAAE,WAAW,EAAE,WAAW,GAAG,CAAC,EAAE,CAAC;AAC9G,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC3B;;;;;;;;;;;;;;;;OAgBG;IACH,gBAAgB;IAEhB;;;;;;;;;;;;;;OAcG;IACH,qBAAqB;IAErB;;;;;;;;;;;OAWG;IACH,+BAA+B;IAE/B;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,iCAAiC;IAEjC;;;;;;;;;;;;;;;;;;OAkBG;IACH,sCAAsC;CACzC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,eAAe,GAAG,GAAG,EAAE;IACzB,+BAA+B;IAC/B,KAAK,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;IAC1C,KAAK,CAAC,qBAAqB,GAAG,qBAAqB,CAAC;IACpD,KAAK,CAAC,iCAAiC,GAAG,iCAAiC,CAAC;IAC5E,KAAK,CAAC,sCAAsC,GAAG,sCAAsC,CAAC;AAC1F,CAAC,CAAC;AAEF,eAAe,EAAE,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport type { Camera } from \"../Cameras/camera\";\r\nimport { Texture } from \"../Materials/Textures/texture\";\r\nimport { RenderTargetTexture } from \"../Materials/Textures/renderTargetTexture\";\r\nimport { FxaaPostProcess } from \"../PostProcesses/fxaaPostProcess\";\r\nimport { Constants } from \"../Engines/constants\";\r\nimport { Logger } from \"./logger\";\r\nimport { Tools } from \"./tools\";\r\nimport type { IScreenshotSize } from \"./interfaces/screenshotSize\";\r\nimport { DumpTools } from \"./dumpTools\";\r\nimport type { Nullable } from \"../types\";\r\nimport { ApplyPostProcess } from \"./textureTools\";\r\n\r\ndeclare type Engine = import(\"../Engines/engine\").Engine;\r\n\r\nlet screenshotCanvas: Nullable<HTMLCanvasElement> = null;\r\n\r\n/**\r\n * Captures a screenshot of the current rendering\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/scene/renderToPNG\r\n * @param engine defines the rendering engine\r\n * @param camera defines the source camera\r\n * @param size This parameter can be set to a single number or to an object with the\r\n * following (optional) properties: precision, width, height. If a single number is passed,\r\n * it will be used for both width and height. If an object is passed, the screenshot size\r\n * will be derived from the parameters. The precision property is a multiplier allowing\r\n * rendering at a higher or lower resolution\r\n * @param successCallback defines the callback receives a single parameter which contains the\r\n * screenshot as a string of base64-encoded characters. This string can be assigned to the\r\n * src parameter of an <img> to display it\r\n * @param mimeType defines the MIME type of the screenshot image (default: image/png).\r\n * Check your browser for supported MIME types\r\n * @param forceDownload force the system to download the image even if a successCallback is provided\r\n */\r\nexport function CreateScreenshot(\r\n engine: Engine,\r\n camera: Camera,\r\n size: IScreenshotSize | number,\r\n successCallback?: (data: string) => void,\r\n mimeType: string = \"image/png\",\r\n forceDownload = false\r\n): void {\r\n const { height, width } = _GetScreenshotSize(engine, camera, size);\r\n\r\n if (!(height && width)) {\r\n Logger.Error(\"Invalid 'size' parameter !\");\r\n return;\r\n }\r\n\r\n if (!screenshotCanvas) {\r\n screenshotCanvas = document.createElement(\"canvas\");\r\n }\r\n\r\n screenshotCanvas.width = width;\r\n screenshotCanvas.height = height;\r\n\r\n const renderContext = screenshotCanvas.getContext(\"2d\");\r\n\r\n const ratio = engine.getRenderWidth() / engine.getRenderHeight();\r\n let newWidth = width;\r\n let newHeight = newWidth / ratio;\r\n if (newHeight > height) {\r\n newHeight = height;\r\n newWidth = newHeight * ratio;\r\n }\r\n\r\n const offsetX = Math.max(0, width - newWidth) / 2;\r\n const offsetY = Math.max(0, height - newHeight) / 2;\r\n\r\n const scene = camera.getScene();\r\n if (scene.activeCamera !== camera) {\r\n CreateScreenshotUsingRenderTarget(\r\n engine,\r\n camera,\r\n size,\r\n (data) => {\r\n if (forceDownload) {\r\n const blob = new Blob([data]);\r\n Tools.DownloadBlob(blob);\r\n if (successCallback) {\r\n successCallback(\"\");\r\n }\r\n } else if (successCallback) {\r\n successCallback(data);\r\n }\r\n },\r\n mimeType,\r\n 1,\r\n engine.getCreationOptions().antialias\r\n );\r\n } else {\r\n engine.onEndFrameObservable.addOnce(() => {\r\n const renderingCanvas = engine.getRenderingCanvas();\r\n if (renderContext && renderingCanvas) {\r\n renderContext.drawImage(renderingCanvas, offsetX, offsetY, newWidth, newHeight);\r\n }\r\n\r\n if (screenshotCanvas) {\r\n if (forceDownload) {\r\n Tools.EncodeScreenshotCanvasData(screenshotCanvas, undefined, mimeType);\r\n if (successCallback) {\r\n successCallback(\"\");\r\n }\r\n } else {\r\n Tools.EncodeScreenshotCanvasData(screenshotCanvas, successCallback, mimeType);\r\n }\r\n }\r\n });\r\n }\r\n}\r\n\r\n/**\r\n * Captures a screenshot of the current rendering\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/scene/renderToPNG\r\n * @param engine defines the rendering engine\r\n * @param camera defines the source camera\r\n * @param size This parameter can be set to a single number or to an object with the\r\n * following (optional) properties: precision, width, height. If a single number is passed,\r\n * it will be used for both width and height. If an object is passed, the screenshot size\r\n * will be derived from the parameters. The precision property is a multiplier allowing\r\n * rendering at a higher or lower resolution\r\n * @param mimeType defines the MIME type of the screenshot image (default: image/png).\r\n * Check your browser for supported MIME types\r\n * @returns screenshot as a string of base64-encoded characters. This string can be assigned\r\n * to the src parameter of an <img> to display it\r\n */\r\nexport function CreateScreenshotAsync(engine: Engine, camera: Camera, size: IScreenshotSize | number, mimeType: string = \"image/png\"): Promise<string> {\r\n return new Promise((resolve, reject) => {\r\n CreateScreenshot(\r\n engine,\r\n camera,\r\n size,\r\n (data) => {\r\n if (typeof data !== \"undefined\") {\r\n resolve(data);\r\n } else {\r\n reject(new Error(\"Data is undefined\"));\r\n }\r\n },\r\n mimeType\r\n );\r\n });\r\n}\r\n\r\n/**\r\n * Captures a screenshot of the current rendering for a specific size. This will render the entire canvas but will generate a blink (due to canvas resize)\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/scene/renderToPNG\r\n * @param engine defines the rendering engine\r\n * @param camera defines the source camera\r\n * @param width defines the expected width\r\n * @param height defines the expected height\r\n * @param mimeType defines the MIME type of the screenshot image (default: image/png).\r\n * Check your browser for supported MIME types\r\n * @returns screenshot as a string of base64-encoded characters. This string can be assigned\r\n * to the src parameter of an <img> to display it\r\n */\r\nexport function CreateScreenshotWithResizeAsync(engine: Engine, camera: Camera, width: number, height: number, mimeType: string = \"image/png\"): Promise<void> {\r\n return new Promise((resolve) => {\r\n CreateScreenshot(\r\n engine,\r\n camera,\r\n { width: width, height: height },\r\n () => {\r\n resolve();\r\n },\r\n mimeType,\r\n true\r\n );\r\n });\r\n}\r\n\r\n/**\r\n * Generates an image screenshot from the specified camera.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/scene/renderToPNG\r\n * @param engine The engine to use for rendering\r\n * @param camera The camera to use for rendering\r\n * @param size This parameter can be set to a single number or to an object with the\r\n * following (optional) properties: precision, width, height, finalWidth, finalHeight. If a single number is passed,\r\n * it will be used for both width and height, as well as finalWidth, finalHeight. If an object is passed, the screenshot size\r\n * will be derived from the parameters. The precision property is a multiplier allowing\r\n * rendering at a higher or lower resolution\r\n * @param successCallback The callback receives a single parameter which contains the\r\n * screenshot as a string of base64-encoded characters. This string can be assigned to the\r\n * src parameter of an <img> to display it\r\n * @param mimeType The MIME type of the screenshot image (default: image/png).\r\n * Check your browser for supported MIME types\r\n * @param samples Texture samples (default: 1)\r\n * @param antialiasing Whether antialiasing should be turned on or not (default: false)\r\n * @param fileName A name for for the downloaded file.\r\n * @param renderSprites Whether the sprites should be rendered or not (default: false)\r\n * @param enableStencilBuffer Whether the stencil buffer should be enabled or not (default: false)\r\n * @param useLayerMask if the camera's layer mask should be used to filter what should be rendered (default: true)\r\n */\r\nexport function CreateScreenshotUsingRenderTarget(\r\n engine: Engine,\r\n camera: Camera,\r\n size: IScreenshotSize | number,\r\n successCallback?: (data: string) => void,\r\n mimeType: string = \"image/png\",\r\n samples: number = 1,\r\n antialiasing: boolean = false,\r\n fileName?: string,\r\n renderSprites: boolean = false,\r\n enableStencilBuffer: boolean = false,\r\n useLayerMask: boolean = true\r\n): void {\r\n const { height, width, finalWidth, finalHeight } = _GetScreenshotSize(engine, camera, size);\r\n const targetTextureSize = { width, height };\r\n\r\n if (!(height && width)) {\r\n Logger.Error(\"Invalid 'size' parameter !\");\r\n return;\r\n }\r\n\r\n const originalSize = { width: engine.getRenderWidth(), height: engine.getRenderHeight() };\r\n engine.setSize(width, height); // we need this call to trigger onResizeObservable with the screenshot width/height on all the subsystems that are observing this event and that needs to (re)create some resources with the right dimensions\r\n\r\n const scene = camera.getScene();\r\n\r\n // At this point size can be a number, or an object (according to engine.prototype.createRenderTargetTexture method)\r\n const texture = new RenderTargetTexture(\r\n \"screenShot\",\r\n targetTextureSize,\r\n scene,\r\n false,\r\n false,\r\n Constants.TEXTURETYPE_UNSIGNED_INT,\r\n false,\r\n Texture.BILINEAR_SAMPLINGMODE,\r\n undefined,\r\n enableStencilBuffer,\r\n undefined,\r\n undefined,\r\n undefined,\r\n samples\r\n );\r\n texture.renderList = scene.meshes.slice();\r\n texture.samples = samples;\r\n texture.renderSprites = renderSprites;\r\n texture.activeCamera = camera;\r\n texture.forceLayerMaskCheck = useLayerMask;\r\n\r\n const renderToTexture = () => {\r\n engine.onEndFrameObservable.addOnce(() => {\r\n if (finalWidth === width && finalHeight === height) {\r\n texture.readPixels(undefined, undefined, undefined, false)!.then((data) => {\r\n DumpTools.DumpData(width, height, data, successCallback as (data: string | ArrayBuffer) => void, mimeType, fileName, true);\r\n texture.dispose();\r\n });\r\n } else {\r\n ApplyPostProcess(\"pass\", texture.getInternalTexture()!, scene, undefined, undefined, undefined, finalWidth, finalHeight).then((texture) => {\r\n engine._readTexturePixels(texture, finalWidth, finalHeight, -1, 0, null, true, false, 0, 0).then((data) => {\r\n DumpTools.DumpData(finalWidth, finalHeight, data, successCallback as (data: string | ArrayBuffer) => void, mimeType, fileName, true);\r\n texture.dispose();\r\n });\r\n });\r\n }\r\n });\r\n\r\n // render the RTT\r\n scene.incrementRenderId();\r\n scene.resetCachedMaterial();\r\n texture.render(true);\r\n\r\n // re-render the scene after the camera has been reset to the original camera to avoid a flicker that could occur\r\n // if the camera used for the RTT rendering stays in effect for the next frame (and if that camera was different from the original camera)\r\n scene.incrementRenderId();\r\n scene.resetCachedMaterial();\r\n engine.setSize(originalSize.width, originalSize.height);\r\n camera.getProjectionMatrix(true); // Force cache refresh;\r\n scene.render();\r\n };\r\n\r\n if (antialiasing) {\r\n const fxaaPostProcess = new FxaaPostProcess(\"antialiasing\", 1.0, scene.activeCamera);\r\n texture.addPostProcess(fxaaPostProcess);\r\n // Async Shader Compilation can lead to none ready effects in synchronous code\r\n if (!fxaaPostProcess.getEffect().isReady()) {\r\n fxaaPostProcess.getEffect().onCompiled = () => {\r\n renderToTexture();\r\n };\r\n }\r\n // The effect is ready we can render\r\n else {\r\n renderToTexture();\r\n }\r\n } else {\r\n // No need to wait for extra resources to be ready\r\n renderToTexture();\r\n }\r\n}\r\n\r\n/**\r\n * Generates an image screenshot from the specified camera.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/scene/renderToPNG\r\n * @param engine The engine to use for rendering\r\n * @param camera The camera to use for rendering\r\n * @param size This parameter can be set to a single number or to an object with the\r\n * following (optional) properties: precision, width, height. If a single number is passed,\r\n * it will be used for both width and height. If an object is passed, the screenshot size\r\n * will be derived from the parameters. The precision property is a multiplier allowing\r\n * rendering at a higher or lower resolution\r\n * @param mimeType The MIME type of the screenshot image (default: image/png).\r\n * Check your browser for supported MIME types\r\n * @param samples Texture samples (default: 1)\r\n * @param antialiasing Whether antialiasing should be turned on or not (default: false)\r\n * @param fileName A name for for the downloaded file.\r\n * @param renderSprites Whether the sprites should be rendered or not (default: false)\r\n * @param enableStencilBuffer Whether the stencil buffer should be enabled or not (default: false)\r\n * @param useLayerMask if the camera's layer mask should be used to filter what should be rendered (default: true)\r\n * @returns screenshot as a string of base64-encoded characters. This string can be assigned\r\n * to the src parameter of an <img> to display it\r\n */\r\nexport function CreateScreenshotUsingRenderTargetAsync(\r\n engine: Engine,\r\n camera: Camera,\r\n size: IScreenshotSize | number,\r\n mimeType: string = \"image/png\",\r\n samples: number = 1,\r\n antialiasing: boolean = false,\r\n fileName?: string,\r\n renderSprites: boolean = false,\r\n enableStencilBuffer: boolean = false,\r\n useLayerMask: boolean = true\r\n): Promise<string> {\r\n return new Promise((resolve, reject) => {\r\n CreateScreenshotUsingRenderTarget(\r\n engine,\r\n camera,\r\n size,\r\n (data) => {\r\n if (typeof data !== \"undefined\") {\r\n resolve(data);\r\n } else {\r\n reject(new Error(\"Data is undefined\"));\r\n }\r\n },\r\n mimeType,\r\n samples,\r\n antialiasing,\r\n fileName,\r\n renderSprites,\r\n enableStencilBuffer,\r\n useLayerMask\r\n );\r\n });\r\n}\r\n\r\n/**\r\n * Gets height and width for screenshot size\r\n * @param engine\r\n * @param camera\r\n * @param size\r\n * @private\r\n */\r\nfunction _GetScreenshotSize(engine: Engine, camera: Camera, size: IScreenshotSize | number): { height: number; width: number; finalWidth: number; finalHeight: number } {\r\n let height = 0;\r\n let width = 0;\r\n let finalWidth = 0;\r\n let finalHeight = 0;\r\n\r\n //If a size value defined as object\r\n if (typeof size === \"object\") {\r\n const precision = size.precision\r\n ? Math.abs(size.precision) // prevent GL_INVALID_VALUE : glViewport: negative width/height\r\n : 1;\r\n\r\n //If a width and height values is specified\r\n if (size.width && size.height) {\r\n height = size.height * precision;\r\n width = size.width * precision;\r\n }\r\n //If passing only width, computing height to keep display canvas ratio.\r\n else if (size.width && !size.height) {\r\n width = size.width * precision;\r\n height = Math.round(width / engine.getAspectRatio(camera));\r\n }\r\n //If passing only height, computing width to keep display canvas ratio.\r\n else if (size.height && !size.width) {\r\n height = size.height * precision;\r\n width = Math.round(height * engine.getAspectRatio(camera));\r\n } else {\r\n width = Math.round(engine.getRenderWidth() * precision);\r\n height = Math.round(width / engine.getAspectRatio(camera));\r\n }\r\n\r\n //If a finalWidth and finalHeight values is specified\r\n if (size.finalWidth && size.finalHeight) {\r\n finalHeight = size.finalHeight;\r\n finalWidth = size.finalWidth;\r\n }\r\n //If passing only finalWidth, computing finalHeight to keep display canvas ratio.\r\n else if (size.finalWidth && !size.finalHeight) {\r\n finalWidth = size.finalWidth;\r\n finalHeight = Math.round(finalWidth / engine.getAspectRatio(camera));\r\n }\r\n //If passing only finalHeight, computing finalWidth to keep display canvas ratio.\r\n else if (size.finalHeight && !size.finalWidth) {\r\n finalHeight = size.finalHeight;\r\n finalWidth = Math.round(finalHeight * engine.getAspectRatio(camera));\r\n } else {\r\n finalWidth = width;\r\n finalHeight = height;\r\n }\r\n }\r\n //Assuming here that \"size\" parameter is a number\r\n else if (!isNaN(size)) {\r\n height = size;\r\n width = size;\r\n finalWidth = size;\r\n finalHeight = size;\r\n }\r\n\r\n // When creating the image data from the CanvasRenderingContext2D, the width and height is clamped to the size of the _gl context\r\n // On certain GPUs, it seems as if the _gl context truncates to an integer automatically. Therefore, if a user tries to pass the width of their canvas element\r\n // and it happens to be a float (1000.5 x 600.5 px), the engine.readPixels will return a different size array than context.createImageData\r\n // to resolve this, we truncate the floats here to ensure the same size\r\n if (width) {\r\n width = Math.floor(width);\r\n }\r\n if (height) {\r\n height = Math.floor(height);\r\n }\r\n if (finalWidth) {\r\n finalWidth = Math.floor(finalWidth);\r\n }\r\n if (finalHeight) {\r\n finalHeight = Math.floor(finalHeight);\r\n }\r\n\r\n return { height: height | 0, width: width | 0, finalWidth: finalWidth | 0, finalHeight: finalHeight | 0 };\r\n}\r\n\r\n/**\r\n * Class containing a set of static utilities functions for screenshots\r\n */\r\nexport const ScreenshotTools = {\r\n /**\r\n * Captures a screenshot of the current rendering\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/scene/renderToPNG\r\n * @param engine defines the rendering engine\r\n * @param camera defines the source camera\r\n * @param size This parameter can be set to a single number or to an object with the\r\n * following (optional) properties: precision, width, height. If a single number is passed,\r\n * it will be used for both width and height. If an object is passed, the screenshot size\r\n * will be derived from the parameters. The precision property is a multiplier allowing\r\n * rendering at a higher or lower resolution\r\n * @param successCallback defines the callback receives a single parameter which contains the\r\n * screenshot as a string of base64-encoded characters. This string can be assigned to the\r\n * src parameter of an <img> to display it\r\n * @param mimeType defines the MIME type of the screenshot image (default: image/png).\r\n * Check your browser for supported MIME types\r\n * @param forceDownload force the system to download the image even if a successCallback is provided\r\n */\r\n CreateScreenshot,\r\n\r\n /**\r\n * Captures a screenshot of the current rendering\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/scene/renderToPNG\r\n * @param engine defines the rendering engine\r\n * @param camera defines the source camera\r\n * @param size This parameter can be set to a single number or to an object with the\r\n * following (optional) properties: precision, width, height. If a single number is passed,\r\n * it will be used for both width and height. If an object is passed, the screenshot size\r\n * will be derived from the parameters. The precision property is a multiplier allowing\r\n * rendering at a higher or lower resolution\r\n * @param mimeType defines the MIME type of the screenshot image (default: image/png).\r\n * Check your browser for supported MIME types\r\n * @returns screenshot as a string of base64-encoded characters. This string can be assigned\r\n * to the src parameter of an <img> to display it\r\n */\r\n CreateScreenshotAsync,\r\n\r\n /**\r\n * Captures a screenshot of the current rendering for a specific size. This will render the entire canvas but will generate a blink (due to canvas resize)\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/scene/renderToPNG\r\n * @param engine defines the rendering engine\r\n * @param camera defines the source camera\r\n * @param width defines the expected width\r\n * @param height defines the expected height\r\n * @param mimeType defines the MIME type of the screenshot image (default: image/png).\r\n * Check your browser for supported MIME types\r\n * @returns screenshot as a string of base64-encoded characters. This string can be assigned\r\n * to the src parameter of an <img> to display it\r\n */\r\n CreateScreenshotWithResizeAsync,\r\n\r\n /**\r\n * Generates an image screenshot from the specified camera.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/scene/renderToPNG\r\n * @param engine The engine to use for rendering\r\n * @param camera The camera to use for rendering\r\n * @param size This parameter can be set to a single number or to an object with the\r\n * following (optional) properties: precision, width, height. If a single number is passed,\r\n * it will be used for both width and height. If an object is passed, the screenshot size\r\n * will be derived from the parameters. The precision property is a multiplier allowing\r\n * rendering at a higher or lower resolution\r\n * @param successCallback The callback receives a single parameter which contains the\r\n * screenshot as a string of base64-encoded characters. This string can be assigned to the\r\n * src parameter of an <img> to display it\r\n * @param mimeType The MIME type of the screenshot image (default: image/png).\r\n * Check your browser for supported MIME types\r\n * @param samples Texture samples (default: 1)\r\n * @param antialiasing Whether antialiasing should be turned on or not (default: false)\r\n * @param fileName A name for for the downloaded file.\r\n * @param renderSprites Whether the sprites should be rendered or not (default: false)\r\n * @param enableStencilBuffer Whether the stencil buffer should be enabled or not (default: false)\r\n */\r\n CreateScreenshotUsingRenderTarget,\r\n\r\n /**\r\n * Generates an image screenshot from the specified camera.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/scene/renderToPNG\r\n * @param engine The engine to use for rendering\r\n * @param camera The camera to use for rendering\r\n * @param size This parameter can be set to a single number or to an object with the\r\n * following (optional) properties: precision, width, height. If a single number is passed,\r\n * it will be used for both width and height. If an object is passed, the screenshot size\r\n * will be derived from the parameters. The precision property is a multiplier allowing\r\n * rendering at a higher or lower resolution\r\n * @param mimeType The MIME type of the screenshot image (default: image/png).\r\n * Check your browser for supported MIME types\r\n * @param samples Texture samples (default: 1)\r\n * @param antialiasing Whether antialiasing should be turned on or not (default: false)\r\n * @param fileName A name for for the downloaded file.\r\n * @param renderSprites Whether the sprites should be rendered or not (default: false)\r\n * @returns screenshot as a string of base64-encoded characters. This string can be assigned\r\n * to the src parameter of an <img> to display it\r\n */\r\n CreateScreenshotUsingRenderTargetAsync,\r\n};\r\n\r\n/**\r\n * This will be executed automatically for UMD and es5.\r\n * If esm dev wants the side effects to execute they will have to run it manually\r\n * Once we build native modules those need to be exported.\r\n * @internal\r\n */\r\nconst initSideEffects = () => {\r\n // References the dependencies.\r\n Tools.CreateScreenshot = CreateScreenshot;\r\n Tools.CreateScreenshotAsync = CreateScreenshotAsync;\r\n Tools.CreateScreenshotUsingRenderTarget = CreateScreenshotUsingRenderTarget;\r\n Tools.CreateScreenshotUsingRenderTargetAsync = CreateScreenshotUsingRenderTargetAsync;\r\n};\r\n\r\ninitSideEffects();\r\n"]}
|
|
1
|
+
{"version":3,"file":"screenshotTools.js","sourceRoot":"","sources":["../../../../lts/core/generated/Misc/screenshotTools.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAIlD,IAAI,gBAAgB,GAAgC,IAAI,CAAC;AAEzD;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,gBAAgB,CAC5B,MAAc,EACd,MAAc,EACd,IAA8B,EAC9B,eAAwC,EACxC,QAAQ,GAA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KAC/B;IACD,IAAI,UAAU,EAAE;QACZ,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;KACvC;IACD,IAAI,WAAW,EAAE;QACb,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;KACzC;IAED,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,CAAC,EAAE,KAAK,EAAE,KAAK,GAAG,CAAC,EAAE,UAAU,EAAE,UAAU,GAAG,CAAC,EAAE,WAAW,EAAE,WAAW,GAAG,CAAC,EAAE,CAAC;AAC9G,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC3B;;;;;;;;;;;;;;;;;OAiBG;IACH,gBAAgB;IAEhB;;;;;;;;;;;;;;;OAeG;IACH,qBAAqB;IAErB;;;;;;;;;;;;OAYG;IACH,+BAA+B;IAE/B;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,iCAAiC;IAEjC;;;;;;;;;;;;;;;;;;;OAmBG;IACH,sCAAsC;CACzC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,eAAe,GAAG,GAAG,EAAE;IACzB,+BAA+B;IAC/B,KAAK,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;IAC1C,KAAK,CAAC,qBAAqB,GAAG,qBAAqB,CAAC;IACpD,KAAK,CAAC,iCAAiC,GAAG,iCAAiC,CAAC;IAC5E,KAAK,CAAC,sCAAsC,GAAG,sCAAsC,CAAC;AAC1F,CAAC,CAAC;AAEF,eAAe,EAAE,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport type { Camera } from \"../Cameras/camera\";\r\nimport { Texture } from \"../Materials/Textures/texture\";\r\nimport { RenderTargetTexture } from \"../Materials/Textures/renderTargetTexture\";\r\nimport { FxaaPostProcess } from \"../PostProcesses/fxaaPostProcess\";\r\nimport { Constants } from \"../Engines/constants\";\r\nimport { Logger } from \"./logger\";\r\nimport { Tools } from \"./tools\";\r\nimport type { IScreenshotSize } from \"./interfaces/screenshotSize\";\r\nimport { DumpTools } from \"./dumpTools\";\r\nimport type { Nullable } from \"../types\";\r\nimport { ApplyPostProcess } from \"./textureTools\";\r\n\r\nimport type { Engine } from \"../Engines/engine\";\r\n\r\nlet screenshotCanvas: Nullable<HTMLCanvasElement> = null;\r\n\r\n/**\r\n * Captures a screenshot of the current rendering\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/scene/renderToPNG\r\n * @param engine defines the rendering engine\r\n * @param camera defines the source camera\r\n * @param size This parameter can be set to a single number or to an object with the\r\n * following (optional) properties: precision, width, height. If a single number is passed,\r\n * it will be used for both width and height. If an object is passed, the screenshot size\r\n * will be derived from the parameters. The precision property is a multiplier allowing\r\n * rendering at a higher or lower resolution\r\n * @param successCallback defines the callback receives a single parameter which contains the\r\n * screenshot as a string of base64-encoded characters. This string can be assigned to the\r\n * src parameter of an <img> to display it\r\n * @param mimeType defines the MIME type of the screenshot image (default: image/png).\r\n * Check your browser for supported MIME types\r\n * @param forceDownload force the system to download the image even if a successCallback is provided\r\n * @param quality The quality of the image if lossy mimeType is used (e.g. image/jpeg, image/webp). See {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob | HTMLCanvasElement.toBlob()}'s `quality` parameter.\r\n */\r\nexport function CreateScreenshot(\r\n engine: Engine,\r\n camera: Camera,\r\n size: IScreenshotSize | number,\r\n successCallback?: (data: string) => void,\r\n mimeType = \"image/png\",\r\n forceDownload = false,\r\n quality?: number\r\n): void {\r\n const { height, width } = _GetScreenshotSize(engine, camera, size);\r\n\r\n if (!(height && width)) {\r\n Logger.Error(\"Invalid 'size' parameter !\");\r\n return;\r\n }\r\n\r\n if (!screenshotCanvas) {\r\n screenshotCanvas = document.createElement(\"canvas\");\r\n }\r\n\r\n screenshotCanvas.width = width;\r\n screenshotCanvas.height = height;\r\n\r\n const renderContext = screenshotCanvas.getContext(\"2d\");\r\n\r\n const ratio = engine.getRenderWidth() / engine.getRenderHeight();\r\n let newWidth = width;\r\n let newHeight = newWidth / ratio;\r\n if (newHeight > height) {\r\n newHeight = height;\r\n newWidth = newHeight * ratio;\r\n }\r\n\r\n const offsetX = Math.max(0, width - newWidth) / 2;\r\n const offsetY = Math.max(0, height - newHeight) / 2;\r\n\r\n const scene = camera.getScene();\r\n if (scene.activeCamera !== camera) {\r\n CreateScreenshotUsingRenderTarget(\r\n engine,\r\n camera,\r\n size,\r\n (data) => {\r\n if (forceDownload) {\r\n const blob = new Blob([data]);\r\n Tools.DownloadBlob(blob);\r\n if (successCallback) {\r\n successCallback(\"\");\r\n }\r\n } else if (successCallback) {\r\n successCallback(data);\r\n }\r\n },\r\n mimeType,\r\n 1.0,\r\n engine.getCreationOptions().antialias,\r\n undefined,\r\n undefined,\r\n undefined,\r\n undefined,\r\n quality\r\n );\r\n } else {\r\n engine.onEndFrameObservable.addOnce(() => {\r\n const renderingCanvas = engine.getRenderingCanvas();\r\n if (renderContext && renderingCanvas) {\r\n renderContext.drawImage(renderingCanvas, offsetX, offsetY, newWidth, newHeight);\r\n }\r\n\r\n if (screenshotCanvas) {\r\n if (forceDownload) {\r\n Tools.EncodeScreenshotCanvasData(screenshotCanvas, undefined, mimeType, undefined, quality);\r\n if (successCallback) {\r\n successCallback(\"\");\r\n }\r\n } else {\r\n Tools.EncodeScreenshotCanvasData(screenshotCanvas, successCallback, mimeType, undefined, quality);\r\n }\r\n }\r\n });\r\n }\r\n}\r\n\r\n/**\r\n * Captures a screenshot of the current rendering\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/scene/renderToPNG\r\n * @param engine defines the rendering engine\r\n * @param camera defines the source camera\r\n * @param size This parameter can be set to a single number or to an object with the\r\n * following (optional) properties: precision, width, height. If a single number is passed,\r\n * it will be used for both width and height. If an object is passed, the screenshot size\r\n * will be derived from the parameters. The precision property is a multiplier allowing\r\n * rendering at a higher or lower resolution\r\n * @param mimeType defines the MIME type of the screenshot image (default: image/png).\r\n * Check your browser for supported MIME types\r\n * @param quality The quality of the image if lossy mimeType is used (e.g. image/jpeg, image/webp). See {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob | HTMLCanvasElement.toBlob()}'s `quality` parameter.\r\n * @returns screenshot as a string of base64-encoded characters. This string can be assigned\r\n * to the src parameter of an <img> to display it\r\n */\r\nexport function CreateScreenshotAsync(engine: Engine, camera: Camera, size: IScreenshotSize | number, mimeType = \"image/png\", quality?: number): Promise<string> {\r\n return new Promise((resolve, reject) => {\r\n CreateScreenshot(\r\n engine,\r\n camera,\r\n size,\r\n (data) => {\r\n if (typeof data !== \"undefined\") {\r\n resolve(data);\r\n } else {\r\n reject(new Error(\"Data is undefined\"));\r\n }\r\n },\r\n mimeType,\r\n undefined,\r\n quality\r\n );\r\n });\r\n}\r\n\r\n/**\r\n * Captures a screenshot of the current rendering for a specific size. This will render the entire canvas but will generate a blink (due to canvas resize)\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/scene/renderToPNG\r\n * @param engine defines the rendering engine\r\n * @param camera defines the source camera\r\n * @param width defines the expected width\r\n * @param height defines the expected height\r\n * @param mimeType defines the MIME type of the screenshot image (default: image/png).\r\n * Check your browser for supported MIME types\r\n * @param quality The quality of the image if lossy mimeType is used (e.g. image/jpeg, image/webp). See {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob | HTMLCanvasElement.toBlob()}'s `quality` parameter.\r\n * @returns screenshot as a string of base64-encoded characters. This string can be assigned\r\n * to the src parameter of an <img> to display it\r\n */\r\nexport function CreateScreenshotWithResizeAsync(engine: Engine, camera: Camera, width: number, height: number, mimeType = \"image/png\", quality?: number): Promise<void> {\r\n return new Promise((resolve) => {\r\n CreateScreenshot(\r\n engine,\r\n camera,\r\n { width: width, height: height },\r\n () => {\r\n resolve();\r\n },\r\n mimeType,\r\n true,\r\n quality\r\n );\r\n });\r\n}\r\n\r\n/**\r\n * Generates an image screenshot from the specified camera.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/scene/renderToPNG\r\n * @param engine The engine to use for rendering\r\n * @param camera The camera to use for rendering\r\n * @param size This parameter can be set to a single number or to an object with the\r\n * following (optional) properties: precision, width, height, finalWidth, finalHeight. If a single number is passed,\r\n * it will be used for both width and height, as well as finalWidth, finalHeight. If an object is passed, the screenshot size\r\n * will be derived from the parameters. The precision property is a multiplier allowing\r\n * rendering at a higher or lower resolution\r\n * @param successCallback The callback receives a single parameter which contains the\r\n * screenshot as a string of base64-encoded characters. This string can be assigned to the\r\n * src parameter of an <img> to display it\r\n * @param mimeType The MIME type of the screenshot image (default: image/png).\r\n * Check your browser for supported MIME types\r\n * @param samples Texture samples (default: 1)\r\n * @param antialiasing Whether antialiasing should be turned on or not (default: false)\r\n * @param fileName A name for for the downloaded file.\r\n * @param renderSprites Whether the sprites should be rendered or not (default: false)\r\n * @param enableStencilBuffer Whether the stencil buffer should be enabled or not (default: false)\r\n * @param useLayerMask if the camera's layer mask should be used to filter what should be rendered (default: true)\r\n * @param quality The quality of the image if lossy mimeType is used (e.g. image/jpeg, image/webp). See {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob | HTMLCanvasElement.toBlob()}'s `quality` parameter.\r\n */\r\nexport function CreateScreenshotUsingRenderTarget(\r\n engine: Engine,\r\n camera: Camera,\r\n size: IScreenshotSize | number,\r\n successCallback?: (data: string) => void,\r\n mimeType = \"image/png\",\r\n samples = 1,\r\n antialiasing = false,\r\n fileName?: string,\r\n renderSprites = false,\r\n enableStencilBuffer = false,\r\n useLayerMask = true,\r\n quality?: number\r\n): void {\r\n const { height, width, finalWidth, finalHeight } = _GetScreenshotSize(engine, camera, size);\r\n const targetTextureSize = { width, height };\r\n\r\n if (!(height && width)) {\r\n Logger.Error(\"Invalid 'size' parameter !\");\r\n return;\r\n }\r\n\r\n const originalSize = { width: engine.getRenderWidth(), height: engine.getRenderHeight() };\r\n engine.setSize(width, height); // we need this call to trigger onResizeObservable with the screenshot width/height on all the subsystems that are observing this event and that needs to (re)create some resources with the right dimensions\r\n\r\n const scene = camera.getScene();\r\n\r\n // At this point size can be a number, or an object (according to engine.prototype.createRenderTargetTexture method)\r\n const texture = new RenderTargetTexture(\r\n \"screenShot\",\r\n targetTextureSize,\r\n scene,\r\n false,\r\n false,\r\n Constants.TEXTURETYPE_UNSIGNED_INT,\r\n false,\r\n Texture.BILINEAR_SAMPLINGMODE,\r\n undefined,\r\n enableStencilBuffer,\r\n undefined,\r\n undefined,\r\n undefined,\r\n samples\r\n );\r\n texture.renderList = scene.meshes.slice();\r\n texture.samples = samples;\r\n texture.renderSprites = renderSprites;\r\n texture.activeCamera = camera;\r\n texture.forceLayerMaskCheck = useLayerMask;\r\n\r\n const renderToTexture = () => {\r\n engine.onEndFrameObservable.addOnce(() => {\r\n if (finalWidth === width && finalHeight === height) {\r\n texture.readPixels(undefined, undefined, undefined, false)!.then((data) => {\r\n DumpTools.DumpData(width, height, data, successCallback as (data: string | ArrayBuffer) => void, mimeType, fileName, true, undefined, quality);\r\n texture.dispose();\r\n });\r\n } else {\r\n ApplyPostProcess(\"pass\", texture.getInternalTexture()!, scene, undefined, undefined, undefined, finalWidth, finalHeight).then((texture) => {\r\n engine._readTexturePixels(texture, finalWidth, finalHeight, -1, 0, null, true, false, 0, 0).then((data) => {\r\n DumpTools.DumpData(finalWidth, finalHeight, data, successCallback as (data: string | ArrayBuffer) => void, mimeType, fileName, true, undefined, quality);\r\n texture.dispose();\r\n });\r\n });\r\n }\r\n });\r\n\r\n // render the RTT\r\n scene.incrementRenderId();\r\n scene.resetCachedMaterial();\r\n texture.render(true);\r\n\r\n // re-render the scene after the camera has been reset to the original camera to avoid a flicker that could occur\r\n // if the camera used for the RTT rendering stays in effect for the next frame (and if that camera was different from the original camera)\r\n scene.incrementRenderId();\r\n scene.resetCachedMaterial();\r\n engine.setSize(originalSize.width, originalSize.height);\r\n camera.getProjectionMatrix(true); // Force cache refresh;\r\n scene.render();\r\n };\r\n\r\n if (antialiasing) {\r\n const fxaaPostProcess = new FxaaPostProcess(\"antialiasing\", 1.0, scene.activeCamera);\r\n texture.addPostProcess(fxaaPostProcess);\r\n // Async Shader Compilation can lead to none ready effects in synchronous code\r\n if (!fxaaPostProcess.getEffect().isReady()) {\r\n fxaaPostProcess.getEffect().onCompiled = () => {\r\n renderToTexture();\r\n };\r\n }\r\n // The effect is ready we can render\r\n else {\r\n renderToTexture();\r\n }\r\n } else {\r\n // No need to wait for extra resources to be ready\r\n renderToTexture();\r\n }\r\n}\r\n\r\n/**\r\n * Generates an image screenshot from the specified camera.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/scene/renderToPNG\r\n * @param engine The engine to use for rendering\r\n * @param camera The camera to use for rendering\r\n * @param size This parameter can be set to a single number or to an object with the\r\n * following (optional) properties: precision, width, height. If a single number is passed,\r\n * it will be used for both width and height. If an object is passed, the screenshot size\r\n * will be derived from the parameters. The precision property is a multiplier allowing\r\n * rendering at a higher or lower resolution\r\n * @param mimeType The MIME type of the screenshot image (default: image/png).\r\n * Check your browser for supported MIME types\r\n * @param samples Texture samples (default: 1)\r\n * @param antialiasing Whether antialiasing should be turned on or not (default: false)\r\n * @param fileName A name for for the downloaded file.\r\n * @param renderSprites Whether the sprites should be rendered or not (default: false)\r\n * @param enableStencilBuffer Whether the stencil buffer should be enabled or not (default: false)\r\n * @param useLayerMask if the camera's layer mask should be used to filter what should be rendered (default: true)\r\n * @param quality The quality of the image if lossy mimeType is used (e.g. image/jpeg, image/webp). See {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob | HTMLCanvasElement.toBlob()}'s `quality` parameter.\r\n * @returns screenshot as a string of base64-encoded characters. This string can be assigned\r\n * to the src parameter of an <img> to display it\r\n */\r\nexport function CreateScreenshotUsingRenderTargetAsync(\r\n engine: Engine,\r\n camera: Camera,\r\n size: IScreenshotSize | number,\r\n mimeType = \"image/png\",\r\n samples = 1,\r\n antialiasing = false,\r\n fileName?: string,\r\n renderSprites = false,\r\n enableStencilBuffer = false,\r\n useLayerMask = true,\r\n quality?: number\r\n): Promise<string> {\r\n return new Promise((resolve, reject) => {\r\n CreateScreenshotUsingRenderTarget(\r\n engine,\r\n camera,\r\n size,\r\n (data) => {\r\n if (typeof data !== \"undefined\") {\r\n resolve(data);\r\n } else {\r\n reject(new Error(\"Data is undefined\"));\r\n }\r\n },\r\n mimeType,\r\n samples,\r\n antialiasing,\r\n fileName,\r\n renderSprites,\r\n enableStencilBuffer,\r\n useLayerMask,\r\n quality\r\n );\r\n });\r\n}\r\n\r\n/**\r\n * Gets height and width for screenshot size\r\n * @param engine\r\n * @param camera\r\n * @param size\r\n * @private\r\n */\r\nfunction _GetScreenshotSize(engine: Engine, camera: Camera, size: IScreenshotSize | number): { height: number; width: number; finalWidth: number; finalHeight: number } {\r\n let height = 0;\r\n let width = 0;\r\n let finalWidth = 0;\r\n let finalHeight = 0;\r\n\r\n //If a size value defined as object\r\n if (typeof size === \"object\") {\r\n const precision = size.precision\r\n ? Math.abs(size.precision) // prevent GL_INVALID_VALUE : glViewport: negative width/height\r\n : 1;\r\n\r\n //If a width and height values is specified\r\n if (size.width && size.height) {\r\n height = size.height * precision;\r\n width = size.width * precision;\r\n }\r\n //If passing only width, computing height to keep display canvas ratio.\r\n else if (size.width && !size.height) {\r\n width = size.width * precision;\r\n height = Math.round(width / engine.getAspectRatio(camera));\r\n }\r\n //If passing only height, computing width to keep display canvas ratio.\r\n else if (size.height && !size.width) {\r\n height = size.height * precision;\r\n width = Math.round(height * engine.getAspectRatio(camera));\r\n } else {\r\n width = Math.round(engine.getRenderWidth() * precision);\r\n height = Math.round(width / engine.getAspectRatio(camera));\r\n }\r\n\r\n //If a finalWidth and finalHeight values is specified\r\n if (size.finalWidth && size.finalHeight) {\r\n finalHeight = size.finalHeight;\r\n finalWidth = size.finalWidth;\r\n }\r\n //If passing only finalWidth, computing finalHeight to keep display canvas ratio.\r\n else if (size.finalWidth && !size.finalHeight) {\r\n finalWidth = size.finalWidth;\r\n finalHeight = Math.round(finalWidth / engine.getAspectRatio(camera));\r\n }\r\n //If passing only finalHeight, computing finalWidth to keep display canvas ratio.\r\n else if (size.finalHeight && !size.finalWidth) {\r\n finalHeight = size.finalHeight;\r\n finalWidth = Math.round(finalHeight * engine.getAspectRatio(camera));\r\n } else {\r\n finalWidth = width;\r\n finalHeight = height;\r\n }\r\n }\r\n //Assuming here that \"size\" parameter is a number\r\n else if (!isNaN(size)) {\r\n height = size;\r\n width = size;\r\n finalWidth = size;\r\n finalHeight = size;\r\n }\r\n\r\n // When creating the image data from the CanvasRenderingContext2D, the width and height is clamped to the size of the _gl context\r\n // On certain GPUs, it seems as if the _gl context truncates to an integer automatically. Therefore, if a user tries to pass the width of their canvas element\r\n // and it happens to be a float (1000.5 x 600.5 px), the engine.readPixels will return a different size array than context.createImageData\r\n // to resolve this, we truncate the floats here to ensure the same size\r\n if (width) {\r\n width = Math.floor(width);\r\n }\r\n if (height) {\r\n height = Math.floor(height);\r\n }\r\n if (finalWidth) {\r\n finalWidth = Math.floor(finalWidth);\r\n }\r\n if (finalHeight) {\r\n finalHeight = Math.floor(finalHeight);\r\n }\r\n\r\n return { height: height | 0, width: width | 0, finalWidth: finalWidth | 0, finalHeight: finalHeight | 0 };\r\n}\r\n\r\n/**\r\n * Class containing a set of static utilities functions for screenshots\r\n */\r\nexport const ScreenshotTools = {\r\n /**\r\n * Captures a screenshot of the current rendering\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/scene/renderToPNG\r\n * @param engine defines the rendering engine\r\n * @param camera defines the source camera\r\n * @param size This parameter can be set to a single number or to an object with the\r\n * following (optional) properties: precision, width, height. If a single number is passed,\r\n * it will be used for both width and height. If an object is passed, the screenshot size\r\n * will be derived from the parameters. The precision property is a multiplier allowing\r\n * rendering at a higher or lower resolution\r\n * @param successCallback defines the callback receives a single parameter which contains the\r\n * screenshot as a string of base64-encoded characters. This string can be assigned to the\r\n * src parameter of an <img> to display it\r\n * @param mimeType defines the MIME type of the screenshot image (default: image/png).\r\n * Check your browser for supported MIME types\r\n * @param forceDownload force the system to download the image even if a successCallback is provided\r\n * @param quality The quality of the image if lossy mimeType is used (e.g. image/jpeg, image/webp). See {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob | HTMLCanvasElement.toBlob()}'s `quality` parameter.\r\n */\r\n CreateScreenshot,\r\n\r\n /**\r\n * Captures a screenshot of the current rendering\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/scene/renderToPNG\r\n * @param engine defines the rendering engine\r\n * @param camera defines the source camera\r\n * @param size This parameter can be set to a single number or to an object with the\r\n * following (optional) properties: precision, width, height. If a single number is passed,\r\n * it will be used for both width and height. If an object is passed, the screenshot size\r\n * will be derived from the parameters. The precision property is a multiplier allowing\r\n * rendering at a higher or lower resolution\r\n * @param mimeType defines the MIME type of the screenshot image (default: image/png).\r\n * Check your browser for supported MIME types\r\n * @param quality The quality of the image if lossy mimeType is used (e.g. image/jpeg, image/webp). See {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob | HTMLCanvasElement.toBlob()}'s `quality` parameter.\r\n * @returns screenshot as a string of base64-encoded characters. This string can be assigned\r\n * to the src parameter of an <img> to display it\r\n */\r\n CreateScreenshotAsync,\r\n\r\n /**\r\n * Captures a screenshot of the current rendering for a specific size. This will render the entire canvas but will generate a blink (due to canvas resize)\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/scene/renderToPNG\r\n * @param engine defines the rendering engine\r\n * @param camera defines the source camera\r\n * @param width defines the expected width\r\n * @param height defines the expected height\r\n * @param mimeType defines the MIME type of the screenshot image (default: image/png).\r\n * Check your browser for supported MIME types\r\n * @param quality The quality of the image if lossy mimeType is used (e.g. image/jpeg, image/webp). See {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob | HTMLCanvasElement.toBlob()}'s `quality` parameter.\r\n * @returns screenshot as a string of base64-encoded characters. This string can be assigned\r\n * to the src parameter of an <img> to display it\r\n */\r\n CreateScreenshotWithResizeAsync,\r\n\r\n /**\r\n * Generates an image screenshot from the specified camera.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/scene/renderToPNG\r\n * @param engine The engine to use for rendering\r\n * @param camera The camera to use for rendering\r\n * @param size This parameter can be set to a single number or to an object with the\r\n * following (optional) properties: precision, width, height. If a single number is passed,\r\n * it will be used for both width and height. If an object is passed, the screenshot size\r\n * will be derived from the parameters. The precision property is a multiplier allowing\r\n * rendering at a higher or lower resolution\r\n * @param successCallback The callback receives a single parameter which contains the\r\n * screenshot as a string of base64-encoded characters. This string can be assigned to the\r\n * src parameter of an <img> to display it\r\n * @param mimeType The MIME type of the screenshot image (default: image/png).\r\n * Check your browser for supported MIME types\r\n * @param samples Texture samples (default: 1)\r\n * @param antialiasing Whether antialiasing should be turned on or not (default: false)\r\n * @param fileName A name for for the downloaded file.\r\n * @param renderSprites Whether the sprites should be rendered or not (default: false)\r\n * @param enableStencilBuffer Whether the stencil buffer should be enabled or not (default: false)\r\n * @param quality The quality of the image if lossy mimeType is used (e.g. image/jpeg, image/webp). See {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob | HTMLCanvasElement.toBlob()}'s `quality` parameter.\r\n */\r\n CreateScreenshotUsingRenderTarget,\r\n\r\n /**\r\n * Generates an image screenshot from the specified camera.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/scene/renderToPNG\r\n * @param engine The engine to use for rendering\r\n * @param camera The camera to use for rendering\r\n * @param size This parameter can be set to a single number or to an object with the\r\n * following (optional) properties: precision, width, height. If a single number is passed,\r\n * it will be used for both width and height. If an object is passed, the screenshot size\r\n * will be derived from the parameters. The precision property is a multiplier allowing\r\n * rendering at a higher or lower resolution\r\n * @param mimeType The MIME type of the screenshot image (default: image/png).\r\n * Check your browser for supported MIME types\r\n * @param samples Texture samples (default: 1)\r\n * @param antialiasing Whether antialiasing should be turned on or not (default: false)\r\n * @param fileName A name for for the downloaded file.\r\n * @param renderSprites Whether the sprites should be rendered or not (default: false)\r\n * @param quality The quality of the image if lossy mimeType is used (e.g. image/jpeg, image/webp). See {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob | HTMLCanvasElement.toBlob()}'s `quality` parameter.\r\n * @returns screenshot as a string of base64-encoded characters. This string can be assigned\r\n * to the src parameter of an <img> to display it\r\n */\r\n CreateScreenshotUsingRenderTargetAsync,\r\n};\r\n\r\n/**\r\n * This will be executed automatically for UMD and es5.\r\n * If esm dev wants the side effects to execute they will have to run it manually\r\n * Once we build native modules those need to be exported.\r\n * @internal\r\n */\r\nconst initSideEffects = () => {\r\n // References the dependencies.\r\n Tools.CreateScreenshot = CreateScreenshot;\r\n Tools.CreateScreenshotAsync = CreateScreenshotAsync;\r\n Tools.CreateScreenshotUsingRenderTarget = CreateScreenshotUsingRenderTarget;\r\n Tools.CreateScreenshotUsingRenderTargetAsync = CreateScreenshotUsingRenderTargetAsync;\r\n};\r\n\r\ninitSideEffects();\r\n"]}
|
package/Misc/smartArray.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"smartArray.js","sourceRoot":"","sources":["../../../../lts/core/generated/Misc/smartArray.ts"],"names":[],"mappings":"AAeA;;GAEG;AACH,MAAM,OAAO,UAAU;IAanB;;;OAGG;IACH,YAAY,QAAgB;QAX5B;;WAEG;QACI,WAAM,GAAW,CAAC,CAAC;QAStB,IAAI,CAAC,IAAI,GAAG,IAAI,KAAK,CAAC,QAAQ,CAAC,CAAC;QAChC,IAAI,CAAC,GAAG,GAAG,UAAU,CAAC,SAAS,EAAE,CAAC;IACtC,CAAC;IAED;;;OAGG;IACI,IAAI,CAAC,KAAQ;QAChB,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,GAAG,KAAK,CAAC;QAEjC,IAAI,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;YAChC,IAAI,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,C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AAC,IAAI,IAAI,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC;YAC1C,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;SAC9B;IACL,CAAC;CACJ","sourcesContent":["/**\r\n * Defines an array and its length.\r\n * It can be helpful to group result from both Arrays and smart arrays in one structure.\r\n */\r\nexport interface ISmartArrayLike<T> {\r\n /**\r\n * The data of the array.\r\n */\r\n data: Array<T>;\r\n /**\r\n * The active length of the array.\r\n */\r\n length: number;\r\n}\r\n\r\n/**\r\n * Defines an GC Friendly array where the backfield array do not shrink to prevent over allocations.\r\n */\r\nexport class SmartArray<T> implements ISmartArrayLike<T> {\r\n /**\r\n * The full set of data from the array.\r\n */\r\n public data: Array<T>;\r\n\r\n /**\r\n * The active length of the array.\r\n */\r\n public length: number = 0;\r\n\r\n protected _id: number;\r\n\r\n /**\r\n * Instantiates a Smart Array.\r\n * @param capacity defines the default capacity of the array.\r\n */\r\n constructor(capacity: number) {\r\n this.data = new Array(capacity);\r\n this._id = SmartArray._GlobalId++;\r\n }\r\n\r\n /**\r\n * Pushes a value at the end of the active data.\r\n * @param value defines the object to push in the array.\r\n */\r\n public push(value: T): void {\r\n this.data[this.length++] = value;\r\n\r\n if (this.length > this.data.length) {\r\n this.data.length *= 2;\r\n }\r\n }\r\n\r\n /**\r\n * Iterates over the active data and apply the lambda to them.\r\n * @param func defines the action to apply on each value.\r\n */\r\n public forEach(func: (content: T) => void): void {\r\n for (let index = 0; index < this.length; index++) {\r\n func(this.data[index]);\r\n }\r\n }\r\n\r\n /**\r\n * Sorts the full sets of data.\r\n * @param compareFn defines the comparison function to apply.\r\n */\r\n public sort(compareFn: (a: T, b: T) => number): void {\r\n this.data.sort(compareFn);\r\n }\r\n\r\n /**\r\n * Resets the active data to an empty array.\r\n */\r\n public reset(): void {\r\n this.length = 0;\r\n }\r\n\r\n /**\r\n * Releases all the data from the array as well as the array.\r\n */\r\n public dispose(): void {\r\n this.reset();\r\n\r\n if (this.data) {\r\n this.data.length = 0;\r\n }\r\n }\r\n\r\n /**\r\n * Concats the active data with a given array.\r\n * @param array defines the data to concatenate with.\r\n */\r\n public concat(array: any): void {\r\n if (array.length === 0) {\r\n return;\r\n }\r\n if (this.length + array.length > this.data.length) {\r\n this.data.length = (this.length + array.length) * 2;\r\n }\r\n\r\n for (let index = 0; index < array.length; index++) {\r\n this.data[this.length++] = (array.data || array)[index];\r\n }\r\n }\r\n\r\n /**\r\n * Returns the position of a value in the active data.\r\n * @param value defines the value to find the index for\r\n * @returns the index if found in the active data otherwise -1\r\n */\r\n public indexOf(value: T): number {\r\n const position = this.data.indexOf(value);\r\n\r\n if (position >= this.length) {\r\n return -1;\r\n }\r\n\r\n return position;\r\n }\r\n\r\n /**\r\n * Returns whether an element is part of the active data.\r\n * @param value defines the value to look for\r\n * @returns true if found in the active data otherwise false\r\n */\r\n public contains(value: T): boolean {\r\n return this.indexOf(value) !== -1;\r\n }\r\n\r\n // Statics\r\n private static _GlobalId = 0;\r\n}\r\n\r\n/**\r\n * Defines an GC Friendly array where the backfield array do not shrink to prevent over allocations.\r\n * The data in this array can only be present once\r\n */\r\nexport class SmartArrayNoDuplicate<T> extends SmartArray<T> {\r\n private _duplicateId = 0;\r\n\r\n /**\r\n * Pushes a value at the end of the active data.\r\n * THIS DOES NOT PREVENT DUPPLICATE DATA\r\n * @param value defines the object to push in the array.\r\n */\r\n public push(value: T): void {\r\n super.push(value);\r\n\r\n if (!(<any>value).__smartArrayFlags) {\r\n (<any>value).__smartArrayFlags = {};\r\n }\r\n\r\n (<any>value).__smartArrayFlags[this._id] = this._duplicateId;\r\n }\r\n\r\n /**\r\n * Pushes a value at the end of the active data.\r\n * If the data is already present, it won t be added again\r\n * @param value defines the object to push in the array.\r\n * @returns true if added false if it was already present\r\n */\r\n public pushNoDuplicate(value: T): boolean {\r\n if ((<any>value).__smartArrayFlags && (<any>value).__smartArrayFlags[this._id] === this._duplicateId) {\r\n return false;\r\n }\r\n this.push(value);\r\n return true;\r\n }\r\n\r\n /**\r\n * Resets the active data to an empty array.\r\n */\r\n public reset(): void {\r\n super.reset();\r\n this._duplicateId++;\r\n }\r\n\r\n /**\r\n * Concats the active data with a given array.\r\n * This ensures no duplicate will be present in the result.\r\n * @param array defines the data to concatenate with.\r\n */\r\n public concatWithNoDuplicate(array: any): void {\r\n if (array.length === 0) {\r\n return;\r\n }\r\n if (this.length + array.length > this.data.length) {\r\n this.data.length = (this.length + array.length) * 2;\r\n }\r\n\r\n for (let index = 0; index < array.length; index++) {\r\n const item = (array.data || array)[index];\r\n this.pushNoDuplicate(item);\r\n }\r\n }\r\n}\r\n"]}
|
package/Misc/tools.d.ts
CHANGED
|
@@ -304,9 +304,10 @@ export declare class Tools {
|
|
|
304
304
|
* @param successCallback defines the callback triggered once the data are available
|
|
305
305
|
* @param mimeType defines the mime type of the result
|
|
306
306
|
* @param fileName defines the filename to download. If present, the result will automatically be downloaded
|
|
307
|
+
* @param quality The quality of the image if lossy mimeType is used (e.g. image/jpeg, image/webp). See {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob | HTMLCanvasElement.toBlob()}'s `quality` parameter.
|
|
307
308
|
* @returns a void promise
|
|
308
309
|
*/
|
|
309
|
-
static DumpFramebuffer(width: number, height: number, engine: Engine, successCallback?: (data: string) => void, mimeType?: string, fileName?: string): Promise<void>;
|
|
310
|
+
static DumpFramebuffer(width: number, height: number, engine: Engine, successCallback?: (data: string) => void, mimeType?: string, fileName?: string, quality?: number): Promise<void>;
|
|
310
311
|
/**
|
|
311
312
|
* Dumps an array buffer
|
|
312
313
|
* @param width defines the rendering width
|
|
@@ -317,7 +318,7 @@ export declare class Tools {
|
|
|
317
318
|
* @param fileName defines the filename to download. If present, the result will automatically be downloaded
|
|
318
319
|
* @param invertY true to invert the picture in the Y dimension
|
|
319
320
|
* @param toArrayBuffer true to convert the data to an ArrayBuffer (encoded as `mimeType`) instead of a base64 string
|
|
320
|
-
* @param quality
|
|
321
|
+
* @param quality The quality of the image if lossy mimeType is used (e.g. image/jpeg, image/webp). See {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob | HTMLCanvasElement.toBlob()}'s `quality` parameter.
|
|
321
322
|
*/
|
|
322
323
|
static DumpData(width: number, height: number, data: ArrayBufferView, successCallback?: (data: string | ArrayBuffer) => void, mimeType?: string, fileName?: string, invertY?: boolean, toArrayBuffer?: boolean, quality?: number): void;
|
|
323
324
|
/**
|
|
@@ -329,7 +330,7 @@ export declare class Tools {
|
|
|
329
330
|
* @param fileName defines the filename to download. If present, the result will automatically be downloaded
|
|
330
331
|
* @param invertY true to invert the picture in the Y dimension
|
|
331
332
|
* @param toArrayBuffer true to convert the data to an ArrayBuffer (encoded as `mimeType`) instead of a base64 string
|
|
332
|
-
* @param quality
|
|
333
|
+
* @param quality The quality of the image if lossy mimeType is used (e.g. image/jpeg, image/webp). See {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob | HTMLCanvasElement.toBlob()}'s `quality` parameter.
|
|
333
334
|
* @returns a promise that resolve to the final data
|
|
334
335
|
*/
|
|
335
336
|
static DumpDataAsync(width: number, height: number, data: ArrayBufferView, mimeType?: string, fileName?: string, invertY?: boolean, toArrayBuffer?: boolean, quality?: number): Promise<string | ArrayBuffer>;
|
|
@@ -340,7 +341,7 @@ export declare class Tools {
|
|
|
340
341
|
* @param canvas Defines the canvas to extract the data from (can be an offscreen canvas)
|
|
341
342
|
* @param successCallback Defines the callback triggered once the data are available
|
|
342
343
|
* @param mimeType Defines the mime type of the result
|
|
343
|
-
* @param quality
|
|
344
|
+
* @param quality The quality of the image if lossy mimeType is used (e.g. image/jpeg, image/webp). See {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob | HTMLCanvasElement.toBlob()}'s `quality` parameter.
|
|
344
345
|
*/
|
|
345
346
|
static ToBlob(canvas: HTMLCanvasElement | OffscreenCanvas, successCallback: (blob: Nullable<Blob>) => void, mimeType?: string, quality?: number): void;
|
|
346
347
|
/**
|
|
@@ -356,7 +357,7 @@ export declare class Tools {
|
|
|
356
357
|
* @param successCallback The callback which is triggered once the data is available. If `fileName` is defined, the callback will be invoked after the download occurs, and the `data` argument will be an empty string.
|
|
357
358
|
* @param mimeType The mime type of the result.
|
|
358
359
|
* @param fileName The name of the file to download. If defined, the result will automatically be downloaded. If not defined, and `successCallback` is also not defined, the result will automatically be downloaded with an auto-generated file name.
|
|
359
|
-
* @param quality The quality of the
|
|
360
|
+
* @param quality The quality of the image if lossy mimeType is used (e.g. image/jpeg, image/webp). See {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob | HTMLCanvasElement.toBlob()}'s `quality` parameter.
|
|
360
361
|
*/
|
|
361
362
|
static EncodeScreenshotCanvasData(canvas: HTMLCanvasElement | OffscreenCanvas, successCallback?: (data: string) => void, mimeType?: string, fileName?: string, quality?: number): void;
|
|
362
363
|
/**
|
|
@@ -388,8 +389,10 @@ export declare class Tools {
|
|
|
388
389
|
* src parameter of an <img> to display it
|
|
389
390
|
* @param mimeType defines the MIME type of the screenshot image (default: image/png).
|
|
390
391
|
* Check your browser for supported MIME types
|
|
392
|
+
* @param forceDownload force the system to download the image even if a successCallback is provided
|
|
393
|
+
* @param quality The quality of the image if lossy mimeType is used (e.g. image/jpeg, image/webp). See {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob | HTMLCanvasElement.toBlob()}'s `quality` parameter.
|
|
391
394
|
*/
|
|
392
|
-
static CreateScreenshot(engine: Engine, camera: Camera, size: IScreenshotSize | number, successCallback?: (data: string) => void, mimeType?: string): void;
|
|
395
|
+
static CreateScreenshot(engine: Engine, camera: Camera, size: IScreenshotSize | number, successCallback?: (data: string) => void, mimeType?: string, forceDownload?: boolean, quality?: number): void;
|
|
393
396
|
/**
|
|
394
397
|
* Captures a screenshot of the current rendering
|
|
395
398
|
* @see https://doc.babylonjs.com/features/featuresDeepDive/scene/renderToPNG
|
|
@@ -402,10 +405,11 @@ export declare class Tools {
|
|
|
402
405
|
* rendering at a higher or lower resolution
|
|
403
406
|
* @param mimeType defines the MIME type of the screenshot image (default: image/png).
|
|
404
407
|
* Check your browser for supported MIME types
|
|
408
|
+
* @param quality The quality of the image if lossy mimeType is used (e.g. image/jpeg, image/webp). See {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob | HTMLCanvasElement.toBlob()}'s `quality` parameter.
|
|
405
409
|
* @returns screenshot as a string of base64-encoded characters. This string can be assigned
|
|
406
410
|
* to the src parameter of an <img> to display it
|
|
407
411
|
*/
|
|
408
|
-
static CreateScreenshotAsync(engine: Engine, camera: Camera, size: IScreenshotSize | number, mimeType?: string): Promise<string>;
|
|
412
|
+
static CreateScreenshotAsync(engine: Engine, camera: Camera, size: IScreenshotSize | number, mimeType?: string, quality?: number): Promise<string>;
|
|
409
413
|
/**
|
|
410
414
|
* Generates an image screenshot from the specified camera.
|
|
411
415
|
* @see https://doc.babylonjs.com/features/featuresDeepDive/scene/renderToPNG
|
|
@@ -424,8 +428,12 @@ export declare class Tools {
|
|
|
424
428
|
* @param samples Texture samples (default: 1)
|
|
425
429
|
* @param antialiasing Whether antialiasing should be turned on or not (default: false)
|
|
426
430
|
* @param fileName A name for for the downloaded file.
|
|
431
|
+
* @param renderSprites Whether the sprites should be rendered or not (default: false)
|
|
432
|
+
* @param enableStencilBuffer Whether the stencil buffer should be enabled or not (default: false)
|
|
433
|
+
* @param useLayerMask if the camera's layer mask should be used to filter what should be rendered (default: true)
|
|
434
|
+
* @param quality The quality of the image if lossy mimeType is used (e.g. image/jpeg, image/webp). See {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob | HTMLCanvasElement.toBlob()}'s `quality` parameter.
|
|
427
435
|
*/
|
|
428
|
-
static CreateScreenshotUsingRenderTarget(engine: Engine, camera: Camera, size: IScreenshotSize | number, successCallback?: (data: string) => void, mimeType?: string, samples?: number, antialiasing?: boolean, fileName?: string): void;
|
|
436
|
+
static CreateScreenshotUsingRenderTarget(engine: Engine, camera: Camera, size: IScreenshotSize | number, successCallback?: (data: string) => void, mimeType?: string, samples?: number, antialiasing?: boolean, fileName?: string, renderSprites?: boolean, enableStencilBuffer?: boolean, useLayerMask?: boolean, quality?: number): void;
|
|
429
437
|
/**
|
|
430
438
|
* Generates an image screenshot from the specified camera.
|
|
431
439
|
* @see https://doc.babylonjs.com/features/featuresDeepDive/scene/renderToPNG
|
|
@@ -442,9 +450,13 @@ export declare class Tools {
|
|
|
442
450
|
* @param antialiasing Whether antialiasing should be turned on or not (default: false)
|
|
443
451
|
* @param fileName A name for for the downloaded file.
|
|
444
452
|
* @returns screenshot as a string of base64-encoded characters. This string can be assigned
|
|
453
|
+
* @param renderSprites Whether the sprites should be rendered or not (default: false)
|
|
454
|
+
* @param enableStencilBuffer Whether the stencil buffer should be enabled or not (default: false)
|
|
455
|
+
* @param useLayerMask if the camera's layer mask should be used to filter what should be rendered (default: true)
|
|
456
|
+
* @param quality The quality of the image if lossy mimeType is used (e.g. image/jpeg, image/webp). See {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob | HTMLCanvasElement.toBlob()}'s `quality` parameter.
|
|
445
457
|
* to the src parameter of an <img> to display it
|
|
446
458
|
*/
|
|
447
|
-
static CreateScreenshotUsingRenderTargetAsync(engine: Engine, camera: Camera, size: IScreenshotSize | number, mimeType?: string, samples?: number, antialiasing?: boolean, fileName?: string): Promise<string>;
|
|
459
|
+
static CreateScreenshotUsingRenderTargetAsync(engine: Engine, camera: Camera, size: IScreenshotSize | number, mimeType?: string, samples?: number, antialiasing?: boolean, fileName?: string, renderSprites?: boolean, enableStencilBuffer?: boolean, useLayerMask?: boolean, quality?: number): Promise<string>;
|
|
448
460
|
/**
|
|
449
461
|
* Implementation from http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/2117523#answer-2117523
|
|
450
462
|
* Be aware Math.random() could cause collisions, but:
|
package/Misc/tools.js
CHANGED
|
@@ -491,9 +491,10 @@ export class Tools {
|
|
|
491
491
|
* @param successCallback defines the callback triggered once the data are available
|
|
492
492
|
* @param mimeType defines the mime type of the result
|
|
493
493
|
* @param fileName defines the filename to download. If present, the result will automatically be downloaded
|
|
494
|
+
* @param quality The quality of the image if lossy mimeType is used (e.g. image/jpeg, image/webp). See {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob | HTMLCanvasElement.toBlob()}'s `quality` parameter.
|
|
494
495
|
* @returns a void promise
|
|
495
496
|
*/
|
|
496
|
-
static async DumpFramebuffer(width, height, engine, successCallback, mimeType = "image/png", fileName) {
|
|
497
|
+
static async DumpFramebuffer(width, height, engine, successCallback, mimeType = "image/png", fileName, quality) {
|
|
497
498
|
throw _WarnImport("DumpTools");
|
|
498
499
|
}
|
|
499
500
|
/**
|
|
@@ -506,7 +507,7 @@ export class Tools {
|
|
|
506
507
|
* @param fileName defines the filename to download. If present, the result will automatically be downloaded
|
|
507
508
|
* @param invertY true to invert the picture in the Y dimension
|
|
508
509
|
* @param toArrayBuffer true to convert the data to an ArrayBuffer (encoded as `mimeType`) instead of a base64 string
|
|
509
|
-
* @param quality
|
|
510
|
+
* @param quality The quality of the image if lossy mimeType is used (e.g. image/jpeg, image/webp). See {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob | HTMLCanvasElement.toBlob()}'s `quality` parameter.
|
|
510
511
|
*/
|
|
511
512
|
static DumpData(width, height, data, successCallback, mimeType = "image/png", fileName, invertY = false, toArrayBuffer = false, quality) {
|
|
512
513
|
throw _WarnImport("DumpTools");
|
|
@@ -520,7 +521,7 @@ export class Tools {
|
|
|
520
521
|
* @param fileName defines the filename to download. If present, the result will automatically be downloaded
|
|
521
522
|
* @param invertY true to invert the picture in the Y dimension
|
|
522
523
|
* @param toArrayBuffer true to convert the data to an ArrayBuffer (encoded as `mimeType`) instead of a base64 string
|
|
523
|
-
* @param quality
|
|
524
|
+
* @param quality The quality of the image if lossy mimeType is used (e.g. image/jpeg, image/webp). See {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob | HTMLCanvasElement.toBlob()}'s `quality` parameter.
|
|
524
525
|
* @returns a promise that resolve to the final data
|
|
525
526
|
*/
|
|
526
527
|
static DumpDataAsync(width, height, data, mimeType = "image/png", fileName, invertY = false, toArrayBuffer = false, quality) {
|
|
@@ -535,7 +536,7 @@ export class Tools {
|
|
|
535
536
|
* @param canvas Defines the canvas to extract the data from (can be an offscreen canvas)
|
|
536
537
|
* @param successCallback Defines the callback triggered once the data are available
|
|
537
538
|
* @param mimeType Defines the mime type of the result
|
|
538
|
-
* @param quality
|
|
539
|
+
* @param quality The quality of the image if lossy mimeType is used (e.g. image/jpeg, image/webp). See {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob | HTMLCanvasElement.toBlob()}'s `quality` parameter.
|
|
539
540
|
*/
|
|
540
541
|
static ToBlob(canvas, successCallback, mimeType = "image/png", quality) {
|
|
541
542
|
// We need HTMLCanvasElement.toBlob for HD screenshots
|
|
@@ -604,7 +605,7 @@ export class Tools {
|
|
|
604
605
|
* @param successCallback The callback which is triggered once the data is available. If `fileName` is defined, the callback will be invoked after the download occurs, and the `data` argument will be an empty string.
|
|
605
606
|
* @param mimeType The mime type of the result.
|
|
606
607
|
* @param fileName The name of the file to download. If defined, the result will automatically be downloaded. If not defined, and `successCallback` is also not defined, the result will automatically be downloaded with an auto-generated file name.
|
|
607
|
-
* @param quality The quality of the
|
|
608
|
+
* @param quality The quality of the image if lossy mimeType is used (e.g. image/jpeg, image/webp). See {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob | HTMLCanvasElement.toBlob()}'s `quality` parameter.
|
|
608
609
|
*/
|
|
609
610
|
static EncodeScreenshotCanvasData(canvas, successCallback, mimeType = "image/png", fileName, quality) {
|
|
610
611
|
if (typeof fileName === "string" || !successCallback) {
|
|
@@ -693,9 +694,11 @@ export class Tools {
|
|
|
693
694
|
* src parameter of an <img> to display it
|
|
694
695
|
* @param mimeType defines the MIME type of the screenshot image (default: image/png).
|
|
695
696
|
* Check your browser for supported MIME types
|
|
697
|
+
* @param forceDownload force the system to download the image even if a successCallback is provided
|
|
698
|
+
* @param quality The quality of the image if lossy mimeType is used (e.g. image/jpeg, image/webp). See {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob | HTMLCanvasElement.toBlob()}'s `quality` parameter.
|
|
696
699
|
*/
|
|
697
700
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
698
|
-
static CreateScreenshot(engine, camera, size, successCallback, mimeType = "image/png") {
|
|
701
|
+
static CreateScreenshot(engine, camera, size, successCallback, mimeType = "image/png", forceDownload = false, quality) {
|
|
699
702
|
throw _WarnImport("ScreenshotTools");
|
|
700
703
|
}
|
|
701
704
|
/**
|
|
@@ -710,11 +713,12 @@ export class Tools {
|
|
|
710
713
|
* rendering at a higher or lower resolution
|
|
711
714
|
* @param mimeType defines the MIME type of the screenshot image (default: image/png).
|
|
712
715
|
* Check your browser for supported MIME types
|
|
716
|
+
* @param quality The quality of the image if lossy mimeType is used (e.g. image/jpeg, image/webp). See {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob | HTMLCanvasElement.toBlob()}'s `quality` parameter.
|
|
713
717
|
* @returns screenshot as a string of base64-encoded characters. This string can be assigned
|
|
714
718
|
* to the src parameter of an <img> to display it
|
|
715
719
|
*/
|
|
716
720
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
717
|
-
static CreateScreenshotAsync(engine, camera, size, mimeType = "image/png") {
|
|
721
|
+
static CreateScreenshotAsync(engine, camera, size, mimeType = "image/png", quality) {
|
|
718
722
|
throw _WarnImport("ScreenshotTools");
|
|
719
723
|
}
|
|
720
724
|
/**
|
|
@@ -735,9 +739,13 @@ export class Tools {
|
|
|
735
739
|
* @param samples Texture samples (default: 1)
|
|
736
740
|
* @param antialiasing Whether antialiasing should be turned on or not (default: false)
|
|
737
741
|
* @param fileName A name for for the downloaded file.
|
|
742
|
+
* @param renderSprites Whether the sprites should be rendered or not (default: false)
|
|
743
|
+
* @param enableStencilBuffer Whether the stencil buffer should be enabled or not (default: false)
|
|
744
|
+
* @param useLayerMask if the camera's layer mask should be used to filter what should be rendered (default: true)
|
|
745
|
+
* @param quality The quality of the image if lossy mimeType is used (e.g. image/jpeg, image/webp). See {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob | HTMLCanvasElement.toBlob()}'s `quality` parameter.
|
|
738
746
|
*/
|
|
739
747
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
740
|
-
static CreateScreenshotUsingRenderTarget(engine, camera, size, successCallback, mimeType = "image/png", samples = 1, antialiasing = false, fileName) {
|
|
748
|
+
static CreateScreenshotUsingRenderTarget(engine, camera, size, successCallback, mimeType = "image/png", samples = 1, antialiasing = false, fileName, renderSprites = false, enableStencilBuffer = false, useLayerMask = true, quality) {
|
|
741
749
|
throw _WarnImport("ScreenshotTools");
|
|
742
750
|
}
|
|
743
751
|
/**
|
|
@@ -756,10 +764,14 @@ export class Tools {
|
|
|
756
764
|
* @param antialiasing Whether antialiasing should be turned on or not (default: false)
|
|
757
765
|
* @param fileName A name for for the downloaded file.
|
|
758
766
|
* @returns screenshot as a string of base64-encoded characters. This string can be assigned
|
|
767
|
+
* @param renderSprites Whether the sprites should be rendered or not (default: false)
|
|
768
|
+
* @param enableStencilBuffer Whether the stencil buffer should be enabled or not (default: false)
|
|
769
|
+
* @param useLayerMask if the camera's layer mask should be used to filter what should be rendered (default: true)
|
|
770
|
+
* @param quality The quality of the image if lossy mimeType is used (e.g. image/jpeg, image/webp). See {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob | HTMLCanvasElement.toBlob()}'s `quality` parameter.
|
|
759
771
|
* to the src parameter of an <img> to display it
|
|
760
772
|
*/
|
|
761
773
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
762
|
-
static CreateScreenshotUsingRenderTargetAsync(engine, camera, size, mimeType = "image/png", samples = 1, antialiasing = false, fileName) {
|
|
774
|
+
static CreateScreenshotUsingRenderTargetAsync(engine, camera, size, mimeType = "image/png", samples = 1, antialiasing = false, fileName, renderSprites = false, enableStencilBuffer = false, useLayerMask = true, quality) {
|
|
763
775
|
throw _WarnImport("ScreenshotTools");
|
|
764
776
|
}
|
|
765
777
|
/**
|