@babylonjs/core 7.2.2 → 7.2.3
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/Animations/runtimeAnimation.d.ts +1 -0
- package/Animations/runtimeAnimation.js +12 -3
- package/Animations/runtimeAnimation.js.map +1 -1
- package/Audio/audioEngine.js +2 -2
- package/Audio/audioEngine.js.map +1 -1
- package/Bones/boneLookController.js +3 -0
- package/Bones/boneLookController.js.map +1 -1
- package/Buffers/buffer.d.ts +5 -5
- package/Buffers/buffer.js.map +1 -1
- package/Buffers/storageBuffer.d.ts +2 -2
- package/Buffers/storageBuffer.js.map +1 -1
- package/Cameras/Inputs/arcRotateCameraKeyboardMoveInput.js.map +1 -1
- package/Cameras/Inputs/flyCameraKeyboardInput.js.map +1 -1
- package/Cameras/Inputs/followCameraKeyboardMoveInput.js.map +1 -1
- package/Cameras/Inputs/freeCameraKeyboardMoveInput.js.map +1 -1
- package/Compute/computeEffect.d.ts +3 -3
- package/Compute/computeEffect.js.map +1 -1
- package/Compute/computeShader.d.ts +10 -2
- package/Compute/computeShader.js +53 -35
- package/Compute/computeShader.js.map +1 -1
- package/DeviceInput/InputDevices/deviceSourceManager.d.ts +2 -2
- package/DeviceInput/InputDevices/deviceSourceManager.js.map +1 -1
- package/DeviceInput/internalDeviceSourceManager.d.ts +4 -4
- package/DeviceInput/internalDeviceSourceManager.js.map +1 -1
- package/DeviceInput/webDeviceInputSystem.d.ts +2 -2
- package/DeviceInput/webDeviceInputSystem.js.map +1 -1
- package/Engines/AbstractEngine/abstractEngine.alpha.d.ts +10 -0
- package/Engines/AbstractEngine/abstractEngine.alpha.js +29 -0
- package/Engines/AbstractEngine/abstractEngine.alpha.js.map +1 -0
- package/Engines/AbstractEngine/abstractEngine.cubeTexture.d.ts +17 -0
- package/Engines/AbstractEngine/abstractEngine.cubeTexture.js +138 -0
- package/Engines/AbstractEngine/abstractEngine.cubeTexture.js.map +1 -0
- package/Engines/AbstractEngine/abstractEngine.dom.d.ts +61 -0
- package/Engines/AbstractEngine/abstractEngine.dom.js +27 -0
- package/Engines/AbstractEngine/abstractEngine.dom.js.map +1 -0
- package/Engines/AbstractEngine/abstractEngine.loadingScreen.d.ts +30 -0
- package/Engines/AbstractEngine/abstractEngine.loadingScreen.js +48 -0
- package/Engines/AbstractEngine/abstractEngine.loadingScreen.js.map +1 -0
- package/Engines/AbstractEngine/abstractEngine.query.d.ts +122 -0
- package/Engines/AbstractEngine/abstractEngine.query.js +175 -0
- package/Engines/AbstractEngine/abstractEngine.query.js.map +1 -0
- package/Engines/AbstractEngine/abstractEngine.renderPass.d.ts +26 -0
- package/Engines/AbstractEngine/abstractEngine.renderPass.js +29 -0
- package/Engines/AbstractEngine/abstractEngine.renderPass.js.map +1 -0
- package/Engines/AbstractEngine/abstractEngine.states.d.ts +162 -0
- package/Engines/AbstractEngine/abstractEngine.states.js +105 -0
- package/Engines/AbstractEngine/abstractEngine.states.js.map +1 -0
- package/Engines/AbstractEngine/abstractEngine.texture.d.ts +16 -0
- package/Engines/AbstractEngine/abstractEngine.texture.js +11 -0
- package/Engines/AbstractEngine/abstractEngine.texture.js.map +1 -0
- package/Engines/AbstractEngine/index.d.ts +8 -0
- package/Engines/AbstractEngine/index.js +10 -0
- package/Engines/AbstractEngine/index.js.map +1 -0
- package/Engines/Extensions/engine.alpha.d.ts +0 -24
- package/Engines/Extensions/engine.alpha.js +0 -35
- package/Engines/Extensions/engine.alpha.js.map +1 -1
- package/Engines/Extensions/engine.computeShader.d.ts +15 -2
- package/Engines/Extensions/engine.computeShader.js +5 -1
- package/Engines/Extensions/engine.computeShader.js.map +1 -1
- package/Engines/Extensions/engine.cubeTexture.d.ts +0 -8
- package/Engines/Extensions/engine.cubeTexture.js +2 -135
- package/Engines/Extensions/engine.cubeTexture.js.map +1 -1
- package/Engines/Extensions/engine.debugging.d.ts +2 -2
- package/Engines/Extensions/engine.debugging.js +5 -5
- package/Engines/Extensions/engine.debugging.js.map +1 -1
- package/Engines/Extensions/engine.dynamicTexture.js +3 -2
- package/Engines/Extensions/engine.dynamicTexture.js.map +1 -1
- package/Engines/Extensions/engine.multiview.js.map +1 -1
- package/Engines/Extensions/engine.query.d.ts +5 -120
- package/Engines/Extensions/engine.query.js +14 -150
- package/Engines/Extensions/engine.query.js.map +1 -1
- package/Engines/Extensions/engine.renderTarget.js +0 -9
- package/Engines/Extensions/engine.renderTarget.js.map +1 -1
- package/Engines/Extensions/engine.views.d.ts +3 -2
- package/Engines/Extensions/engine.views.js.map +1 -1
- package/Engines/Processors/iShaderProcessor.d.ts +2 -2
- package/Engines/Processors/iShaderProcessor.js.map +1 -1
- package/Engines/Processors/shaderProcessor.d.ts +3 -3
- package/Engines/Processors/shaderProcessor.js.map +1 -1
- package/Engines/WebGL/webGLRenderTargetWrapper.js +12 -9
- package/Engines/WebGL/webGLRenderTargetWrapper.js.map +1 -1
- package/Engines/WebGL/webGLShaderProcessors.d.ts +2 -2
- package/Engines/WebGL/webGLShaderProcessors.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.alpha.d.ts +35 -0
- package/Engines/WebGPU/Extensions/engine.alpha.js +4 -4
- package/Engines/WebGPU/Extensions/engine.alpha.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.computeShader.d.ts +9 -0
- package/Engines/WebGPU/Extensions/engine.computeShader.js +13 -2
- package/Engines/WebGPU/Extensions/engine.computeShader.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.cubeTexture.d.ts +78 -1
- package/Engines/WebGPU/Extensions/engine.cubeTexture.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.dynamicTexture.d.ts +27 -1
- package/Engines/WebGPU/Extensions/engine.dynamicTexture.js +3 -3
- package/Engines/WebGPU/Extensions/engine.dynamicTexture.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.externalTexture.d.ts +16 -0
- package/Engines/WebGPU/Extensions/engine.externalTexture.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.multiRender.d.ts +55 -1
- package/Engines/WebGPU/Extensions/engine.multiRender.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.query.d.ts +1 -1
- package/Engines/WebGPU/Extensions/engine.query.js +1 -0
- package/Engines/WebGPU/Extensions/engine.query.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.rawTexture.d.ts +185 -1
- package/Engines/WebGPU/Extensions/engine.rawTexture.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.readTexture.d.ts +10 -1
- package/Engines/WebGPU/Extensions/engine.readTexture.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.renderTarget.d.ts +38 -1
- package/Engines/WebGPU/Extensions/engine.renderTarget.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.renderTargetCube.d.ts +13 -1
- package/Engines/WebGPU/Extensions/engine.renderTargetCube.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.storageBuffer.d.ts +38 -1
- package/Engines/WebGPU/Extensions/engine.storageBuffer.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.textureSampler.d.ts +10 -0
- package/Engines/WebGPU/Extensions/engine.textureSampler.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.videoTexture.d.ts +14 -1
- package/Engines/WebGPU/Extensions/engine.videoTexture.js.map +1 -1
- package/Engines/WebGPU/webgpuShaderProcessorsGLSL.d.ts +2 -2
- package/Engines/WebGPU/webgpuShaderProcessorsGLSL.js.map +1 -1
- package/Engines/abstractEngine.d.ts +1688 -0
- package/Engines/abstractEngine.js +1354 -0
- package/Engines/abstractEngine.js.map +1 -0
- package/Engines/engine.common.d.ts +39 -0
- package/Engines/engine.common.js +226 -0
- package/Engines/engine.common.js.map +1 -0
- package/Engines/engine.d.ts +40 -447
- package/Engines/engine.js +64 -810
- package/Engines/engine.js.map +1 -1
- package/Engines/engineFactory.d.ts +2 -2
- package/Engines/engineFactory.js.map +1 -1
- package/Engines/engineStore.d.ts +4 -4
- package/Engines/engineStore.js.map +1 -1
- package/Engines/index.d.ts +3 -0
- package/Engines/index.js +3 -0
- package/Engines/index.js.map +1 -1
- package/Engines/nativeEngine.d.ts +1 -1
- package/Engines/nativeEngine.js +2 -1
- package/Engines/nativeEngine.js.map +1 -1
- package/Engines/nullEngine.d.ts +2 -2
- package/Engines/nullEngine.js +2 -3
- package/Engines/nullEngine.js.map +1 -1
- package/Engines/renderTargetWrapper.d.ts +3 -3
- package/Engines/renderTargetWrapper.js.map +1 -1
- package/Engines/thinEngine.d.ts +35 -591
- package/Engines/thinEngine.js +84 -1134
- package/Engines/thinEngine.js.map +1 -1
- package/Engines/webgpuEngine.d.ts +149 -109
- package/Engines/webgpuEngine.js +249 -161
- package/Engines/webgpuEngine.js.map +1 -1
- package/Instrumentation/engineInstrumentation.d.ts +5 -4
- package/Instrumentation/engineInstrumentation.js.map +1 -1
- package/Layers/effectLayer.d.ts +2 -2
- package/Layers/effectLayer.js +3 -3
- package/Layers/effectLayer.js.map +1 -1
- package/Layers/effectLayerSceneComponent.js.map +1 -1
- package/Layers/glowLayer.js +3 -3
- package/Layers/glowLayer.js.map +1 -1
- package/Layers/highlightLayer.js +3 -3
- package/Layers/highlightLayer.js.map +1 -1
- package/Layers/layerSceneComponent.js.map +1 -1
- package/Loading/loadingScreen.js +2 -2
- package/Loading/loadingScreen.js.map +1 -1
- package/Loading/sceneLoader.d.ts +3 -3
- package/Loading/sceneLoader.js +1 -1
- package/Loading/sceneLoader.js.map +1 -1
- package/Materials/GreasedLine/greasedLinePluginMaterial.js.map +1 -1
- package/Materials/Textures/Filtering/hdrFiltering.d.ts +2 -2
- package/Materials/Textures/Filtering/hdrFiltering.js.map +1 -1
- package/Materials/Textures/Loaders/basisTextureLoader.js +2 -2
- package/Materials/Textures/Loaders/basisTextureLoader.js.map +1 -1
- package/Materials/Textures/MultiviewRenderTarget.d.ts +1 -0
- package/Materials/Textures/MultiviewRenderTarget.js +1 -0
- package/Materials/Textures/MultiviewRenderTarget.js.map +1 -1
- package/Materials/Textures/Procedurals/proceduralTexture.js +1 -1
- package/Materials/Textures/Procedurals/proceduralTexture.js.map +1 -1
- package/Materials/Textures/baseTexture.d.ts +3 -3
- package/Materials/Textures/baseTexture.js.map +1 -1
- package/Materials/Textures/colorGradingTexture.d.ts +2 -2
- package/Materials/Textures/colorGradingTexture.js.map +1 -1
- package/Materials/Textures/cubeTexture.d.ts +3 -2
- package/Materials/Textures/cubeTexture.js +1 -0
- package/Materials/Textures/cubeTexture.js.map +1 -1
- package/Materials/Textures/hdrCubeTexture.d.ts +2 -2
- package/Materials/Textures/hdrCubeTexture.js.map +1 -1
- package/Materials/Textures/htmlElementTexture.d.ts +2 -2
- package/Materials/Textures/htmlElementTexture.js.map +1 -1
- package/Materials/Textures/internalTexture.d.ts +3 -3
- package/Materials/Textures/internalTexture.js.map +1 -1
- package/Materials/Textures/rawTexture.d.ts +10 -10
- package/Materials/Textures/rawTexture.js.map +1 -1
- package/Materials/Textures/renderTargetTexture.d.ts +4 -4
- package/Materials/Textures/renderTargetTexture.js +4 -4
- package/Materials/Textures/renderTargetTexture.js.map +1 -1
- package/Materials/Textures/texture.d.ts +2 -2
- package/Materials/Textures/texture.js.map +1 -1
- package/Materials/Textures/thinTexture.d.ts +3 -3
- package/Materials/Textures/thinTexture.js +1 -1
- package/Materials/Textures/thinTexture.js.map +1 -1
- package/Materials/drawWrapper.d.ts +2 -3
- package/Materials/drawWrapper.functions.d.ts +8 -0
- package/Materials/drawWrapper.functions.js +9 -0
- package/Materials/drawWrapper.functions.js.map +1 -0
- package/Materials/drawWrapper.js +0 -3
- package/Materials/drawWrapper.js.map +1 -1
- package/Materials/effect.d.ts +4 -5
- package/Materials/effect.js.map +1 -1
- package/Materials/effectRenderer.d.ts +4 -4
- package/Materials/effectRenderer.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/materialHelper.functions.d.ts +2 -2
- package/Materials/materialHelper.functions.js.map +1 -1
- package/Materials/materialPluginBase.d.ts +4 -4
- package/Materials/materialPluginBase.js.map +1 -1
- package/Materials/materialPluginManager.d.ts +2 -2
- package/Materials/materialPluginManager.js.map +1 -1
- package/Materials/meshDebugPluginMaterial.js +1 -1
- package/Materials/meshDebugPluginMaterial.js.map +1 -1
- package/Materials/uniformBuffer.d.ts +2 -2
- package/Materials/uniformBuffer.js.map +1 -1
- package/Meshes/Builders/greasedLineBuilder.d.ts +6 -0
- package/Meshes/Builders/greasedLineBuilder.js +15 -8
- package/Meshes/Builders/greasedLineBuilder.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
- package/Meshes/GreasedLine/greasedLineBaseMesh.d.ts +2 -2
- package/Meshes/GreasedLine/greasedLineBaseMesh.js.map +1 -1
- package/Meshes/GreasedLine/greasedLineMesh.js +1 -1
- package/Meshes/GreasedLine/greasedLineMesh.js.map +1 -1
- package/Meshes/geometry.d.ts +2 -2
- package/Meshes/geometry.js +3 -2
- package/Meshes/geometry.js.map +1 -1
- package/Meshes/instancedMesh.js.map +1 -1
- package/Meshes/mesh.d.ts +3 -3
- package/Meshes/mesh.js.map +1 -1
- package/Meshes/subMesh.d.ts +2 -2
- package/Meshes/subMesh.js.map +1 -1
- package/Misc/PerformanceViewer/performanceViewerCollectionStrategies.js.map +1 -1
- package/Misc/copyTextureToTexture.d.ts +2 -2
- package/Misc/copyTextureToTexture.js.map +1 -1
- package/Misc/dds.d.ts +3 -2
- package/Misc/dds.js +2 -1
- package/Misc/dds.js.map +1 -1
- package/Misc/dumpTools.d.ts +2 -2
- package/Misc/dumpTools.js.map +1 -1
- package/Misc/fileTools.js +3 -3
- package/Misc/fileTools.js.map +1 -1
- package/Misc/khronosTextureContainer2.d.ts +8 -2
- package/Misc/khronosTextureContainer2.js +3 -2
- package/Misc/khronosTextureContainer2.js.map +1 -1
- package/Misc/minMaxReducer.d.ts +2 -2
- package/Misc/minMaxReducer.js.map +1 -1
- package/Misc/textureTools.js.map +1 -1
- package/Misc/tools.d.ts +7 -7
- package/Misc/tools.functions.d.ts +26 -0
- package/Misc/tools.functions.js +62 -0
- package/Misc/tools.functions.js.map +1 -1
- package/Misc/tools.js.map +1 -1
- package/Misc/videoRecorder.d.ts +3 -3
- package/Misc/videoRecorder.js.map +1 -1
- package/Particles/baseParticleSystem.d.ts +2 -2
- package/Particles/baseParticleSystem.js.map +1 -1
- package/Particles/computeShaderParticleSystem.d.ts +2 -2
- package/Particles/computeShaderParticleSystem.js.map +1 -1
- package/Particles/gpuParticleSystem.d.ts +3 -3
- package/Particles/gpuParticleSystem.js +2 -2
- package/Particles/gpuParticleSystem.js.map +1 -1
- package/Particles/particle.js +1 -1
- package/Particles/particle.js.map +1 -1
- package/Particles/particleSystem.d.ts +3 -3
- package/Particles/particleSystem.js +3 -3
- package/Particles/particleSystem.js.map +1 -1
- package/Particles/particleSystemComponent.d.ts +2 -2
- package/Particles/particleSystemComponent.js +2 -2
- package/Particles/particleSystemComponent.js.map +1 -1
- package/Particles/subEmitter.d.ts +3 -3
- package/Particles/subEmitter.js.map +1 -1
- package/Particles/thinParticleSystem.d.ts +2 -2
- package/Particles/thinParticleSystem.js.map +1 -1
- package/Physics/v2/physicsBody.js +3 -3
- package/Physics/v2/physicsBody.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js.map +1 -1
- package/PostProcesses/RenderPipeline/postProcessRenderEffect.d.ts +2 -2
- package/PostProcesses/RenderPipeline/postProcessRenderEffect.js.map +1 -1
- package/PostProcesses/RenderPipeline/postProcessRenderPipeline.d.ts +2 -2
- package/PostProcesses/RenderPipeline/postProcessRenderPipeline.js.map +1 -1
- package/PostProcesses/blackAndWhitePostProcess.d.ts +2 -2
- package/PostProcesses/blackAndWhitePostProcess.js.map +1 -1
- package/PostProcesses/bloomMergePostProcess.d.ts +2 -2
- package/PostProcesses/bloomMergePostProcess.js.map +1 -1
- package/PostProcesses/blurPostProcess.d.ts +2 -2
- package/PostProcesses/blurPostProcess.js.map +1 -1
- package/PostProcesses/chromaticAberrationPostProcess.d.ts +2 -2
- package/PostProcesses/chromaticAberrationPostProcess.js.map +1 -1
- package/PostProcesses/circleOfConfusionPostProcess.d.ts +2 -2
- package/PostProcesses/circleOfConfusionPostProcess.js.map +1 -1
- package/PostProcesses/colorCorrectionPostProcess.d.ts +2 -2
- package/PostProcesses/colorCorrectionPostProcess.js.map +1 -1
- package/PostProcesses/convolutionPostProcess.d.ts +2 -2
- package/PostProcesses/convolutionPostProcess.js.map +1 -1
- package/PostProcesses/depthOfFieldBlurPostProcess.d.ts +2 -2
- package/PostProcesses/depthOfFieldBlurPostProcess.js.map +1 -1
- package/PostProcesses/depthOfFieldEffect.js +1 -1
- package/PostProcesses/depthOfFieldEffect.js.map +1 -1
- package/PostProcesses/depthOfFieldMergePostProcess.d.ts +2 -2
- package/PostProcesses/depthOfFieldMergePostProcess.js.map +1 -1
- package/PostProcesses/displayPassPostProcess.d.ts +2 -2
- package/PostProcesses/displayPassPostProcess.js.map +1 -1
- package/PostProcesses/extractHighlightsPostProcess.d.ts +2 -2
- package/PostProcesses/extractHighlightsPostProcess.js.map +1 -1
- package/PostProcesses/filterPostProcess.d.ts +2 -2
- package/PostProcesses/filterPostProcess.js.map +1 -1
- package/PostProcesses/fxaaPostProcess.d.ts +2 -2
- package/PostProcesses/fxaaPostProcess.js +2 -2
- package/PostProcesses/fxaaPostProcess.js.map +1 -1
- package/PostProcesses/grainPostProcess.d.ts +2 -2
- package/PostProcesses/grainPostProcess.js.map +1 -1
- package/PostProcesses/imageProcessingPostProcess.d.ts +2 -2
- package/PostProcesses/imageProcessingPostProcess.js.map +1 -1
- package/PostProcesses/motionBlurPostProcess.d.ts +2 -2
- package/PostProcesses/motionBlurPostProcess.js.map +1 -1
- package/PostProcesses/passPostProcess.d.ts +3 -3
- package/PostProcesses/passPostProcess.js +2 -2
- package/PostProcesses/passPostProcess.js.map +1 -1
- package/PostProcesses/postProcess.d.ts +4 -4
- package/PostProcesses/postProcess.js +3 -3
- package/PostProcesses/postProcess.js.map +1 -1
- package/PostProcesses/refractionPostProcess.d.ts +2 -2
- package/PostProcesses/refractionPostProcess.js.map +1 -1
- package/PostProcesses/screenSpaceCurvaturePostProcess.d.ts +2 -2
- package/PostProcesses/screenSpaceCurvaturePostProcess.js.map +1 -1
- package/PostProcesses/screenSpaceReflectionPostProcess.d.ts +2 -2
- package/PostProcesses/screenSpaceReflectionPostProcess.js.map +1 -1
- package/PostProcesses/sharpenPostProcess.d.ts +2 -2
- package/PostProcesses/sharpenPostProcess.js.map +1 -1
- package/PostProcesses/subSurfaceScatteringPostProcess.d.ts +2 -2
- package/PostProcesses/subSurfaceScatteringPostProcess.js.map +1 -1
- package/PostProcesses/volumetricLightScatteringPostProcess.d.ts +2 -2
- package/PostProcesses/volumetricLightScatteringPostProcess.js.map +1 -1
- package/Rendering/GlobalIllumination/giRSMManager.js.map +1 -1
- package/Rendering/depthPeelingRenderer.js.map +1 -1
- package/Rendering/fluidRenderer/fluidRenderer.js.map +1 -1
- package/Rendering/fluidRenderer/fluidRenderingDepthTextureCopy.d.ts +2 -2
- package/Rendering/fluidRenderer/fluidRenderingDepthTextureCopy.js.map +1 -1
- package/Rendering/fluidRenderer/fluidRenderingObject.d.ts +2 -2
- package/Rendering/fluidRenderer/fluidRenderingObject.js.map +1 -1
- package/Rendering/fluidRenderer/fluidRenderingTargetRenderer.d.ts +2 -2
- package/Rendering/fluidRenderer/fluidRenderingTargetRenderer.js.map +1 -1
- package/Rendering/fluidRenderer/fluidRenderingTextures.d.ts +2 -2
- package/Rendering/fluidRenderer/fluidRenderingTextures.js.map +1 -1
- package/Rendering/geometryBufferRenderer.js +24 -18
- package/Rendering/geometryBufferRenderer.js.map +1 -1
- package/Rendering/outlineRenderer.js.map +1 -1
- package/Rendering/prePassRenderer.js.map +1 -1
- package/Sprites/spriteRenderer.d.ts +2 -2
- package/Sprites/spriteRenderer.js.map +1 -1
- package/XR/features/WebXRDepthSensing.js.map +1 -1
- package/XR/features/WebXRImageTracking.js.map +1 -1
- package/XR/features/WebXRLayers.d.ts +2 -2
- package/XR/features/WebXRLayers.js.map +1 -1
- package/XR/features/WebXRLightEstimation.js.map +1 -1
- package/XR/features/WebXRRawCameraAccess.d.ts +1 -1
- package/XR/features/WebXRRawCameraAccess.js.map +1 -1
- package/XR/features/WebXRSpaceWarp.js +1 -3
- package/XR/features/WebXRSpaceWarp.js.map +1 -1
- package/XR/features/WebXRWalkingLocomotion.js.map +1 -1
- package/XR/webXRExperienceHelper.js.map +1 -1
- package/XR/webXRManagedOutputCanvas.d.ts +2 -2
- package/XR/webXRManagedOutputCanvas.js.map +1 -1
- package/XR/webXRRenderTargetTextureProvider.js.map +1 -1
- package/XR/webXRSessionManager.js.map +1 -1
- package/assetContainer.js.map +1 -1
- package/node.d.ts +2 -2
- package/node.js.map +1 -1
- package/package.json +1 -1
- package/scene.d.ts +3 -3
- package/scene.js.map +1 -1
package/Engines/engine.js
CHANGED
|
@@ -1,18 +1,23 @@
|
|
|
1
|
-
import { Observable } from "../Misc/observable.js";
|
|
2
1
|
import { InternalTexture, InternalTextureSource } from "../Materials/Textures/internalTexture.js";
|
|
3
|
-
import { IsDocumentAvailable, IsWindowObjectExist } from "../Misc/domManagement.js";
|
|
4
2
|
import { EngineStore } from "./engineStore.js";
|
|
5
|
-
import { _WarnImport } from "../Misc/devTools.js";
|
|
6
3
|
import { ThinEngine } from "./thinEngine.js";
|
|
7
4
|
|
|
8
5
|
import { PerformanceMonitor } from "../Misc/performanceMonitor.js";
|
|
9
|
-
import { PerfCounter } from "../Misc/perfCounter.js";
|
|
10
6
|
import { WebGLDataBuffer } from "../Meshes/WebGL/webGLDataBuffer.js";
|
|
11
7
|
import { Logger } from "../Misc/logger.js";
|
|
12
8
|
import { WebGLHardwareTexture } from "./WebGL/webGLHardwareTexture.js";
|
|
13
9
|
import "./Extensions/engine.alpha.js";
|
|
14
10
|
import "./Extensions/engine.readTexture.js";
|
|
15
11
|
import "./Extensions/engine.dynamicBuffer.js";
|
|
12
|
+
import "./AbstractEngine/abstractEngine.loadingScreen.js";
|
|
13
|
+
import "./AbstractEngine/abstractEngine.dom.js";
|
|
14
|
+
import "./AbstractEngine/abstractEngine.states.js";
|
|
15
|
+
import "./AbstractEngine/abstractEngine.renderPass.js";
|
|
16
|
+
import "./AbstractEngine/abstractEngine.texture.js";
|
|
17
|
+
import { AbstractEngine } from "./abstractEngine.js";
|
|
18
|
+
import { CreateImageBitmapFromSource, ExitFullscreen, ExitPointerlock, GetFontOffset, RequestFullscreen, RequestPointerlock, ResizeImageBitmap, _CommonDispose, _CommonInit, } from "./engine.common.js";
|
|
19
|
+
import { PerfCounter } from "../Misc/perfCounter.js";
|
|
20
|
+
import "../Audio/audioEngine.js";
|
|
16
21
|
/**
|
|
17
22
|
* The engine class is responsible for interfacing with all lower-level APIs such as WebGL and Audio
|
|
18
23
|
*/
|
|
@@ -22,13 +27,13 @@ export class Engine extends ThinEngine {
|
|
|
22
27
|
*/
|
|
23
28
|
// Not mixed with Version for tooling purpose.
|
|
24
29
|
static get NpmPackage() {
|
|
25
|
-
return
|
|
30
|
+
return AbstractEngine.NpmPackage;
|
|
26
31
|
}
|
|
27
32
|
/**
|
|
28
33
|
* Returns the current version of the framework
|
|
29
34
|
*/
|
|
30
35
|
static get Version() {
|
|
31
|
-
return
|
|
36
|
+
return AbstractEngine.Version;
|
|
32
37
|
}
|
|
33
38
|
/** Gets the list of created engines */
|
|
34
39
|
static get Instances() {
|
|
@@ -47,57 +52,6 @@ export class Engine extends ThinEngine {
|
|
|
47
52
|
return EngineStore.LastCreatedScene;
|
|
48
53
|
}
|
|
49
54
|
/** @internal */
|
|
50
|
-
/**
|
|
51
|
-
* Engine abstraction for loading and creating an image bitmap from a given source string.
|
|
52
|
-
* @param imageSource source to load the image from.
|
|
53
|
-
* @param options An object that sets options for the image's extraction.
|
|
54
|
-
* @returns ImageBitmap.
|
|
55
|
-
*/
|
|
56
|
-
_createImageBitmapFromSource(imageSource, options) {
|
|
57
|
-
const promise = new Promise((resolve, reject) => {
|
|
58
|
-
const image = new Image();
|
|
59
|
-
image.onload = () => {
|
|
60
|
-
image.decode().then(() => {
|
|
61
|
-
this.createImageBitmap(image, options).then((imageBitmap) => {
|
|
62
|
-
resolve(imageBitmap);
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
};
|
|
66
|
-
image.onerror = () => {
|
|
67
|
-
reject(`Error loading image ${image.src}`);
|
|
68
|
-
};
|
|
69
|
-
image.src = imageSource;
|
|
70
|
-
});
|
|
71
|
-
return promise;
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Engine abstraction for createImageBitmap
|
|
75
|
-
* @param image source for image
|
|
76
|
-
* @param options An object that sets options for the image's extraction.
|
|
77
|
-
* @returns ImageBitmap
|
|
78
|
-
*/
|
|
79
|
-
createImageBitmap(image, options) {
|
|
80
|
-
return createImageBitmap(image, options);
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Resize an image and returns the image data as an uint8array
|
|
84
|
-
* @param image image to resize
|
|
85
|
-
* @param bufferWidth destination buffer width
|
|
86
|
-
* @param bufferHeight destination buffer height
|
|
87
|
-
* @returns an uint8array containing RGBA values of bufferWidth * bufferHeight size
|
|
88
|
-
*/
|
|
89
|
-
resizeImageBitmap(image, bufferWidth, bufferHeight) {
|
|
90
|
-
const canvas = this.createCanvas(bufferWidth, bufferHeight);
|
|
91
|
-
const context = canvas.getContext("2d");
|
|
92
|
-
if (!context) {
|
|
93
|
-
throw new Error("Unable to get 2d context for resizeImageBitmap");
|
|
94
|
-
}
|
|
95
|
-
context.drawImage(image, 0, 0);
|
|
96
|
-
// Create VertexData from map data
|
|
97
|
-
// Cast is due to wrong definition in lib.d.ts from ts 1.3 - https://github.com/Microsoft/TypeScript/issues/949
|
|
98
|
-
const buffer = context.getImageData(0, 0, bufferWidth, bufferHeight).data;
|
|
99
|
-
return buffer;
|
|
100
|
-
}
|
|
101
55
|
/**
|
|
102
56
|
* Will flag all materials in all scenes in all engines as dirty to trigger new shader compilation
|
|
103
57
|
* @param flag defines which part of the materials must be marked as dirty
|
|
@@ -120,11 +74,16 @@ export class Engine extends ThinEngine {
|
|
|
120
74
|
*/
|
|
121
75
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
122
76
|
static DefaultLoadingScreenFactory(canvas) {
|
|
123
|
-
|
|
77
|
+
return AbstractEngine.DefaultLoadingScreenFactory(canvas);
|
|
124
78
|
}
|
|
125
79
|
get _supportsHardwareTextureRescaling() {
|
|
126
80
|
return !!Engine._RescalePostProcessFactory;
|
|
127
81
|
}
|
|
82
|
+
_measureFps() {
|
|
83
|
+
this._performanceMonitor.sampleFrame();
|
|
84
|
+
this._fps = this._performanceMonitor.averageFPS;
|
|
85
|
+
this._deltaTime = this._performanceMonitor.instantaneousFrameTime || 0;
|
|
86
|
+
}
|
|
128
87
|
/**
|
|
129
88
|
* Gets the performance monitor attached to this engine
|
|
130
89
|
* @see https://doc.babylonjs.com/features/featuresDeepDive/scene/optimize_your_scene#engineinstrumentation
|
|
@@ -132,26 +91,7 @@ export class Engine extends ThinEngine {
|
|
|
132
91
|
get performanceMonitor() {
|
|
133
92
|
return this._performanceMonitor;
|
|
134
93
|
}
|
|
135
|
-
/**
|
|
136
|
-
* (WebGPU only) True (default) to be in compatibility mode, meaning rendering all existing scenes without artifacts (same rendering than WebGL).
|
|
137
|
-
* Setting the property to false will improve performances but may not work in some scenes if some precautions are not taken.
|
|
138
|
-
* See https://doc.babylonjs.com/setup/support/webGPU/webGPUOptimization/webGPUNonCompatibilityMode for more details
|
|
139
|
-
*/
|
|
140
|
-
get compatibilityMode() {
|
|
141
|
-
return this._compatibilityMode;
|
|
142
|
-
}
|
|
143
|
-
set compatibilityMode(mode) {
|
|
144
|
-
// not supported in WebGL
|
|
145
|
-
this._compatibilityMode = true;
|
|
146
|
-
}
|
|
147
94
|
// Events
|
|
148
|
-
/**
|
|
149
|
-
* Gets the HTML element used to attach event listeners
|
|
150
|
-
* @returns a HTML element
|
|
151
|
-
*/
|
|
152
|
-
getInputElement() {
|
|
153
|
-
return this._renderingCanvas;
|
|
154
|
-
}
|
|
155
95
|
/**
|
|
156
96
|
* Creates a new engine
|
|
157
97
|
* @param canvasOrContext defines the canvas or WebGL context to use for rendering. If you provide a WebGL context, Babylon.js will not hook events on the canvas (like pointers, keyboards, etc...) so no event observables will be available. This is mostly used when Babylon.js is used as a plugin on a system which already used the WebGL context
|
|
@@ -162,96 +102,12 @@ export class Engine extends ThinEngine {
|
|
|
162
102
|
constructor(canvasOrContext, antialias, options, adaptToDeviceRatio = false) {
|
|
163
103
|
super(canvasOrContext, antialias, options, adaptToDeviceRatio);
|
|
164
104
|
// Members
|
|
165
|
-
/**
|
|
166
|
-
* Gets or sets a boolean to enable/disable IndexedDB support and avoid XHR on .manifest
|
|
167
|
-
**/
|
|
168
|
-
this.enableOfflineSupport = false;
|
|
169
|
-
/**
|
|
170
|
-
* Gets or sets a boolean to enable/disable checking manifest if IndexedDB support is enabled (js will always consider the database is up to date)
|
|
171
|
-
**/
|
|
172
|
-
this.disableManifestCheck = false;
|
|
173
|
-
/**
|
|
174
|
-
* Gets or sets a boolean to enable/disable the context menu (right-click) from appearing on the main canvas
|
|
175
|
-
*/
|
|
176
|
-
this.disableContextMenu = true;
|
|
177
|
-
/**
|
|
178
|
-
* Gets the list of created scenes
|
|
179
|
-
*/
|
|
180
|
-
this.scenes = [];
|
|
181
|
-
/** @internal */
|
|
182
|
-
this._virtualScenes = new Array();
|
|
183
|
-
/**
|
|
184
|
-
* Event raised when a new scene is created
|
|
185
|
-
*/
|
|
186
|
-
this.onNewSceneAddedObservable = new Observable();
|
|
187
|
-
/**
|
|
188
|
-
* Gets the list of created postprocesses
|
|
189
|
-
*/
|
|
190
|
-
this.postProcesses = [];
|
|
191
|
-
/**
|
|
192
|
-
* Gets a boolean indicating if the pointer is currently locked
|
|
193
|
-
*/
|
|
194
|
-
this.isPointerLock = false;
|
|
195
|
-
// Observables
|
|
196
|
-
/**
|
|
197
|
-
* Observable event triggered each time the rendering canvas is resized
|
|
198
|
-
*/
|
|
199
|
-
this.onResizeObservable = new Observable();
|
|
200
|
-
/**
|
|
201
|
-
* Observable event triggered each time the canvas loses focus
|
|
202
|
-
*/
|
|
203
|
-
this.onCanvasBlurObservable = new Observable();
|
|
204
|
-
/**
|
|
205
|
-
* Observable event triggered each time the canvas gains focus
|
|
206
|
-
*/
|
|
207
|
-
this.onCanvasFocusObservable = new Observable();
|
|
208
|
-
/**
|
|
209
|
-
* Observable event triggered each time the canvas receives pointerout event
|
|
210
|
-
*/
|
|
211
|
-
this.onCanvasPointerOutObservable = new Observable();
|
|
212
|
-
/**
|
|
213
|
-
* Observable raised when the engine begins a new frame
|
|
214
|
-
*/
|
|
215
|
-
this.onBeginFrameObservable = new Observable();
|
|
216
105
|
/**
|
|
217
106
|
* If set, will be used to request the next animation frame for the render loop
|
|
218
107
|
*/
|
|
219
108
|
this.customAnimationFrameRequester = null;
|
|
220
|
-
/**
|
|
221
|
-
* Observable raised when the engine ends the current frame
|
|
222
|
-
*/
|
|
223
|
-
this.onEndFrameObservable = new Observable();
|
|
224
|
-
/**
|
|
225
|
-
* Observable raised when the engine is about to compile a shader
|
|
226
|
-
*/
|
|
227
|
-
this.onBeforeShaderCompilationObservable = new Observable();
|
|
228
|
-
/**
|
|
229
|
-
* Observable raised when the engine has just compiled a shader
|
|
230
|
-
*/
|
|
231
|
-
this.onAfterShaderCompilationObservable = new Observable();
|
|
232
|
-
// Deterministic lockstepMaxSteps
|
|
233
|
-
this._deterministicLockstep = false;
|
|
234
|
-
this._lockstepMaxSteps = 4;
|
|
235
|
-
this._timeStep = 1 / 60;
|
|
236
|
-
// FPS
|
|
237
|
-
this._fps = 60;
|
|
238
|
-
this._deltaTime = 0;
|
|
239
|
-
/** @internal */
|
|
240
|
-
this._drawCalls = new PerfCounter();
|
|
241
|
-
/** Gets or sets the tab index to set to the rendering canvas. 1 is the minimum value to set to be able to capture keyboard events */
|
|
242
|
-
this.canvasTabIndex = 1;
|
|
243
|
-
/**
|
|
244
|
-
* Turn this value on if you want to pause FPS computation when in background
|
|
245
|
-
*/
|
|
246
|
-
this.disablePerformanceMonitorInBackground = false;
|
|
247
109
|
this._performanceMonitor = new PerformanceMonitor();
|
|
248
|
-
this.
|
|
249
|
-
/**
|
|
250
|
-
* Gets or sets the current render pass id
|
|
251
|
-
*/
|
|
252
|
-
this.currentRenderPassId = 0;
|
|
253
|
-
this._renderPassNames = ["main"];
|
|
254
|
-
Engine.Instances.push(this);
|
|
110
|
+
this._drawCalls = new PerfCounter();
|
|
255
111
|
if (!canvasOrContext) {
|
|
256
112
|
return;
|
|
257
113
|
}
|
|
@@ -272,144 +128,59 @@ export class Engine extends ThinEngine {
|
|
|
272
128
|
*/
|
|
273
129
|
_sharedInit(canvas) {
|
|
274
130
|
super._sharedInit(canvas);
|
|
275
|
-
this
|
|
276
|
-
this.onCanvasFocusObservable.notifyObservers(this);
|
|
277
|
-
};
|
|
278
|
-
this._onCanvasBlur = () => {
|
|
279
|
-
this.onCanvasBlurObservable.notifyObservers(this);
|
|
280
|
-
};
|
|
281
|
-
this._onCanvasContextMenu = (evt) => {
|
|
282
|
-
if (this.disableContextMenu) {
|
|
283
|
-
evt.preventDefault();
|
|
284
|
-
}
|
|
285
|
-
};
|
|
286
|
-
canvas.addEventListener("focus", this._onCanvasFocus);
|
|
287
|
-
canvas.addEventListener("blur", this._onCanvasBlur);
|
|
288
|
-
canvas.addEventListener("contextmenu", this._onCanvasContextMenu);
|
|
289
|
-
this._onBlur = () => {
|
|
290
|
-
if (this.disablePerformanceMonitorInBackground) {
|
|
291
|
-
this._performanceMonitor.disable();
|
|
292
|
-
}
|
|
293
|
-
this._windowIsBackground = true;
|
|
294
|
-
};
|
|
295
|
-
this._onFocus = () => {
|
|
296
|
-
if (this.disablePerformanceMonitorInBackground) {
|
|
297
|
-
this._performanceMonitor.enable();
|
|
298
|
-
}
|
|
299
|
-
this._windowIsBackground = false;
|
|
300
|
-
};
|
|
301
|
-
this._onCanvasPointerOut = (ev) => {
|
|
302
|
-
// Check that the element at the point of the pointer out isn't the canvas and if it isn't, notify observers
|
|
303
|
-
// Note: This is a workaround for a bug with Safari
|
|
304
|
-
if (document.elementFromPoint(ev.clientX, ev.clientY) !== canvas) {
|
|
305
|
-
this.onCanvasPointerOutObservable.notifyObservers(ev);
|
|
306
|
-
}
|
|
307
|
-
};
|
|
308
|
-
const hostWindow = this.getHostWindow(); // it calls IsWindowObjectExist()
|
|
309
|
-
if (hostWindow && typeof hostWindow.addEventListener === "function") {
|
|
310
|
-
hostWindow.addEventListener("blur", this._onBlur);
|
|
311
|
-
hostWindow.addEventListener("focus", this._onFocus);
|
|
312
|
-
}
|
|
313
|
-
canvas.addEventListener("pointerout", this._onCanvasPointerOut);
|
|
314
|
-
if (!this._creationOptions.doNotHandleTouchAction) {
|
|
315
|
-
this._disableTouchAction();
|
|
316
|
-
}
|
|
317
|
-
// Create Audio Engine if needed.
|
|
318
|
-
if (!Engine.audioEngine && this._creationOptions.audioEngine && Engine.AudioEngineFactory) {
|
|
319
|
-
Engine.audioEngine = Engine.AudioEngineFactory(this.getRenderingCanvas(), this.getAudioContext(), this.getAudioDestination());
|
|
320
|
-
}
|
|
321
|
-
if (IsDocumentAvailable()) {
|
|
322
|
-
// Fullscreen
|
|
323
|
-
this._onFullscreenChange = () => {
|
|
324
|
-
this.isFullscreen = !!document.fullscreenElement;
|
|
325
|
-
// Pointer lock
|
|
326
|
-
if (this.isFullscreen && this._pointerLockRequested && canvas) {
|
|
327
|
-
Engine._RequestPointerlock(canvas);
|
|
328
|
-
}
|
|
329
|
-
};
|
|
330
|
-
document.addEventListener("fullscreenchange", this._onFullscreenChange, false);
|
|
331
|
-
document.addEventListener("webkitfullscreenchange", this._onFullscreenChange, false);
|
|
332
|
-
// Pointer lock
|
|
333
|
-
this._onPointerLockChange = () => {
|
|
334
|
-
this.isPointerLock = document.pointerLockElement === canvas;
|
|
335
|
-
};
|
|
336
|
-
document.addEventListener("pointerlockchange", this._onPointerLockChange, false);
|
|
337
|
-
document.addEventListener("webkitpointerlockchange", this._onPointerLockChange, false);
|
|
338
|
-
}
|
|
339
|
-
this.enableOfflineSupport = Engine.OfflineProviderFactory !== undefined;
|
|
340
|
-
this._deterministicLockstep = !!this._creationOptions.deterministicLockstep;
|
|
341
|
-
this._lockstepMaxSteps = this._creationOptions.lockstepMaxSteps || 0;
|
|
342
|
-
this._timeStep = this._creationOptions.timeStep || 1 / 60;
|
|
343
|
-
}
|
|
344
|
-
/** @internal */
|
|
345
|
-
_verifyPointerLock() {
|
|
346
|
-
this._onPointerLockChange?.();
|
|
131
|
+
_CommonInit(this, canvas, this._creationOptions);
|
|
347
132
|
}
|
|
348
133
|
/**
|
|
349
|
-
*
|
|
350
|
-
* @param
|
|
351
|
-
* @param
|
|
352
|
-
* @
|
|
134
|
+
* Resize an image and returns the image data as an uint8array
|
|
135
|
+
* @param image image to resize
|
|
136
|
+
* @param bufferWidth destination buffer width
|
|
137
|
+
* @param bufferHeight destination buffer height
|
|
138
|
+
* @returns an uint8array containing RGBA values of bufferWidth * bufferHeight size
|
|
353
139
|
*/
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
return (this.getRenderWidth(useScreen) * viewport.width) / (this.getRenderHeight(useScreen) * viewport.height);
|
|
140
|
+
resizeImageBitmap(image, bufferWidth, bufferHeight) {
|
|
141
|
+
return ResizeImageBitmap(this, image, bufferWidth, bufferHeight);
|
|
357
142
|
}
|
|
358
143
|
/**
|
|
359
|
-
*
|
|
360
|
-
* @
|
|
144
|
+
* Engine abstraction for loading and creating an image bitmap from a given source string.
|
|
145
|
+
* @param imageSource source to load the image from.
|
|
146
|
+
* @param options An object that sets options for the image's extraction.
|
|
147
|
+
* @returns ImageBitmap
|
|
361
148
|
*/
|
|
362
|
-
|
|
363
|
-
return this
|
|
149
|
+
_createImageBitmapFromSource(imageSource, options) {
|
|
150
|
+
return CreateImageBitmapFromSource(this, imageSource, options);
|
|
364
151
|
}
|
|
365
152
|
/**
|
|
366
|
-
*
|
|
367
|
-
* @
|
|
153
|
+
* Toggle full screen mode
|
|
154
|
+
* @param requestPointerLock defines if a pointer lock should be requested from the user
|
|
368
155
|
*/
|
|
369
|
-
|
|
370
|
-
if (
|
|
371
|
-
|
|
156
|
+
switchFullscreen(requestPointerLock) {
|
|
157
|
+
if (this.isFullscreen) {
|
|
158
|
+
this.exitFullscreen();
|
|
372
159
|
}
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
/**
|
|
376
|
-
* Gets the client rect of the HTML element used for events
|
|
377
|
-
* @returns a client rectangle
|
|
378
|
-
*/
|
|
379
|
-
getInputElementClientRect() {
|
|
380
|
-
if (!this._renderingCanvas) {
|
|
381
|
-
return null;
|
|
160
|
+
else {
|
|
161
|
+
this.enterFullscreen(requestPointerLock);
|
|
382
162
|
}
|
|
383
|
-
return this.getInputElement().getBoundingClientRect();
|
|
384
|
-
}
|
|
385
|
-
/**
|
|
386
|
-
* Gets a boolean indicating that the engine is running in deterministic lock step mode
|
|
387
|
-
* @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#deterministic-lockstep
|
|
388
|
-
* @returns true if engine is in deterministic lock step mode
|
|
389
|
-
*/
|
|
390
|
-
isDeterministicLockStep() {
|
|
391
|
-
return this._deterministicLockstep;
|
|
392
163
|
}
|
|
393
164
|
/**
|
|
394
|
-
*
|
|
395
|
-
* @
|
|
396
|
-
* @returns the max steps
|
|
165
|
+
* Enters full screen mode
|
|
166
|
+
* @param requestPointerLock defines if a pointer lock should be requested from the user
|
|
397
167
|
*/
|
|
398
|
-
|
|
399
|
-
|
|
168
|
+
enterFullscreen(requestPointerLock) {
|
|
169
|
+
if (!this.isFullscreen) {
|
|
170
|
+
this._pointerLockRequested = requestPointerLock;
|
|
171
|
+
if (this._renderingCanvas) {
|
|
172
|
+
RequestFullscreen(this._renderingCanvas);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
400
175
|
}
|
|
401
176
|
/**
|
|
402
|
-
*
|
|
403
|
-
* @returns time step in (ms)
|
|
177
|
+
* Exits full screen mode
|
|
404
178
|
*/
|
|
405
|
-
|
|
406
|
-
|
|
179
|
+
exitFullscreen() {
|
|
180
|
+
if (this.isFullscreen) {
|
|
181
|
+
ExitFullscreen();
|
|
182
|
+
}
|
|
407
183
|
}
|
|
408
|
-
/**
|
|
409
|
-
* Force the mipmap generation for the given render target texture
|
|
410
|
-
* @param texture defines the render target texture to use
|
|
411
|
-
* @param unbind defines whether or not to unbind the texture after generation. Defaults to true.
|
|
412
|
-
*/
|
|
413
184
|
generateMipMapsForCubemap(texture, unbind = true) {
|
|
414
185
|
if (texture.generateMipMaps) {
|
|
415
186
|
const gl = this._gl;
|
|
@@ -421,132 +192,6 @@ export class Engine extends ThinEngine {
|
|
|
421
192
|
}
|
|
422
193
|
}
|
|
423
194
|
/** States */
|
|
424
|
-
/**
|
|
425
|
-
* Gets a boolean indicating if depth writing is enabled
|
|
426
|
-
* @returns the current depth writing state
|
|
427
|
-
*/
|
|
428
|
-
getDepthWrite() {
|
|
429
|
-
return this._depthCullingState.depthMask;
|
|
430
|
-
}
|
|
431
|
-
/**
|
|
432
|
-
* Enable or disable depth writing
|
|
433
|
-
* @param enable defines the state to set
|
|
434
|
-
*/
|
|
435
|
-
setDepthWrite(enable) {
|
|
436
|
-
this._depthCullingState.depthMask = enable;
|
|
437
|
-
}
|
|
438
|
-
/**
|
|
439
|
-
* Gets a boolean indicating if stencil buffer is enabled
|
|
440
|
-
* @returns the current stencil buffer state
|
|
441
|
-
*/
|
|
442
|
-
getStencilBuffer() {
|
|
443
|
-
return this._stencilState.stencilTest;
|
|
444
|
-
}
|
|
445
|
-
/**
|
|
446
|
-
* Enable or disable the stencil buffer
|
|
447
|
-
* @param enable defines if the stencil buffer must be enabled or disabled
|
|
448
|
-
*/
|
|
449
|
-
setStencilBuffer(enable) {
|
|
450
|
-
this._stencilState.stencilTest = enable;
|
|
451
|
-
}
|
|
452
|
-
/**
|
|
453
|
-
* Gets the current stencil mask
|
|
454
|
-
* @returns a number defining the new stencil mask to use
|
|
455
|
-
*/
|
|
456
|
-
getStencilMask() {
|
|
457
|
-
return this._stencilState.stencilMask;
|
|
458
|
-
}
|
|
459
|
-
/**
|
|
460
|
-
* Sets the current stencil mask
|
|
461
|
-
* @param mask defines the new stencil mask to use
|
|
462
|
-
*/
|
|
463
|
-
setStencilMask(mask) {
|
|
464
|
-
this._stencilState.stencilMask = mask;
|
|
465
|
-
}
|
|
466
|
-
/**
|
|
467
|
-
* Gets the current stencil function
|
|
468
|
-
* @returns a number defining the stencil function to use
|
|
469
|
-
*/
|
|
470
|
-
getStencilFunction() {
|
|
471
|
-
return this._stencilState.stencilFunc;
|
|
472
|
-
}
|
|
473
|
-
/**
|
|
474
|
-
* Gets the current stencil reference value
|
|
475
|
-
* @returns a number defining the stencil reference value to use
|
|
476
|
-
*/
|
|
477
|
-
getStencilFunctionReference() {
|
|
478
|
-
return this._stencilState.stencilFuncRef;
|
|
479
|
-
}
|
|
480
|
-
/**
|
|
481
|
-
* Gets the current stencil mask
|
|
482
|
-
* @returns a number defining the stencil mask to use
|
|
483
|
-
*/
|
|
484
|
-
getStencilFunctionMask() {
|
|
485
|
-
return this._stencilState.stencilFuncMask;
|
|
486
|
-
}
|
|
487
|
-
/**
|
|
488
|
-
* Sets the current stencil function
|
|
489
|
-
* @param stencilFunc defines the new stencil function to use
|
|
490
|
-
*/
|
|
491
|
-
setStencilFunction(stencilFunc) {
|
|
492
|
-
this._stencilState.stencilFunc = stencilFunc;
|
|
493
|
-
}
|
|
494
|
-
/**
|
|
495
|
-
* Sets the current stencil reference
|
|
496
|
-
* @param reference defines the new stencil reference to use
|
|
497
|
-
*/
|
|
498
|
-
setStencilFunctionReference(reference) {
|
|
499
|
-
this._stencilState.stencilFuncRef = reference;
|
|
500
|
-
}
|
|
501
|
-
/**
|
|
502
|
-
* Sets the current stencil mask
|
|
503
|
-
* @param mask defines the new stencil mask to use
|
|
504
|
-
*/
|
|
505
|
-
setStencilFunctionMask(mask) {
|
|
506
|
-
this._stencilState.stencilFuncMask = mask;
|
|
507
|
-
}
|
|
508
|
-
/**
|
|
509
|
-
* Gets the current stencil operation when stencil fails
|
|
510
|
-
* @returns a number defining stencil operation to use when stencil fails
|
|
511
|
-
*/
|
|
512
|
-
getStencilOperationFail() {
|
|
513
|
-
return this._stencilState.stencilOpStencilFail;
|
|
514
|
-
}
|
|
515
|
-
/**
|
|
516
|
-
* Gets the current stencil operation when depth fails
|
|
517
|
-
* @returns a number defining stencil operation to use when depth fails
|
|
518
|
-
*/
|
|
519
|
-
getStencilOperationDepthFail() {
|
|
520
|
-
return this._stencilState.stencilOpDepthFail;
|
|
521
|
-
}
|
|
522
|
-
/**
|
|
523
|
-
* Gets the current stencil operation when stencil passes
|
|
524
|
-
* @returns a number defining stencil operation to use when stencil passes
|
|
525
|
-
*/
|
|
526
|
-
getStencilOperationPass() {
|
|
527
|
-
return this._stencilState.stencilOpStencilDepthPass;
|
|
528
|
-
}
|
|
529
|
-
/**
|
|
530
|
-
* Sets the stencil operation to use when stencil fails
|
|
531
|
-
* @param operation defines the stencil operation to use when stencil fails
|
|
532
|
-
*/
|
|
533
|
-
setStencilOperationFail(operation) {
|
|
534
|
-
this._stencilState.stencilOpStencilFail = operation;
|
|
535
|
-
}
|
|
536
|
-
/**
|
|
537
|
-
* Sets the stencil operation to use when depth fails
|
|
538
|
-
* @param operation defines the stencil operation to use when depth fails
|
|
539
|
-
*/
|
|
540
|
-
setStencilOperationDepthFail(operation) {
|
|
541
|
-
this._stencilState.stencilOpDepthFail = operation;
|
|
542
|
-
}
|
|
543
|
-
/**
|
|
544
|
-
* Sets the stencil operation to use when stencil passes
|
|
545
|
-
* @param operation defines the stencil operation to use when stencil passes
|
|
546
|
-
*/
|
|
547
|
-
setStencilOperationPass(operation) {
|
|
548
|
-
this._stencilState.stencilOpStencilDepthPass = operation;
|
|
549
|
-
}
|
|
550
195
|
/**
|
|
551
196
|
* Sets a boolean indicating if the dithering state is enabled or disabled
|
|
552
197
|
* @param value defines the dithering state
|
|
@@ -571,68 +216,6 @@ export class Engine extends ThinEngine {
|
|
|
571
216
|
this._gl.enable(this._gl.RASTERIZER_DISCARD);
|
|
572
217
|
}
|
|
573
218
|
}
|
|
574
|
-
/**
|
|
575
|
-
* Gets the current depth function
|
|
576
|
-
* @returns a number defining the depth function
|
|
577
|
-
*/
|
|
578
|
-
getDepthFunction() {
|
|
579
|
-
return this._depthCullingState.depthFunc;
|
|
580
|
-
}
|
|
581
|
-
/**
|
|
582
|
-
* Sets the current depth function
|
|
583
|
-
* @param depthFunc defines the function to use
|
|
584
|
-
*/
|
|
585
|
-
setDepthFunction(depthFunc) {
|
|
586
|
-
this._depthCullingState.depthFunc = depthFunc;
|
|
587
|
-
}
|
|
588
|
-
/**
|
|
589
|
-
* Sets the current depth function to GREATER
|
|
590
|
-
*/
|
|
591
|
-
setDepthFunctionToGreater() {
|
|
592
|
-
this.setDepthFunction(516);
|
|
593
|
-
}
|
|
594
|
-
/**
|
|
595
|
-
* Sets the current depth function to GEQUAL
|
|
596
|
-
*/
|
|
597
|
-
setDepthFunctionToGreaterOrEqual() {
|
|
598
|
-
this.setDepthFunction(518);
|
|
599
|
-
}
|
|
600
|
-
/**
|
|
601
|
-
* Sets the current depth function to LESS
|
|
602
|
-
*/
|
|
603
|
-
setDepthFunctionToLess() {
|
|
604
|
-
this.setDepthFunction(513);
|
|
605
|
-
}
|
|
606
|
-
/**
|
|
607
|
-
* Sets the current depth function to LEQUAL
|
|
608
|
-
*/
|
|
609
|
-
setDepthFunctionToLessOrEqual() {
|
|
610
|
-
this.setDepthFunction(515);
|
|
611
|
-
}
|
|
612
|
-
/**
|
|
613
|
-
* Caches the state of the stencil buffer
|
|
614
|
-
*/
|
|
615
|
-
cacheStencilState() {
|
|
616
|
-
this._cachedStencilBuffer = this.getStencilBuffer();
|
|
617
|
-
this._cachedStencilFunction = this.getStencilFunction();
|
|
618
|
-
this._cachedStencilMask = this.getStencilMask();
|
|
619
|
-
this._cachedStencilOperationPass = this.getStencilOperationPass();
|
|
620
|
-
this._cachedStencilOperationFail = this.getStencilOperationFail();
|
|
621
|
-
this._cachedStencilOperationDepthFail = this.getStencilOperationDepthFail();
|
|
622
|
-
this._cachedStencilReference = this.getStencilFunctionReference();
|
|
623
|
-
}
|
|
624
|
-
/**
|
|
625
|
-
* Restores the state of the stencil buffer
|
|
626
|
-
*/
|
|
627
|
-
restoreStencilState() {
|
|
628
|
-
this.setStencilFunction(this._cachedStencilFunction);
|
|
629
|
-
this.setStencilMask(this._cachedStencilMask);
|
|
630
|
-
this.setStencilBuffer(this._cachedStencilBuffer);
|
|
631
|
-
this.setStencilOperationPass(this._cachedStencilOperationPass);
|
|
632
|
-
this.setStencilOperationFail(this._cachedStencilOperationFail);
|
|
633
|
-
this.setStencilOperationDepthFail(this._cachedStencilOperationDepthFail);
|
|
634
|
-
this.setStencilFunctionReference(this._cachedStencilReference);
|
|
635
|
-
}
|
|
636
219
|
/**
|
|
637
220
|
* Directly set the WebGL Viewport
|
|
638
221
|
* @param x defines the x coordinate of the viewport (in screen space)
|
|
@@ -680,12 +263,6 @@ export class Engine extends ThinEngine {
|
|
|
680
263
|
const gl = this._gl;
|
|
681
264
|
gl.disable(gl.SCISSOR_TEST);
|
|
682
265
|
}
|
|
683
|
-
/**
|
|
684
|
-
* @internal
|
|
685
|
-
*/
|
|
686
|
-
_reportDrawCall(numDrawCalls = 1) {
|
|
687
|
-
this._drawCalls.addCount(numDrawCalls, false);
|
|
688
|
-
}
|
|
689
266
|
/**
|
|
690
267
|
* @internal
|
|
691
268
|
*/
|
|
@@ -744,7 +321,7 @@ export class Engine extends ThinEngine {
|
|
|
744
321
|
}
|
|
745
322
|
}
|
|
746
323
|
/**
|
|
747
|
-
* Sets a texture to the
|
|
324
|
+
* Sets a texture to the context from a postprocess
|
|
748
325
|
* @param channel defines the channel to use
|
|
749
326
|
* @param postProcess defines the source postprocess
|
|
750
327
|
* @param name name of the channel
|
|
@@ -793,14 +370,13 @@ export class Engine extends ThinEngine {
|
|
|
793
370
|
}
|
|
794
371
|
super._rebuildBuffers();
|
|
795
372
|
}
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
super._rebuildTextures();
|
|
373
|
+
/**
|
|
374
|
+
* Get Font size information
|
|
375
|
+
* @param font font name
|
|
376
|
+
* @returns an object containing ascent, height and descent
|
|
377
|
+
*/
|
|
378
|
+
getFontOffset(font) {
|
|
379
|
+
return GetFontOffset(font);
|
|
804
380
|
}
|
|
805
381
|
/** @internal */
|
|
806
382
|
_renderFrame() {
|
|
@@ -857,67 +433,27 @@ export class Engine extends ThinEngine {
|
|
|
857
433
|
_renderViews() {
|
|
858
434
|
return false;
|
|
859
435
|
}
|
|
860
|
-
/**
|
|
861
|
-
* Toggle full screen mode
|
|
862
|
-
* @param requestPointerLock defines if a pointer lock should be requested from the user
|
|
863
|
-
*/
|
|
864
|
-
switchFullscreen(requestPointerLock) {
|
|
865
|
-
if (this.isFullscreen) {
|
|
866
|
-
this.exitFullscreen();
|
|
867
|
-
}
|
|
868
|
-
else {
|
|
869
|
-
this.enterFullscreen(requestPointerLock);
|
|
870
|
-
}
|
|
871
|
-
}
|
|
872
|
-
/**
|
|
873
|
-
* Enters full screen mode
|
|
874
|
-
* @param requestPointerLock defines if a pointer lock should be requested from the user
|
|
875
|
-
*/
|
|
876
|
-
enterFullscreen(requestPointerLock) {
|
|
877
|
-
if (!this.isFullscreen) {
|
|
878
|
-
this._pointerLockRequested = requestPointerLock;
|
|
879
|
-
if (this._renderingCanvas) {
|
|
880
|
-
Engine._RequestFullscreen(this._renderingCanvas);
|
|
881
|
-
}
|
|
882
|
-
}
|
|
883
|
-
}
|
|
884
|
-
/**
|
|
885
|
-
* Exits full screen mode
|
|
886
|
-
*/
|
|
887
|
-
exitFullscreen() {
|
|
888
|
-
if (this.isFullscreen) {
|
|
889
|
-
Engine._ExitFullscreen();
|
|
890
|
-
}
|
|
891
|
-
}
|
|
892
436
|
/**
|
|
893
437
|
* Enters Pointerlock mode
|
|
894
438
|
*/
|
|
895
439
|
enterPointerlock() {
|
|
896
440
|
if (this._renderingCanvas) {
|
|
897
|
-
|
|
441
|
+
RequestPointerlock(this._renderingCanvas);
|
|
898
442
|
}
|
|
899
443
|
}
|
|
900
444
|
/**
|
|
901
445
|
* Exits Pointerlock mode
|
|
902
446
|
*/
|
|
903
447
|
exitPointerlock() {
|
|
904
|
-
|
|
448
|
+
ExitPointerlock();
|
|
905
449
|
}
|
|
906
450
|
/**
|
|
907
451
|
* Begin a new frame
|
|
908
452
|
*/
|
|
909
453
|
beginFrame() {
|
|
910
454
|
this._measureFps();
|
|
911
|
-
this.onBeginFrameObservable.notifyObservers(this);
|
|
912
455
|
super.beginFrame();
|
|
913
456
|
}
|
|
914
|
-
/**
|
|
915
|
-
* End the current frame
|
|
916
|
-
*/
|
|
917
|
-
endFrame() {
|
|
918
|
-
super.endFrame();
|
|
919
|
-
this.onEndFrameObservable.notifyObservers(this);
|
|
920
|
-
}
|
|
921
457
|
/**
|
|
922
458
|
* Force a specific size of the canvas
|
|
923
459
|
* @param width defines the new canvas' width
|
|
@@ -1018,50 +554,6 @@ export class Engine extends ThinEngine {
|
|
|
1018
554
|
});
|
|
1019
555
|
});
|
|
1020
556
|
}
|
|
1021
|
-
/**
|
|
1022
|
-
* Gets the names of the render passes that are currently created
|
|
1023
|
-
* @returns list of the render pass names
|
|
1024
|
-
*/
|
|
1025
|
-
getRenderPassNames() {
|
|
1026
|
-
return this._renderPassNames;
|
|
1027
|
-
}
|
|
1028
|
-
/**
|
|
1029
|
-
* Gets the name of the current render pass
|
|
1030
|
-
* @returns name of the current render pass
|
|
1031
|
-
*/
|
|
1032
|
-
getCurrentRenderPassName() {
|
|
1033
|
-
return this._renderPassNames[this.currentRenderPassId];
|
|
1034
|
-
}
|
|
1035
|
-
/**
|
|
1036
|
-
* Creates a render pass id
|
|
1037
|
-
* @param name Name of the render pass (for debug purpose only)
|
|
1038
|
-
* @returns the id of the new render pass
|
|
1039
|
-
*/
|
|
1040
|
-
createRenderPassId(name) {
|
|
1041
|
-
// Note: render pass id == 0 is always for the main render pass
|
|
1042
|
-
const id = ++Engine._RenderPassIdCounter;
|
|
1043
|
-
this._renderPassNames[id] = name ?? "NONAME";
|
|
1044
|
-
return id;
|
|
1045
|
-
}
|
|
1046
|
-
/**
|
|
1047
|
-
* Releases a render pass id
|
|
1048
|
-
* @param id id of the render pass to release
|
|
1049
|
-
*/
|
|
1050
|
-
releaseRenderPassId(id) {
|
|
1051
|
-
this._renderPassNames[id] = undefined;
|
|
1052
|
-
for (let s = 0; s < this.scenes.length; ++s) {
|
|
1053
|
-
const scene = this.scenes[s];
|
|
1054
|
-
for (let m = 0; m < scene.meshes.length; ++m) {
|
|
1055
|
-
const mesh = scene.meshes[m];
|
|
1056
|
-
if (mesh.subMeshes) {
|
|
1057
|
-
for (let b = 0; b < mesh.subMeshes.length; ++b) {
|
|
1058
|
-
const subMesh = mesh.subMeshes[b];
|
|
1059
|
-
subMesh._removeDrawWrapper(id);
|
|
1060
|
-
}
|
|
1061
|
-
}
|
|
1062
|
-
}
|
|
1063
|
-
}
|
|
1064
|
-
}
|
|
1065
557
|
/**
|
|
1066
558
|
* @internal
|
|
1067
559
|
* Rescales a texture
|
|
@@ -1110,26 +602,6 @@ export class Engine extends ThinEngine {
|
|
|
1110
602
|
});
|
|
1111
603
|
}
|
|
1112
604
|
}
|
|
1113
|
-
// FPS
|
|
1114
|
-
/**
|
|
1115
|
-
* Gets the current framerate
|
|
1116
|
-
* @returns a number representing the framerate
|
|
1117
|
-
*/
|
|
1118
|
-
getFps() {
|
|
1119
|
-
return this._fps;
|
|
1120
|
-
}
|
|
1121
|
-
/**
|
|
1122
|
-
* Gets the time spent between current and previous frame
|
|
1123
|
-
* @returns a number representing the delta time in ms
|
|
1124
|
-
*/
|
|
1125
|
-
getDeltaTime() {
|
|
1126
|
-
return this._deltaTime;
|
|
1127
|
-
}
|
|
1128
|
-
_measureFps() {
|
|
1129
|
-
this._performanceMonitor.sampleFrame();
|
|
1130
|
-
this._fps = this._performanceMonitor.averageFPS;
|
|
1131
|
-
this._deltaTime = this._performanceMonitor.instantaneousFrameTime || 0;
|
|
1132
|
-
}
|
|
1133
605
|
/**
|
|
1134
606
|
* Wraps an external web gl texture in a Babylon texture.
|
|
1135
607
|
* @param texture defines the external texture
|
|
@@ -1279,224 +751,12 @@ export class Engine extends ThinEngine {
|
|
|
1279
751
|
});
|
|
1280
752
|
}
|
|
1281
753
|
dispose() {
|
|
1282
|
-
this.hideLoadingUI();
|
|
1283
|
-
this.onNewSceneAddedObservable.clear();
|
|
1284
|
-
// Release postProcesses
|
|
1285
|
-
while (this.postProcesses.length) {
|
|
1286
|
-
this.postProcesses[0].dispose();
|
|
1287
|
-
}
|
|
1288
754
|
// Rescale PP
|
|
1289
755
|
if (this._rescalePostProcess) {
|
|
1290
756
|
this._rescalePostProcess.dispose();
|
|
1291
757
|
}
|
|
1292
|
-
|
|
1293
|
-
while (this.scenes.length) {
|
|
1294
|
-
this.scenes[0].dispose();
|
|
1295
|
-
}
|
|
1296
|
-
while (this._virtualScenes.length) {
|
|
1297
|
-
this._virtualScenes[0].dispose();
|
|
1298
|
-
}
|
|
1299
|
-
// Release audio engine
|
|
1300
|
-
if (EngineStore.Instances.length === 1 && Engine.audioEngine) {
|
|
1301
|
-
Engine.audioEngine.dispose();
|
|
1302
|
-
Engine.audioEngine = null;
|
|
1303
|
-
}
|
|
1304
|
-
// Events
|
|
1305
|
-
const hostWindow = this.getHostWindow(); // it calls IsWindowObjectExist()
|
|
1306
|
-
if (hostWindow && typeof hostWindow.removeEventListener === "function") {
|
|
1307
|
-
hostWindow.removeEventListener("blur", this._onBlur);
|
|
1308
|
-
hostWindow.removeEventListener("focus", this._onFocus);
|
|
1309
|
-
}
|
|
1310
|
-
if (this._renderingCanvas) {
|
|
1311
|
-
this._renderingCanvas.removeEventListener("focus", this._onCanvasFocus);
|
|
1312
|
-
this._renderingCanvas.removeEventListener("blur", this._onCanvasBlur);
|
|
1313
|
-
this._renderingCanvas.removeEventListener("pointerout", this._onCanvasPointerOut);
|
|
1314
|
-
this._renderingCanvas.removeEventListener("contextmenu", this._onCanvasContextMenu);
|
|
1315
|
-
}
|
|
1316
|
-
if (IsDocumentAvailable()) {
|
|
1317
|
-
document.removeEventListener("fullscreenchange", this._onFullscreenChange);
|
|
1318
|
-
document.removeEventListener("mozfullscreenchange", this._onFullscreenChange);
|
|
1319
|
-
document.removeEventListener("webkitfullscreenchange", this._onFullscreenChange);
|
|
1320
|
-
document.removeEventListener("msfullscreenchange", this._onFullscreenChange);
|
|
1321
|
-
document.removeEventListener("pointerlockchange", this._onPointerLockChange);
|
|
1322
|
-
document.removeEventListener("mspointerlockchange", this._onPointerLockChange);
|
|
1323
|
-
document.removeEventListener("mozpointerlockchange", this._onPointerLockChange);
|
|
1324
|
-
document.removeEventListener("webkitpointerlockchange", this._onPointerLockChange);
|
|
1325
|
-
}
|
|
758
|
+
_CommonDispose(this, this._renderingCanvas);
|
|
1326
759
|
super.dispose();
|
|
1327
|
-
// Remove from Instances
|
|
1328
|
-
const index = EngineStore.Instances.indexOf(this);
|
|
1329
|
-
if (index >= 0) {
|
|
1330
|
-
EngineStore.Instances.splice(index, 1);
|
|
1331
|
-
}
|
|
1332
|
-
// no more engines left in the engine store? Notify!
|
|
1333
|
-
if (!Engine.Instances.length) {
|
|
1334
|
-
EngineStore.OnEnginesDisposedObservable.notifyObservers(this);
|
|
1335
|
-
}
|
|
1336
|
-
// Observables
|
|
1337
|
-
this.onResizeObservable.clear();
|
|
1338
|
-
this.onCanvasBlurObservable.clear();
|
|
1339
|
-
this.onCanvasFocusObservable.clear();
|
|
1340
|
-
this.onCanvasPointerOutObservable.clear();
|
|
1341
|
-
this.onBeginFrameObservable.clear();
|
|
1342
|
-
this.onEndFrameObservable.clear();
|
|
1343
|
-
}
|
|
1344
|
-
_disableTouchAction() {
|
|
1345
|
-
if (!this._renderingCanvas || !this._renderingCanvas.setAttribute) {
|
|
1346
|
-
return;
|
|
1347
|
-
}
|
|
1348
|
-
this._renderingCanvas.setAttribute("touch-action", "none");
|
|
1349
|
-
this._renderingCanvas.style.touchAction = "none";
|
|
1350
|
-
this._renderingCanvas.style.webkitTapHighlightColor = "transparent";
|
|
1351
|
-
}
|
|
1352
|
-
// Loading screen
|
|
1353
|
-
/**
|
|
1354
|
-
* Display the loading screen
|
|
1355
|
-
* @see https://doc.babylonjs.com/features/featuresDeepDive/scene/customLoadingScreen
|
|
1356
|
-
*/
|
|
1357
|
-
displayLoadingUI() {
|
|
1358
|
-
if (!IsWindowObjectExist()) {
|
|
1359
|
-
return;
|
|
1360
|
-
}
|
|
1361
|
-
const loadingScreen = this.loadingScreen;
|
|
1362
|
-
if (loadingScreen) {
|
|
1363
|
-
loadingScreen.displayLoadingUI();
|
|
1364
|
-
}
|
|
1365
|
-
}
|
|
1366
|
-
/**
|
|
1367
|
-
* Hide the loading screen
|
|
1368
|
-
* @see https://doc.babylonjs.com/features/featuresDeepDive/scene/customLoadingScreen
|
|
1369
|
-
*/
|
|
1370
|
-
hideLoadingUI() {
|
|
1371
|
-
if (!IsWindowObjectExist()) {
|
|
1372
|
-
return;
|
|
1373
|
-
}
|
|
1374
|
-
const loadingScreen = this._loadingScreen;
|
|
1375
|
-
if (loadingScreen) {
|
|
1376
|
-
loadingScreen.hideLoadingUI();
|
|
1377
|
-
}
|
|
1378
|
-
}
|
|
1379
|
-
/**
|
|
1380
|
-
* Gets the current loading screen object
|
|
1381
|
-
* @see https://doc.babylonjs.com/features/featuresDeepDive/scene/customLoadingScreen
|
|
1382
|
-
*/
|
|
1383
|
-
get loadingScreen() {
|
|
1384
|
-
if (!this._loadingScreen && this._renderingCanvas) {
|
|
1385
|
-
this._loadingScreen = Engine.DefaultLoadingScreenFactory(this._renderingCanvas);
|
|
1386
|
-
}
|
|
1387
|
-
return this._loadingScreen;
|
|
1388
|
-
}
|
|
1389
|
-
/**
|
|
1390
|
-
* Sets the current loading screen object
|
|
1391
|
-
* @see https://doc.babylonjs.com/features/featuresDeepDive/scene/customLoadingScreen
|
|
1392
|
-
*/
|
|
1393
|
-
set loadingScreen(loadingScreen) {
|
|
1394
|
-
this._loadingScreen = loadingScreen;
|
|
1395
|
-
}
|
|
1396
|
-
/**
|
|
1397
|
-
* Sets the current loading screen text
|
|
1398
|
-
* @see https://doc.babylonjs.com/features/featuresDeepDive/scene/customLoadingScreen
|
|
1399
|
-
*/
|
|
1400
|
-
set loadingUIText(text) {
|
|
1401
|
-
this.loadingScreen.loadingUIText = text;
|
|
1402
|
-
}
|
|
1403
|
-
/**
|
|
1404
|
-
* Sets the current loading screen background color
|
|
1405
|
-
* @see https://doc.babylonjs.com/features/featuresDeepDive/scene/customLoadingScreen
|
|
1406
|
-
*/
|
|
1407
|
-
set loadingUIBackgroundColor(color) {
|
|
1408
|
-
this.loadingScreen.loadingUIBackgroundColor = color;
|
|
1409
|
-
}
|
|
1410
|
-
/**
|
|
1411
|
-
* creates and returns a new video element
|
|
1412
|
-
* @param constraints video constraints
|
|
1413
|
-
* @returns video element
|
|
1414
|
-
*/
|
|
1415
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1416
|
-
createVideoElement(constraints) {
|
|
1417
|
-
return document.createElement("video");
|
|
1418
|
-
}
|
|
1419
|
-
/** Pointerlock and fullscreen */
|
|
1420
|
-
/**
|
|
1421
|
-
* Ask the browser to promote the current element to pointerlock mode
|
|
1422
|
-
* @param element defines the DOM element to promote
|
|
1423
|
-
*/
|
|
1424
|
-
static _RequestPointerlock(element) {
|
|
1425
|
-
if (element.requestPointerLock) {
|
|
1426
|
-
// In some browsers, requestPointerLock returns a promise.
|
|
1427
|
-
// Handle possible rejections to avoid an unhandled top-level exception.
|
|
1428
|
-
const promise = element.requestPointerLock();
|
|
1429
|
-
if (promise instanceof Promise)
|
|
1430
|
-
promise
|
|
1431
|
-
.then(() => {
|
|
1432
|
-
element.focus();
|
|
1433
|
-
})
|
|
1434
|
-
.catch(() => { });
|
|
1435
|
-
else
|
|
1436
|
-
element.focus();
|
|
1437
|
-
}
|
|
1438
|
-
}
|
|
1439
|
-
/**
|
|
1440
|
-
* Asks the browser to exit pointerlock mode
|
|
1441
|
-
*/
|
|
1442
|
-
static _ExitPointerlock() {
|
|
1443
|
-
if (document.exitPointerLock) {
|
|
1444
|
-
document.exitPointerLock();
|
|
1445
|
-
}
|
|
1446
|
-
}
|
|
1447
|
-
/**
|
|
1448
|
-
* Ask the browser to promote the current element to fullscreen rendering mode
|
|
1449
|
-
* @param element defines the DOM element to promote
|
|
1450
|
-
*/
|
|
1451
|
-
static _RequestFullscreen(element) {
|
|
1452
|
-
const requestFunction = element.requestFullscreen || element.webkitRequestFullscreen;
|
|
1453
|
-
if (!requestFunction) {
|
|
1454
|
-
return;
|
|
1455
|
-
}
|
|
1456
|
-
requestFunction.call(element);
|
|
1457
|
-
}
|
|
1458
|
-
/**
|
|
1459
|
-
* Asks the browser to exit fullscreen mode
|
|
1460
|
-
*/
|
|
1461
|
-
static _ExitFullscreen() {
|
|
1462
|
-
const anyDoc = document;
|
|
1463
|
-
if (document.exitFullscreen) {
|
|
1464
|
-
document.exitFullscreen();
|
|
1465
|
-
}
|
|
1466
|
-
else if (anyDoc.webkitCancelFullScreen) {
|
|
1467
|
-
anyDoc.webkitCancelFullScreen();
|
|
1468
|
-
}
|
|
1469
|
-
}
|
|
1470
|
-
/**
|
|
1471
|
-
* Get Font size information
|
|
1472
|
-
* @param font font name
|
|
1473
|
-
* @returns an object containing ascent, height and descent
|
|
1474
|
-
*/
|
|
1475
|
-
getFontOffset(font) {
|
|
1476
|
-
const text = document.createElement("span");
|
|
1477
|
-
text.innerHTML = "Hg";
|
|
1478
|
-
text.setAttribute("style", `font: ${font} !important`);
|
|
1479
|
-
const block = document.createElement("div");
|
|
1480
|
-
block.style.display = "inline-block";
|
|
1481
|
-
block.style.width = "1px";
|
|
1482
|
-
block.style.height = "0px";
|
|
1483
|
-
block.style.verticalAlign = "bottom";
|
|
1484
|
-
const div = document.createElement("div");
|
|
1485
|
-
div.style.whiteSpace = "nowrap";
|
|
1486
|
-
div.appendChild(text);
|
|
1487
|
-
div.appendChild(block);
|
|
1488
|
-
document.body.appendChild(div);
|
|
1489
|
-
let fontAscent = 0;
|
|
1490
|
-
let fontHeight = 0;
|
|
1491
|
-
try {
|
|
1492
|
-
fontHeight = block.getBoundingClientRect().top - text.getBoundingClientRect().top;
|
|
1493
|
-
block.style.verticalAlign = "baseline";
|
|
1494
|
-
fontAscent = block.getBoundingClientRect().top - text.getBoundingClientRect().top;
|
|
1495
|
-
}
|
|
1496
|
-
finally {
|
|
1497
|
-
document.body.removeChild(div);
|
|
1498
|
-
}
|
|
1499
|
-
return { ascent: fontAscent, height: fontHeight, descent: fontHeight - fontAscent };
|
|
1500
760
|
}
|
|
1501
761
|
}
|
|
1502
762
|
// Const statics
|
|
@@ -1691,10 +951,4 @@ Engine.SCALEMODE_FLOOR = 1;
|
|
|
1691
951
|
Engine.SCALEMODE_NEAREST = 2;
|
|
1692
952
|
/** Defines that texture rescaling will use a ceil to find the closer power of 2 size */
|
|
1693
953
|
Engine.SCALEMODE_CEILING = 3;
|
|
1694
|
-
/**
|
|
1695
|
-
* Method called to create the default rescale post process on each engine.
|
|
1696
|
-
*/
|
|
1697
|
-
Engine._RescalePostProcessFactory = null;
|
|
1698
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
1699
|
-
Engine._RenderPassIdCounter = 0;
|
|
1700
954
|
//# sourceMappingURL=engine.js.map
|