@babylonjs/core 5.26.1 → 5.27.1
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/animatable.js +2 -1
- package/Animations/animatable.js.map +1 -1
- package/Animations/runtimeAnimation.js +1 -1
- package/Animations/runtimeAnimation.js.map +1 -1
- package/Audio/audioSceneComponent.js +2 -1
- package/Audio/audioSceneComponent.js.map +1 -1
- package/Audio/sound.js +70 -45
- package/Audio/sound.js.map +1 -1
- package/Audio/soundTrack.js +12 -6
- package/Audio/soundTrack.js.map +1 -1
- package/BakedVertexAnimation/bakedVertexAnimationManager.js +2 -1
- package/BakedVertexAnimation/bakedVertexAnimationManager.js.map +1 -1
- package/Behaviors/Cameras/autoRotationBehavior.js +1 -1
- package/Behaviors/Cameras/autoRotationBehavior.js.map +1 -1
- package/Behaviors/Meshes/followBehavior.js +2 -1
- package/Behaviors/Meshes/followBehavior.js.map +1 -1
- package/Behaviors/Meshes/handConstraintBehavior.js +2 -2
- package/Behaviors/Meshes/handConstraintBehavior.js.map +1 -1
- package/Bones/bone.js +2 -1
- package/Bones/bone.js.map +1 -1
- package/Bones/skeleton.js +3 -2
- package/Bones/skeleton.js.map +1 -1
- package/Cameras/Inputs/BaseCameraPointersInput.js +2 -2
- package/Cameras/Inputs/BaseCameraPointersInput.js.map +1 -1
- package/Cameras/Inputs/arcRotateCameraMouseWheelInput.js +5 -3
- package/Cameras/Inputs/arcRotateCameraMouseWheelInput.js.map +1 -1
- package/Cameras/Inputs/flyCameraMouseInput.js +2 -2
- package/Cameras/Inputs/flyCameraMouseInput.js.map +1 -1
- package/Cameras/Inputs/freeCameraMouseInput.js +2 -2
- package/Cameras/Inputs/freeCameraMouseInput.js.map +1 -1
- package/Cameras/arcRotateCamera.js +2 -1
- package/Cameras/arcRotateCamera.js.map +1 -1
- package/Cameras/camera.js +6 -4
- package/Cameras/camera.js.map +1 -1
- package/Compute/computeEffect.js +8 -5
- package/Compute/computeEffect.js.map +1 -1
- package/Compute/computeShader.js +12 -11
- package/Compute/computeShader.js.map +1 -1
- package/Culling/Octrees/octreeSceneComponent.js +2 -1
- package/Culling/Octrees/octreeSceneComponent.js.map +1 -1
- package/Culling/boundingBox.js +3 -2
- package/Culling/boundingBox.js.map +1 -1
- package/Culling/ray.js +2 -1
- package/Culling/ray.js.map +1 -1
- package/Debug/debugLayer.d.ts +3 -3
- package/Debug/debugLayer.js +2 -2
- package/Debug/debugLayer.js.map +1 -1
- package/Debug/directionalLightFrustumViewer.js +9 -7
- package/Debug/directionalLightFrustumViewer.js.map +1 -1
- package/Debug/rayHelper.js +2 -1
- package/Debug/rayHelper.js.map +1 -1
- package/Debug/skeletonViewer.js +29 -24
- package/Debug/skeletonViewer.js.map +1 -1
- package/DeviceInput/InputDevices/deviceSourceManager.js +5 -3
- package/DeviceInput/InputDevices/deviceSourceManager.js.map +1 -1
- package/DeviceInput/internalDeviceSourceManager.js +2 -1
- package/DeviceInput/internalDeviceSourceManager.js.map +1 -1
- package/DeviceInput/webDeviceInputSystem.js +12 -9
- package/DeviceInput/webDeviceInputSystem.js.map +1 -1
- package/Engines/Extensions/engine.rawTexture.js +4 -4
- package/Engines/Extensions/engine.rawTexture.js.map +1 -1
- package/Engines/Extensions/engine.readTexture.js +3 -2
- package/Engines/Extensions/engine.readTexture.js.map +1 -1
- package/Engines/Extensions/engine.views.js +2 -1
- package/Engines/Extensions/engine.views.js.map +1 -1
- package/Engines/Processors/shaderProcessor.js +11 -6
- package/Engines/Processors/shaderProcessor.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.cubeTexture.js +1 -1
- package/Engines/WebGPU/Extensions/engine.cubeTexture.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.dynamicTexture.js +2 -1
- package/Engines/WebGPU/Extensions/engine.dynamicTexture.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.multiRender.js +2 -1
- package/Engines/WebGPU/Extensions/engine.multiRender.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.query.js +4 -2
- package/Engines/WebGPU/Extensions/engine.query.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.rawTexture.js +4 -4
- package/Engines/WebGPU/Extensions/engine.rawTexture.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.renderTarget.js +2 -1
- package/Engines/WebGPU/Extensions/engine.renderTarget.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.storageBuffer.js +3 -2
- package/Engines/WebGPU/Extensions/engine.storageBuffer.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.textureSampler.js +2 -1
- package/Engines/WebGPU/Extensions/engine.textureSampler.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.videoTexture.js +2 -1
- package/Engines/WebGPU/Extensions/engine.videoTexture.js.map +1 -1
- package/Engines/WebGPU/webgpuCacheBindGroups.js +7 -6
- package/Engines/WebGPU/webgpuCacheBindGroups.js.map +1 -1
- package/Engines/WebGPU/webgpuCacheRenderPipeline.js +18 -14
- package/Engines/WebGPU/webgpuCacheRenderPipeline.js.map +1 -1
- package/Engines/WebGPU/webgpuCacheSampler.js +4 -3
- package/Engines/WebGPU/webgpuCacheSampler.js.map +1 -1
- package/Engines/WebGPU/webgpuClearQuad.js +3 -2
- package/Engines/WebGPU/webgpuClearQuad.js.map +1 -1
- package/Engines/WebGPU/webgpuComputePipelineContext.js +2 -1
- package/Engines/WebGPU/webgpuComputePipelineContext.js.map +1 -1
- package/Engines/WebGPU/webgpuDepthCullingState.js +2 -2
- package/Engines/WebGPU/webgpuDepthCullingState.js.map +1 -1
- package/Engines/WebGPU/webgpuDrawContext.js +2 -1
- package/Engines/WebGPU/webgpuDrawContext.js.map +1 -1
- package/Engines/WebGPU/webgpuHardwareTexture.js +4 -3
- package/Engines/WebGPU/webgpuHardwareTexture.js.map +1 -1
- package/Engines/WebGPU/webgpuMaterialContext.js +5 -4
- package/Engines/WebGPU/webgpuMaterialContext.js.map +1 -1
- package/Engines/WebGPU/webgpuOcclusionQuery.js +5 -3
- package/Engines/WebGPU/webgpuOcclusionQuery.js.map +1 -1
- package/Engines/WebGPU/webgpuPipelineContext.js +4 -2
- package/Engines/WebGPU/webgpuPipelineContext.js.map +1 -1
- package/Engines/WebGPU/webgpuShaderProcessingContext.js +4 -2
- package/Engines/WebGPU/webgpuShaderProcessingContext.js.map +1 -1
- package/Engines/WebGPU/webgpuShaderProcessorsGLSL.js +2 -1
- package/Engines/WebGPU/webgpuShaderProcessorsGLSL.js.map +1 -1
- package/Engines/WebGPU/webgpuSnapshotRendering.js +3 -2
- package/Engines/WebGPU/webgpuSnapshotRendering.js.map +1 -1
- package/Engines/WebGPU/webgpuStencilStateComposer.js +2 -1
- package/Engines/WebGPU/webgpuStencilStateComposer.js.map +1 -1
- package/Engines/WebGPU/webgpuTextureHelper.js +40 -38
- package/Engines/WebGPU/webgpuTextureHelper.js.map +1 -1
- package/Engines/engine.js +5 -3
- package/Engines/engine.js.map +1 -1
- package/Engines/nativeEngine.js +7 -5
- package/Engines/nativeEngine.js.map +1 -1
- package/Engines/renderTargetWrapper.js +14 -9
- package/Engines/renderTargetWrapper.js.map +1 -1
- package/Engines/thinEngine.js +29 -20
- package/Engines/thinEngine.js.map +1 -1
- package/Engines/webgpuEngine.js +87 -61
- package/Engines/webgpuEngine.js.map +1 -1
- package/Gamepads/gamepadManager.js +1 -1
- package/Gamepads/gamepadManager.js.map +1 -1
- package/Gizmos/axisDragGizmo.js +4 -2
- package/Gizmos/axisDragGizmo.js.map +1 -1
- package/Gizmos/axisScaleGizmo.js +6 -4
- package/Gizmos/axisScaleGizmo.js.map +1 -1
- package/Gizmos/gizmo.js +21 -6
- package/Gizmos/gizmo.js.map +1 -1
- package/Gizmos/gizmoManager.js +3 -2
- package/Gizmos/gizmoManager.js.map +1 -1
- package/Gizmos/planeDragGizmo.js +4 -2
- package/Gizmos/planeDragGizmo.js.map +1 -1
- package/Gizmos/planeRotationGizmo.js +4 -2
- package/Gizmos/planeRotationGizmo.js.map +1 -1
- package/Helpers/videoDome.js +2 -1
- package/Helpers/videoDome.js.map +1 -1
- package/Inputs/scene.inputManager.js +1 -1
- package/Inputs/scene.inputManager.js.map +1 -1
- package/Layers/effectLayer.js +5 -3
- package/Layers/effectLayer.js.map +1 -1
- package/Layers/glowLayer.d.ts +5 -0
- package/Layers/glowLayer.js +25 -11
- package/Layers/glowLayer.js.map +1 -1
- package/Layers/highlightLayer.js +2 -1
- package/Layers/highlightLayer.js.map +1 -1
- package/LensFlares/lensFlareSystem.js +2 -1
- package/LensFlares/lensFlareSystem.js.map +1 -1
- package/Lights/Shadows/cascadedShadowGenerator.js +25 -21
- package/Lights/Shadows/cascadedShadowGenerator.js.map +1 -1
- package/Lights/Shadows/shadowGenerator.js +13 -8
- package/Lights/Shadows/shadowGenerator.js.map +1 -1
- package/Loading/Plugins/babylonFileLoader.js +5 -4
- package/Loading/Plugins/babylonFileLoader.js.map +1 -1
- package/Loading/sceneLoader.js +1 -1
- package/Loading/sceneLoader.js.map +1 -1
- package/Materials/Node/Blocks/Dual/imageSourceBlock.js +2 -1
- package/Materials/Node/Blocks/Dual/imageSourceBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js +2 -1
- package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/textureBlock.js +10 -6
- package/Materials/Node/Blocks/Dual/textureBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/TBNBlock.js +3 -2
- package/Materials/Node/Blocks/Fragment/TBNBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js +2 -1
- package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/imageProcessingBlock.js +2 -1
- package/Materials/Node/Blocks/Fragment/imageProcessingBlock.js.map +1 -1
- package/Materials/Node/Blocks/Input/inputBlock.js +2 -1
- package/Materials/Node/Blocks/Input/inputBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/clearCoatBlock.js +26 -24
- package/Materials/Node/Blocks/PBR/clearCoatBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/iridescenceBlock.js +3 -3
- package/Materials/Node/Blocks/PBR/iridescenceBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js +48 -44
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/reflectionBlock.js +2 -1
- package/Materials/Node/Blocks/PBR/reflectionBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/refractionBlock.js +2 -1
- package/Materials/Node/Blocks/PBR/refractionBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/sheenBlock.js +13 -13
- package/Materials/Node/Blocks/PBR/sheenBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/subSurfaceBlock.js +27 -26
- package/Materials/Node/Blocks/PBR/subSurfaceBlock.js.map +1 -1
- package/Materials/Node/Blocks/Vertex/instancesBlock.js +2 -2
- package/Materials/Node/Blocks/Vertex/instancesBlock.js.map +1 -1
- package/Materials/Node/Blocks/Vertex/morphTargetsBlock.js +6 -6
- package/Materials/Node/Blocks/Vertex/morphTargetsBlock.js.map +1 -1
- package/Materials/Node/Blocks/cloudBlock.js +3 -2
- package/Materials/Node/Blocks/cloudBlock.js.map +1 -1
- package/Materials/Node/Blocks/colorMergerBlock.js +5 -4
- package/Materials/Node/Blocks/colorMergerBlock.js.map +1 -1
- package/Materials/Node/Blocks/customBlock.js +4 -3
- package/Materials/Node/Blocks/customBlock.js.map +1 -1
- package/Materials/Node/Blocks/vectorMergerBlock.js +5 -4
- package/Materials/Node/Blocks/vectorMergerBlock.js.map +1 -1
- package/Materials/Node/nodeMaterial.js +7 -6
- package/Materials/Node/nodeMaterial.js.map +1 -1
- package/Materials/Node/nodeMaterialBlock.js +4 -3
- package/Materials/Node/nodeMaterialBlock.js.map +1 -1
- package/Materials/Node/nodeMaterialDecorator.js +1 -1
- package/Materials/Node/nodeMaterialDecorator.js.map +1 -1
- package/Materials/PBR/pbrAnisotropicConfiguration.js +2 -0
- package/Materials/PBR/pbrAnisotropicConfiguration.js.map +1 -1
- package/Materials/PBR/pbrBaseMaterial.js +25 -19
- package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
- package/Materials/PBR/pbrClearCoatConfiguration.js +16 -6
- package/Materials/PBR/pbrClearCoatConfiguration.js.map +1 -1
- package/Materials/PBR/pbrIridescenceConfiguration.js +9 -4
- package/Materials/PBR/pbrIridescenceConfiguration.js.map +1 -1
- package/Materials/PBR/pbrSheenConfiguration.js +10 -4
- package/Materials/PBR/pbrSheenConfiguration.js.map +1 -1
- package/Materials/PBR/pbrSubSurfaceConfiguration.js +22 -0
- package/Materials/PBR/pbrSubSurfaceConfiguration.js.map +1 -1
- package/Materials/Textures/Loaders/envTextureLoader.js +2 -2
- package/Materials/Textures/Loaders/envTextureLoader.js.map +1 -1
- package/Materials/Textures/Packer/packer.js +14 -13
- package/Materials/Textures/Packer/packer.js.map +1 -1
- package/Materials/Textures/Procedurals/customProceduralTexture.d.ts +2 -1
- package/Materials/Textures/Procedurals/customProceduralTexture.js.map +1 -1
- package/Materials/Textures/Procedurals/noiseProceduralTexture.js +2 -1
- package/Materials/Textures/Procedurals/noiseProceduralTexture.js.map +1 -1
- package/Materials/Textures/Procedurals/proceduralTexture.js +7 -4
- package/Materials/Textures/Procedurals/proceduralTexture.js.map +1 -1
- package/Materials/Textures/cubeTexture.js +8 -4
- package/Materials/Textures/cubeTexture.js.map +1 -1
- package/Materials/Textures/hdrCubeTexture.js +4 -2
- package/Materials/Textures/hdrCubeTexture.js.map +1 -1
- package/Materials/Textures/internalTexture.js +4 -2
- package/Materials/Textures/internalTexture.js.map +1 -1
- package/Materials/Textures/mirrorTexture.js +6 -3
- package/Materials/Textures/mirrorTexture.js.map +1 -1
- package/Materials/Textures/multiRenderTarget.js +6 -4
- package/Materials/Textures/multiRenderTarget.js.map +1 -1
- package/Materials/Textures/rawTexture.js +1 -1
- package/Materials/Textures/rawTexture.js.map +1 -1
- package/Materials/Textures/renderTargetTexture.js +26 -15
- package/Materials/Textures/renderTargetTexture.js.map +1 -1
- package/Materials/Textures/texture.d.ts +7 -2
- package/Materials/Textures/texture.js +49 -41
- package/Materials/Textures/texture.js.map +1 -1
- package/Materials/Textures/thinRenderTargetTexture.js +4 -2
- package/Materials/Textures/thinRenderTargetTexture.js.map +1 -1
- package/Materials/Textures/videoTexture.js +3 -3
- package/Materials/Textures/videoTexture.js.map +1 -1
- package/Materials/drawWrapper.js +4 -2
- package/Materials/drawWrapper.js.map +1 -1
- package/Materials/effect.js +15 -10
- package/Materials/effect.js.map +1 -1
- package/Materials/material.d.ts +14 -0
- package/Materials/material.detailMapConfiguration.js +2 -1
- package/Materials/material.detailMapConfiguration.js.map +1 -1
- package/Materials/material.js +35 -3
- package/Materials/material.js.map +1 -1
- package/Materials/materialDefines.js +6 -5
- package/Materials/materialDefines.js.map +1 -1
- package/Materials/materialHelper.js +1 -1
- package/Materials/materialHelper.js.map +1 -1
- package/Materials/materialPluginManager.js +3 -2
- package/Materials/materialPluginManager.js.map +1 -1
- package/Materials/multiMaterial.js +2 -1
- package/Materials/multiMaterial.js.map +1 -1
- package/Materials/shaderMaterial.js +12 -9
- package/Materials/shaderMaterial.js.map +1 -1
- package/Materials/shadowDepthWrapper.js +13 -8
- package/Materials/shadowDepthWrapper.js.map +1 -1
- package/Materials/standardMaterial.js +12 -10
- package/Materials/standardMaterial.js.map +1 -1
- package/Materials/uniformBuffer.js +1 -1
- package/Materials/uniformBuffer.js.map +1 -1
- package/Maths/math.polar.d.ts +2 -2
- package/Maths/math.polar.js +4 -4
- package/Maths/math.polar.js.map +1 -1
- package/Maths/math.vector.d.ts +69 -7
- package/Maths/math.vector.js +72 -9
- package/Maths/math.vector.js.map +1 -1
- package/Meshes/Builders/groundBuilder.js +1 -1
- package/Meshes/Builders/groundBuilder.js.map +1 -1
- package/Meshes/abstractMesh.d.ts +8 -0
- package/Meshes/abstractMesh.js +20 -5
- package/Meshes/abstractMesh.js.map +1 -1
- package/Meshes/csg.js +2 -1
- package/Meshes/csg.js.map +1 -1
- package/Meshes/instancedMesh.js +2 -1
- package/Meshes/instancedMesh.js.map +1 -1
- package/Meshes/mesh.js +25 -13
- package/Meshes/mesh.js.map +1 -1
- package/Meshes/mesh.vertexData.js +4 -3
- package/Meshes/mesh.vertexData.js.map +1 -1
- package/Meshes/subMesh.js +14 -8
- package/Meshes/subMesh.js.map +1 -1
- package/Meshes/thinInstanceMesh.js +18 -12
- package/Meshes/thinInstanceMesh.js.map +1 -1
- package/Meshes/transformNode.js +4 -3
- package/Meshes/transformNode.js.map +1 -1
- package/Misc/HighDynamicRange/cubemapToSphericalPolynomial.js +2 -1
- package/Misc/HighDynamicRange/cubemapToSphericalPolynomial.js.map +1 -1
- package/Misc/PerformanceViewer/performanceViewerCollectionStrategies.js +12 -8
- package/Misc/PerformanceViewer/performanceViewerCollectionStrategies.js.map +1 -1
- package/Misc/PerformanceViewer/performanceViewerCollector.js +3 -2
- package/Misc/PerformanceViewer/performanceViewerCollector.js.map +1 -1
- package/Misc/arrayTools.js +1 -1
- package/Misc/arrayTools.js.map +1 -1
- package/Misc/computePressure.js +9 -6
- package/Misc/computePressure.js.map +1 -1
- package/Misc/dataStorage.js +1 -1
- package/Misc/dataStorage.js.map +1 -1
- package/Misc/environmentTextureTools.js +2 -1
- package/Misc/environmentTextureTools.js.map +1 -1
- package/Misc/fileTools.js +31 -8
- package/Misc/fileTools.js.map +1 -1
- package/Misc/logger.js +2 -1
- package/Misc/logger.js.map +1 -1
- package/Misc/minMaxReducer.js +3 -2
- package/Misc/minMaxReducer.js.map +1 -1
- package/Misc/sceneRecorder.js +1 -1
- package/Misc/sceneRecorder.js.map +1 -1
- package/Misc/screenshotTools.js +2 -12
- package/Misc/screenshotTools.js.map +1 -1
- package/Misc/textureTools.js +3 -3
- package/Misc/textureTools.js.map +1 -1
- package/Misc/timer.js +5 -3
- package/Misc/timer.js.map +1 -1
- package/Misc/tools.d.ts +2 -8
- package/Misc/tools.js +6 -6
- package/Misc/tools.js.map +1 -1
- package/Misc/trajectoryClassifier.js +3 -3
- package/Misc/trajectoryClassifier.js.map +1 -1
- package/Particles/EmitterTypes/meshParticleEmitter.js +2 -1
- package/Particles/EmitterTypes/meshParticleEmitter.js.map +1 -1
- package/Particles/computeShaderParticleSystem.js +6 -3
- package/Particles/computeShaderParticleSystem.js.map +1 -1
- package/Particles/gpuParticleSystem.js +13 -8
- package/Particles/gpuParticleSystem.js.map +1 -1
- package/Particles/particleSystem.js +22 -14
- package/Particles/particleSystem.js.map +1 -1
- package/Particles/particleSystemComponent.js +2 -1
- package/Particles/particleSystemComponent.js.map +1 -1
- package/Particles/pointsCloudSystem.js +7 -4
- package/Particles/pointsCloudSystem.js.map +1 -1
- package/Particles/solidParticleSystem.js +2 -2
- package/Particles/solidParticleSystem.js.map +1 -1
- package/Particles/webgl2ParticleSystem.js +2 -1
- package/Particles/webgl2ParticleSystem.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js +5 -4
- package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js.map +1 -1
- package/PostProcesses/blackAndWhitePostProcess.d.ts +1 -1
- package/PostProcesses/blackAndWhitePostProcess.js.map +1 -1
- package/PostProcesses/colorCorrectionPostProcess.d.ts +1 -1
- package/PostProcesses/colorCorrectionPostProcess.js +2 -1
- package/PostProcesses/colorCorrectionPostProcess.js.map +1 -1
- package/PostProcesses/postProcess.js +8 -5
- package/PostProcesses/postProcess.js.map +1 -1
- package/PostProcesses/postProcessManager.js +6 -4
- package/PostProcesses/postProcessManager.js.map +1 -1
- package/PostProcesses/refractionPostProcess.d.ts +2 -1
- package/PostProcesses/refractionPostProcess.js.map +1 -1
- package/PostProcesses/screenSpaceReflectionPostProcess.js +1 -1
- package/PostProcesses/screenSpaceReflectionPostProcess.js.map +1 -1
- package/PostProcesses/tonemapPostProcess.d.ts +2 -1
- package/PostProcesses/tonemapPostProcess.js.map +1 -1
- package/PostProcesses/volumetricLightScatteringPostProcess.d.ts +2 -1
- package/PostProcesses/volumetricLightScatteringPostProcess.js +7 -4
- package/PostProcesses/volumetricLightScatteringPostProcess.js.map +1 -1
- package/PostProcesses/vrDistortionCorrectionPostProcess.d.ts +2 -1
- package/PostProcesses/vrDistortionCorrectionPostProcess.js.map +1 -1
- package/PostProcesses/vrMultiviewToSingleviewPostProcess.d.ts +2 -1
- package/PostProcesses/vrMultiviewToSingleviewPostProcess.js +3 -2
- package/PostProcesses/vrMultiviewToSingleviewPostProcess.js.map +1 -1
- package/Probes/reflectionProbe.js +4 -2
- package/Probes/reflectionProbe.js.map +1 -1
- package/Rendering/boundingBoxRenderer.js +3 -2
- package/Rendering/boundingBoxRenderer.js.map +1 -1
- package/Rendering/depthPeelingRenderer.d.ts +12 -0
- package/Rendering/depthPeelingRenderer.js +30 -6
- package/Rendering/depthPeelingRenderer.js.map +1 -1
- package/Rendering/depthPeelingSceneComponent.js +4 -2
- package/Rendering/depthPeelingSceneComponent.js.map +1 -1
- package/Rendering/depthRenderer.js +10 -6
- package/Rendering/depthRenderer.js.map +1 -1
- package/Rendering/edgesRenderer.js +11 -8
- package/Rendering/edgesRenderer.js.map +1 -1
- package/Rendering/outlineRenderer.js +2 -2
- package/Rendering/outlineRenderer.js.map +1 -1
- package/Rendering/prePassRenderer.js +4 -2
- package/Rendering/prePassRenderer.js.map +1 -1
- package/Shaders/pbr.fragment.js +4 -1
- package/Shaders/pbr.fragment.js.map +1 -1
- package/Sprites/spriteManager.js +2 -1
- package/Sprites/spriteManager.js.map +1 -1
- package/Sprites/spriteRenderer.js +2 -1
- package/Sprites/spriteRenderer.js.map +1 -1
- package/States/stencilStateComposer.js +4 -2
- package/States/stencilStateComposer.js.map +1 -1
- package/XR/features/WebXRAnchorSystem.js +2 -1
- package/XR/features/WebXRAnchorSystem.js.map +1 -1
- package/XR/features/WebXRControllerMovement.js +7 -6
- package/XR/features/WebXRControllerMovement.js.map +1 -1
- package/XR/features/WebXRControllerPhysics.js +6 -4
- package/XR/features/WebXRControllerPhysics.js.map +1 -1
- package/XR/features/WebXRControllerPointerSelection.js +2 -1
- package/XR/features/WebXRControllerPointerSelection.js.map +1 -1
- package/XR/features/WebXRHandTracking.js +26 -18
- package/XR/features/WebXRHandTracking.js.map +1 -1
- package/XR/features/WebXRLayers.js +1 -1
- package/XR/features/WebXRLayers.js.map +1 -1
- package/XR/features/WebXRLightEstimation.js +6 -3
- package/XR/features/WebXRLightEstimation.js.map +1 -1
- package/XR/features/WebXRMeshDetector.js +2 -1
- package/XR/features/WebXRMeshDetector.js.map +1 -1
- package/XR/features/WebXRNearInteraction.js +7 -4
- package/XR/features/WebXRNearInteraction.js.map +1 -1
- package/XR/features/WebXRPlaneDetector.js +2 -1
- package/XR/features/WebXRPlaneDetector.js.map +1 -1
- package/XR/native/nativeXRFrame.js +2 -1
- package/XR/native/nativeXRFrame.js.map +1 -1
- package/XR/webXRCamera.js +2 -1
- package/XR/webXRCamera.js.map +1 -1
- package/XR/webXRExperienceHelper.js +7 -5
- package/XR/webXRExperienceHelper.js.map +1 -1
- package/XR/webXRInputSource.js +2 -1
- package/XR/webXRInputSource.js.map +1 -1
- package/XR/webXRSessionManager.js +27 -14
- package/XR/webXRSessionManager.js.map +1 -1
- package/package.json +1 -1
- package/scene.js +17 -11
- package/scene.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webDeviceInputSystem.js","sourceRoot":"","sources":["../../../../../lts/core/generated/DeviceInput/webDeviceInputSystem.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEtD,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,YAAY,EA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ACjC;QAED,OAAO,UAAU,CAAC;IACtB,CAAC;CACJ","sourcesContent":["import type { Engine } from \"../Engines/engine\";\r\nimport type { IPointerEvent, IUIEvent } from \"../Events/deviceInputEvents\";\r\nimport { DomManagement } from \"../Misc/domManagement\";\r\nimport type { Observer } from \"../Misc/observable\";\r\nimport { Tools } from \"../Misc/tools\";\r\nimport type { Nullable } from \"../types\";\r\nimport { DeviceEventFactory } from \"./eventFactory\";\r\nimport { DeviceType, PointerInput } from \"./InputDevices/deviceEnums\";\r\nimport type { IDeviceInputSystem } from \"./inputInterfaces\";\r\n\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nconst MAX_KEYCODES = 255;\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nconst MAX_POINTER_INPUTS = Object.keys(PointerInput).length / 2;\r\n\r\n/** @internal */\r\nexport class WebDeviceInputSystem implements IDeviceInputSystem {\r\n // Private Members\r\n private _inputs: Array<{ [deviceSlot: number]: Array<number> }> = [];\r\n private _gamepads: Array<DeviceType>;\r\n private _keyboardActive: boolean = false;\r\n private _pointerActive: boolean = false;\r\n private _elementToAttachTo: HTMLElement;\r\n private _metaKeys: Array<number>;\r\n private readonly _engine: Engine;\r\n private readonly _usingSafari: boolean = Tools.IsSafari();\r\n // Found solution for determining if MacOS is being used here:\r\n // https://stackoverflow.com/questions/10527983/best-way-to-detect-mac-os-x-or-windows-computers-with-javascript-or-jquery\r\n private readonly _usingMacOS: boolean = /(Mac|iPhone|iPod|iPad)/i.test(navigator.platform);\r\n\r\n private _onDeviceConnected: (deviceType: DeviceType, deviceSlot: number) => void;\r\n private _onDeviceDisconnected: (deviceType: DeviceType, deviceSlot: number) => void;\r\n private _onInputChanged: (deviceType: DeviceType, deviceSlot: number, eventData: IUIEvent) => void;\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n private _keyboardDownEvent = (evt: any) => {};\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n private _keyboardUpEvent = (evt: any) => {};\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n private _keyboardBlurEvent = (evt: any) => {};\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n private _pointerMoveEvent = (evt: any) => {};\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n private _pointerDownEvent = (evt: any) => {};\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n private _pointerUpEvent = (evt: any) => {};\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n private _pointerCancelEvent = (evt: any) => {};\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n private _pointerWheelEvent = (evt: any) => {};\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n private _pointerBlurEvent = (evt: any) => {};\r\n private _wheelEventName: string;\r\n private _eventsAttached: boolean = false;\r\n\r\n private _mouseId = -1;\r\n private readonly _isUsingFirefox = DomManagement.IsNavigatorAvailable() && navigator.userAgent && navigator.userAgent.indexOf(\"Firefox\") !== -1;\r\n\r\n // Array to store active Pointer ID values; prevents issues with negative pointerIds\r\n private _activeTouchIds: Array<number>;\r\n private _maxTouchPoints: number = 0;\r\n\r\n private _pointerInputClearObserver: Nullable<Observer<Engine>> = null;\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n private _gamepadConnectedEvent = (evt: any) => {};\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n private _gamepadDisconnectedEvent = (evt: any) => {};\r\n\r\n private _eventPrefix: string;\r\n\r\n constructor(\r\n engine: Engine,\r\n onDeviceConnected: (deviceType: DeviceType, deviceSlot: number) => void,\r\n onDeviceDisconnected: (deviceType: DeviceType, deviceSlot: number) => void,\r\n onInputChanged: (deviceType: DeviceType, deviceSlot: number, eventData: IUIEvent) => void\r\n ) {\r\n this._eventPrefix = Tools.GetPointerPrefix(engine);\r\n this._engine = engine;\r\n\r\n this._onDeviceConnected = onDeviceConnected;\r\n this._onDeviceDisconnected = onDeviceDisconnected;\r\n this._onInputChanged = onInputChanged;\r\n\r\n this._enableEvents();\r\n\r\n if (this._usingMacOS) {\r\n this._metaKeys = [];\r\n }\r\n\r\n // Set callback to enable event handler switching when inputElement changes\r\n if (!this._engine._onEngineViewChanged) {\r\n this._engine._onEngineViewChanged = () => {\r\n this._enableEvents();\r\n };\r\n }\r\n }\r\n\r\n // Public functions\r\n /**\r\n * Checks for current device input value, given an id and input index. Throws exception if requested device not initialized.\r\n * @param deviceType Enum specifying device type\r\n * @param deviceSlot \"Slot\" or index that device is referenced in\r\n * @param inputIndex Id of input to be checked\r\n * @returns Current value of input\r\n */\r\n public pollInput(deviceType: DeviceType, deviceSlot: number, inputIndex: number): number {\r\n const device = this._inputs[deviceType][deviceSlot];\r\n\r\n if (!device) {\r\n throw `Unable to find device ${DeviceType[deviceType]}`;\r\n }\r\n\r\n if (deviceType >= DeviceType.DualShock && deviceType <= DeviceType.DualSense) {\r\n this._updateDevice(deviceType, deviceSlot, inputIndex);\r\n }\r\n\r\n const currentValue = device[inputIndex];\r\n if (currentValue === undefined) {\r\n throw `Unable to find input ${inputIndex} for device ${DeviceType[deviceType]} in slot ${deviceSlot}`;\r\n }\r\n\r\n if (inputIndex === PointerInput.Move) {\r\n Tools.Warn(`Unable to provide information for PointerInput.Move. Try using PointerInput.Horizontal or PointerInput.Vertical for move data.`);\r\n }\r\n\r\n return currentValue;\r\n }\r\n\r\n /**\r\n * Check for a specific device in the DeviceInputSystem\r\n * @param deviceType Type of device to check for\r\n * @returns bool with status of device's existence\r\n */\r\n public isDeviceAvailable(deviceType: DeviceType): boolean {\r\n return this._inputs[deviceType] !== undefined;\r\n }\r\n\r\n /**\r\n * Dispose of all the eventlisteners\r\n */\r\n public dispose(): void {\r\n // Callbacks\r\n this._onDeviceConnected = () => {};\r\n this._onDeviceDisconnected = () => {};\r\n this._onInputChanged = () => {};\r\n delete this._engine._onEngineViewChanged;\r\n\r\n if (this._elementToAttachTo) {\r\n this._disableEvents();\r\n }\r\n }\r\n\r\n /**\r\n * Enable listening for user input events\r\n */\r\n private _enableEvents(): void {\r\n const inputElement = this?._engine.getInputElement();\r\n if (inputElement && (!this._eventsAttached || this._elementToAttachTo !== inputElement)) {\r\n // Remove events before adding to avoid double events or simultaneous events on multiple canvases\r\n this._disableEvents();\r\n\r\n // If the inputs array has already been created, zero it out to before setting up events\r\n if (this._inputs) {\r\n for (const inputs of this._inputs) {\r\n if (inputs) {\r\n for (const deviceSlotKey in inputs) {\r\n const deviceSlot = +deviceSlotKey;\r\n const device = inputs[deviceSlot];\r\n if (device) {\r\n for (let inputIndex = 0; inputIndex < device.length; inputIndex++) {\r\n device[inputIndex] = 0;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n this._elementToAttachTo = inputElement;\r\n // Set tab index for the inputElement to the engine's canvasTabIndex, if and only if the element's tab index is -1\r\n this._elementToAttachTo.tabIndex = this._elementToAttachTo.tabIndex !== -1 ? this._elementToAttachTo.tabIndex : this._engine.canvasTabIndex;\r\n this._handleKeyActions();\r\n this._handlePointerActions();\r\n this._handleGamepadActions();\r\n this._eventsAttached = true;\r\n\r\n // Check for devices that are already connected but aren't registered. Currently, only checks for gamepads and mouse\r\n this._checkForConnectedDevices();\r\n }\r\n }\r\n\r\n /**\r\n * Disable listening for user input events\r\n */\r\n private _disableEvents(): void {\r\n if (this._elementToAttachTo) {\r\n // Blur Events\r\n this._elementToAttachTo.removeEventListener(\"blur\", this._keyboardBlurEvent);\r\n this._elementToAttachTo.removeEventListener(\"blur\", this._pointerBlurEvent);\r\n\r\n // Keyboard Events\r\n this._elementToAttachTo.removeEventListener(\"keydown\", this._keyboardDownEvent);\r\n this._elementToAttachTo.removeEventListener(\"keyup\", this._keyboardUpEvent);\r\n\r\n // Pointer Events\r\n this._elementToAttachTo.removeEventListener(this._eventPrefix + \"move\", this._pointerMoveEvent);\r\n this._elementToAttachTo.removeEventListener(this._eventPrefix + \"down\", this._pointerDownEvent);\r\n this._elementToAttachTo.removeEventListener(this._eventPrefix + \"up\", this._pointerUpEvent);\r\n this._elementToAttachTo.removeEventListener(this._eventPrefix + \"cancel\", this._pointerCancelEvent);\r\n this._elementToAttachTo.removeEventListener(this._wheelEventName, this._pointerWheelEvent);\r\n\r\n // Gamepad Events\r\n window.removeEventListener(\"gamepadconnected\", this._gamepadConnectedEvent);\r\n window.removeEventListener(\"gamepaddisconnected\", this._gamepadDisconnectedEvent);\r\n }\r\n\r\n if (this._pointerInputClearObserver) {\r\n this._engine.onEndFrameObservable.remove(this._pointerInputClearObserver);\r\n }\r\n\r\n this._eventsAttached = false;\r\n }\r\n\r\n /**\r\n * Checks for existing connections to devices and register them, if necessary\r\n * Currently handles gamepads and mouse\r\n */\r\n private _checkForConnectedDevices(): void {\r\n if (navigator.getGamepads) {\r\n const gamepads = navigator.getGamepads();\r\n\r\n for (const gamepad of gamepads) {\r\n if (gamepad) {\r\n this._addGamePad(gamepad);\r\n }\r\n }\r\n }\r\n\r\n // If the device in use has mouse capabilities, pre-register mouse\r\n if (typeof matchMedia === \"function\" && matchMedia(\"(pointer:fine)\").matches) {\r\n // This will provide a dummy value for the cursor position and is expected to be overridden when the first mouse event happens.\r\n // There isn't any good way to get the current position outside of a pointer event so that's why this was done.\r\n this._addPointerDevice(DeviceType.Mouse, 0, 0, 0);\r\n }\r\n }\r\n\r\n // Private functions\r\n /**\r\n * Add a gamepad to the DeviceInputSystem\r\n * @param gamepad A single DOM Gamepad object\r\n */\r\n private _addGamePad(gamepad: any): void {\r\n const deviceType = this._getGamepadDeviceType(gamepad.id);\r\n const deviceSlot = gamepad.index;\r\n\r\n this._gamepads = this._gamepads || new Array<DeviceType>(gamepad.index + 1);\r\n this._registerDevice(deviceType, deviceSlot, gamepad.buttons.length + gamepad.axes.length);\r\n\r\n this._gamepads[deviceSlot] = deviceType;\r\n }\r\n\r\n /**\r\n * Add pointer device to DeviceInputSystem\r\n * @param deviceType Type of Pointer to add\r\n * @param deviceSlot Pointer ID (0 for mouse, pointerId for Touch)\r\n * @param currentX Current X at point of adding\r\n * @param currentY Current Y at point of adding\r\n */\r\n private _addPointerDevice(deviceType: DeviceType, deviceSlot: number, currentX: number, currentY: number): void {\r\n if (!this._pointerActive) {\r\n this._pointerActive = true;\r\n }\r\n this._registerDevice(deviceType, deviceSlot, MAX_POINTER_INPUTS);\r\n const pointer = this._inputs[deviceType][deviceSlot]; /* initialize our pointer position immediately after registration */\r\n pointer[0] = currentX;\r\n pointer[1] = currentY;\r\n }\r\n\r\n /**\r\n * Add device and inputs to device array\r\n * @param deviceType Enum specifying device type\r\n * @param deviceSlot \"Slot\" or index that device is referenced in\r\n * @param numberOfInputs Number of input entries to create for given device\r\n */\r\n private _registerDevice(deviceType: DeviceType, deviceSlot: number, numberOfInputs: number): void {\r\n if (deviceSlot === undefined) {\r\n throw `Unable to register device ${DeviceType[deviceType]} to undefined slot.`;\r\n }\r\n\r\n if (!this._inputs[deviceType]) {\r\n this._inputs[deviceType] = {};\r\n }\r\n\r\n if (!this._inputs[deviceType][deviceSlot]) {\r\n const device = new Array<number>(numberOfInputs);\r\n\r\n device.fill(0);\r\n\r\n this._inputs[deviceType][deviceSlot] = device;\r\n this._onDeviceConnected(deviceType, deviceSlot);\r\n }\r\n }\r\n\r\n /**\r\n * Given a specific device name, remove that device from the device map\r\n * @param deviceType Enum specifying device type\r\n * @param deviceSlot \"Slot\" or index that device is referenced in\r\n */\r\n private _unregisterDevice(deviceType: DeviceType, deviceSlot: number): void {\r\n if (this._inputs[deviceType][deviceSlot]) {\r\n delete this._inputs[deviceType][deviceSlot];\r\n this._onDeviceDisconnected(deviceType, deviceSlot);\r\n }\r\n }\r\n\r\n /**\r\n * Handle all actions that come from keyboard interaction\r\n */\r\n private _handleKeyActions(): void {\r\n this._keyboardDownEvent = (evt) => {\r\n if (!this._keyboardActive) {\r\n this._keyboardActive = true;\r\n this._registerDevice(DeviceType.Keyboard, 0, MAX_KEYCODES);\r\n }\r\n\r\n const kbKey = this._inputs[DeviceType.Keyboard][0];\r\n if (kbKey) {\r\n kbKey[evt.keyCode] = 1;\r\n\r\n const deviceEvent = evt as IUIEvent;\r\n deviceEvent.inputIndex = evt.keyCode;\r\n\r\n if (this._usingMacOS && evt.metaKey && evt.key !== \"Meta\") {\r\n if (!this._metaKeys.includes(evt.keyCode)) {\r\n this._metaKeys.push(evt.keyCode);\r\n }\r\n }\r\n\r\n this._onInputChanged(DeviceType.Keyboard, 0, deviceEvent);\r\n }\r\n };\r\n\r\n this._keyboardUpEvent = (evt) => {\r\n if (!this._keyboardActive) {\r\n this._keyboardActive = true;\r\n this._registerDevice(DeviceType.Keyboard, 0, MAX_KEYCODES);\r\n }\r\n\r\n const kbKey = this._inputs[DeviceType.Keyboard][0];\r\n if (kbKey) {\r\n kbKey[evt.keyCode] = 0;\r\n\r\n const deviceEvent = evt as IUIEvent;\r\n deviceEvent.inputIndex = evt.keyCode;\r\n\r\n if (this._usingMacOS && evt.key === \"Meta\" && this._metaKeys.length > 0) {\r\n for (const keyCode of this._metaKeys) {\r\n const deviceEvent: IUIEvent = DeviceEventFactory.CreateDeviceEvent(DeviceType.Keyboard, 0, keyCode, 0, this, this._elementToAttachTo);\r\n kbKey[keyCode] = 0;\r\n this._onInputChanged(DeviceType.Keyboard, 0, deviceEvent);\r\n }\r\n this._metaKeys.splice(0, this._metaKeys.length);\r\n }\r\n\r\n this._onInputChanged(DeviceType.Keyboard, 0, deviceEvent);\r\n }\r\n };\r\n\r\n this._keyboardBlurEvent = () => {\r\n if (this._keyboardActive) {\r\n const kbKey = this._inputs[DeviceType.Keyboard][0];\r\n\r\n for (let i = 0; i < kbKey.length; i++) {\r\n if (kbKey[i] !== 0) {\r\n kbKey[i] = 0;\r\n\r\n const deviceEvent: IUIEvent = DeviceEventFactory.CreateDeviceEvent(DeviceType.Keyboard, 0, i, 0, this, this._elementToAttachTo);\r\n\r\n this._onInputChanged(DeviceType.Keyboard, 0, deviceEvent);\r\n }\r\n }\r\n if (this._usingMacOS) {\r\n this._metaKeys.splice(0, this._metaKeys.length);\r\n }\r\n }\r\n };\r\n\r\n this._elementToAttachTo.addEventListener(\"keydown\", this._keyboardDownEvent);\r\n this._elementToAttachTo.addEventListener(\"keyup\", this._keyboardUpEvent);\r\n this._elementToAttachTo.addEventListener(\"blur\", this._keyboardBlurEvent);\r\n }\r\n\r\n /**\r\n * Handle all actions that come from pointer interaction\r\n */\r\n private _handlePointerActions(): void {\r\n // If maxTouchPoints is defined, use that value. Otherwise, allow for a minimum for supported gestures like pinch\r\n this._maxTouchPoints = (DomManagement.IsNavigatorAvailable() && navigator.maxTouchPoints) || 2;\r\n if (!this._activeTouchIds) {\r\n this._activeTouchIds = new Array<number>(this._maxTouchPoints);\r\n }\r\n\r\n for (let i = 0; i < this._maxTouchPoints; i++) {\r\n this._activeTouchIds[i] = -1;\r\n }\r\n\r\n this._pointerMoveEvent = (evt) => {\r\n const deviceType = this._getPointerType(evt);\r\n const deviceSlot = deviceType === DeviceType.Mouse ? 0 : this._activeTouchIds.indexOf(evt.pointerId);\r\n\r\n if (!this._inputs[deviceType]) {\r\n this._inputs[deviceType] = {};\r\n }\r\n\r\n if (!this._inputs[deviceType][deviceSlot]) {\r\n this._addPointerDevice(deviceType, deviceSlot, evt.clientX, evt.clientY);\r\n }\r\n\r\n const pointer = this._inputs[deviceType][deviceSlot];\r\n if (pointer) {\r\n const deviceEvent = evt as IPointerEvent;\r\n deviceEvent.inputIndex = PointerInput.Move;\r\n\r\n pointer[PointerInput.Horizontal] = evt.clientX;\r\n pointer[PointerInput.Vertical] = evt.clientY;\r\n\r\n this._onInputChanged(deviceType, deviceSlot, deviceEvent);\r\n\r\n // Lets Propagate the event for move with same position.\r\n if (!this._usingSafari && evt.button !== -1) {\r\n deviceEvent.inputIndex = evt.button + 2;\r\n pointer[evt.button + 2] = pointer[evt.button + 2] ? 0 : 1; // Reverse state of button if evt.button has value\r\n this._onInputChanged(deviceType, deviceSlot, deviceEvent);\r\n }\r\n }\r\n };\r\n\r\n this._pointerDownEvent = (evt) => {\r\n const deviceType = this._getPointerType(evt);\r\n let deviceSlot = deviceType === DeviceType.Mouse ? 0 : evt.pointerId;\r\n\r\n if (deviceType === DeviceType.Touch) {\r\n const idx = this._activeTouchIds.indexOf(-1);\r\n\r\n if (idx >= 0) {\r\n deviceSlot = idx;\r\n this._activeTouchIds[idx] = evt.pointerId;\r\n } else {\r\n // We can't find an open slot to store new pointer so just return (can only support max number of touches)\r\n Tools.Warn(`Max number of touches exceeded. Ignoring touches in excess of ${this._maxTouchPoints}`);\r\n return;\r\n }\r\n }\r\n\r\n if (!this._inputs[deviceType]) {\r\n this._inputs[deviceType] = {};\r\n }\r\n\r\n if (!this._inputs[deviceType][deviceSlot]) {\r\n this._addPointerDevice(deviceType, deviceSlot, evt.clientX, evt.clientY);\r\n } else if (deviceType === DeviceType.Touch) {\r\n this._onDeviceConnected(deviceType, deviceSlot);\r\n }\r\n\r\n const pointer = this._inputs[deviceType][deviceSlot];\r\n if (pointer) {\r\n const previousHorizontal = pointer[PointerInput.Horizontal];\r\n const previousVertical = pointer[PointerInput.Vertical];\r\n\r\n if (deviceType === DeviceType.Mouse) {\r\n // Mouse; Among supported browsers, value is either 1 or 0 for mouse\r\n if (this._mouseId === -1) {\r\n if (evt.pointerId === undefined) {\r\n // If there is no pointerId (eg. manually dispatched MouseEvent)\r\n this._mouseId = this._isUsingFirefox ? 0 : 1;\r\n } else {\r\n this._mouseId = evt.pointerId;\r\n }\r\n }\r\n\r\n if (!document.pointerLockElement) {\r\n try {\r\n this._elementToAttachTo.setPointerCapture(this._mouseId);\r\n } catch (e) {\r\n // DO NOTHING\r\n }\r\n }\r\n } else {\r\n // Touch; Since touches are dynamically assigned, only set capture if we have an id\r\n if (evt.pointerId && !document.pointerLockElement) {\r\n try {\r\n this._elementToAttachTo.setPointerCapture(evt.pointerId);\r\n } catch (e) {\r\n // DO NOTHING\r\n }\r\n }\r\n }\r\n\r\n pointer[PointerInput.Horizontal] = evt.clientX;\r\n pointer[PointerInput.Vertical] = evt.clientY;\r\n pointer[evt.button + 2] = 1;\r\n\r\n const deviceEvent = evt as IUIEvent;\r\n\r\n // NOTE: The +2 used here to is because PointerInput has the same value progression for its mouse buttons as PointerEvent.button\r\n // However, we have our X and Y values front-loaded to group together the touch inputs but not break this progression\r\n // EG. ([X, Y, Left-click], Middle-click, etc...)\r\n deviceEvent.inputIndex = evt.button + 2;\r\n\r\n this._onInputChanged(deviceType, deviceSlot, deviceEvent);\r\n\r\n if (previousHorizontal !== evt.clientX || previousVertical !== evt.clientY) {\r\n deviceEvent.inputIndex = PointerInput.Move;\r\n this._onInputChanged(deviceType, deviceSlot, deviceEvent);\r\n }\r\n }\r\n };\r\n\r\n this._pointerUpEvent = (evt) => {\r\n const deviceType = this._getPointerType(evt);\r\n const deviceSlot = deviceType === DeviceType.Mouse ? 0 : this._activeTouchIds.indexOf(evt.pointerId);\r\n\r\n if (deviceType === DeviceType.Touch) {\r\n if (deviceSlot === -1) {\r\n return;\r\n } else {\r\n this._activeTouchIds[deviceSlot] = -1;\r\n }\r\n }\r\n\r\n const pointer = this._inputs[deviceType]?.[deviceSlot];\r\n if (pointer && pointer[evt.button + 2] !== 0) {\r\n const previousHorizontal = pointer[PointerInput.Horizontal];\r\n const previousVertical = pointer[PointerInput.Vertical];\r\n\r\n pointer[PointerInput.Horizontal] = evt.clientX;\r\n pointer[PointerInput.Vertical] = evt.clientY;\r\n pointer[evt.button + 2] = 0;\r\n\r\n const deviceEvent = evt as IUIEvent;\r\n\r\n if (previousHorizontal !== evt.clientX || previousVertical !== evt.clientY) {\r\n deviceEvent.inputIndex = PointerInput.Move;\r\n this._onInputChanged(deviceType, deviceSlot, deviceEvent);\r\n }\r\n\r\n // NOTE: The +2 used here to is because PointerInput has the same value progression for its mouse buttons as PointerEvent.button\r\n // However, we have our X and Y values front-loaded to group together the touch inputs but not break this progression\r\n // EG. ([X, Y, Left-click], Middle-click, etc...)\r\n deviceEvent.inputIndex = evt.button + 2;\r\n\r\n if (deviceType === DeviceType.Mouse && this._mouseId >= 0 && this._elementToAttachTo.hasPointerCapture?.(this._mouseId)) {\r\n this._elementToAttachTo.releasePointerCapture(this._mouseId);\r\n } else if (evt.pointerId && this._elementToAttachTo.hasPointerCapture?.(evt.pointerId)) {\r\n this._elementToAttachTo.releasePointerCapture(evt.pointerId);\r\n }\r\n\r\n this._onInputChanged(deviceType, deviceSlot, deviceEvent);\r\n\r\n if (deviceType === DeviceType.Touch) {\r\n this._onDeviceDisconnected(deviceType, deviceSlot);\r\n }\r\n }\r\n };\r\n\r\n this._pointerCancelEvent = (evt) => {\r\n if (evt.pointerType === \"mouse\") {\r\n const pointer = this._inputs[DeviceType.Mouse][0];\r\n\r\n if (this._mouseId >= 0 && this._elementToAttachTo.hasPointerCapture?.(this._mouseId)) {\r\n this._elementToAttachTo.releasePointerCapture(this._mouseId);\r\n }\r\n\r\n for (let inputIndex = PointerInput.LeftClick; inputIndex <= PointerInput.BrowserForward; inputIndex++) {\r\n if (pointer[inputIndex] === 1) {\r\n pointer[inputIndex] = 0;\r\n\r\n const deviceEvent: IUIEvent = DeviceEventFactory.CreateDeviceEvent(DeviceType.Mouse, 0, inputIndex, 0, this, this._elementToAttachTo);\r\n\r\n this._onInputChanged(DeviceType.Mouse, 0, deviceEvent);\r\n }\r\n }\r\n } else {\r\n const deviceSlot = this._activeTouchIds.indexOf(evt.pointerId);\r\n\r\n if (this._elementToAttachTo.hasPointerCapture?.(evt.pointerId)) {\r\n this._elementToAttachTo.releasePointerCapture(evt.pointerId);\r\n }\r\n\r\n this._inputs[DeviceType.Touch][deviceSlot][PointerInput.LeftClick] = 0;\r\n\r\n const deviceEvent: IUIEvent = DeviceEventFactory.CreateDeviceEvent(DeviceType.Touch, deviceSlot, PointerInput.LeftClick, 0, this, this._elementToAttachTo);\r\n\r\n this._onInputChanged(DeviceType.Touch, deviceSlot, deviceEvent);\r\n\r\n this._activeTouchIds[deviceSlot] = -1;\r\n this._onDeviceDisconnected(DeviceType.Touch, deviceSlot);\r\n }\r\n };\r\n\r\n // Set Wheel Event Name, code originally from scene.inputManager\r\n this._wheelEventName =\r\n \"onwheel\" in document.createElement(\"div\")\r\n ? \"wheel\" // Modern browsers support \"wheel\"\r\n : (<any>document).onmousewheel !== undefined\r\n ? \"mousewheel\" // Webkit and IE support at least \"mousewheel\"\r\n : \"DOMMouseScroll\"; // let's assume that remaining browsers are older Firefox\r\n\r\n // Code originally in scene.inputManager.ts\r\n // Chrome reports warning in console if wheel listener doesn't set an explicit passive option.\r\n // IE11 only supports captureEvent:boolean, not options:object, and it defaults to false.\r\n // Feature detection technique copied from: https://github.com/github/eventlistener-polyfill (MIT license)\r\n let passiveSupported = false;\r\n const noop = function () {};\r\n\r\n try {\r\n const options = Object.defineProperty({}, \"passive\", {\r\n get: function () {\r\n passiveSupported = true;\r\n },\r\n });\r\n\r\n this._elementToAttachTo.addEventListener(\"test\", noop, options);\r\n this._elementToAttachTo.removeEventListener(\"test\", noop, options);\r\n } catch (e) {\r\n /* */\r\n }\r\n\r\n this._pointerBlurEvent = () => {\r\n // Handle mouse buttons\r\n if (this.isDeviceAvailable(DeviceType.Mouse)) {\r\n const pointer = this._inputs[DeviceType.Mouse][0];\r\n\r\n if (this._mouseId >= 0 && this._elementToAttachTo.hasPointerCapture?.(this._mouseId)) {\r\n this._elementToAttachTo.releasePointerCapture(this._mouseId);\r\n }\r\n\r\n for (let inputIndex = PointerInput.LeftClick; inputIndex <= PointerInput.BrowserForward; inputIndex++) {\r\n if (pointer[inputIndex] === 1) {\r\n pointer[inputIndex] = 0;\r\n\r\n const deviceEvent: IUIEvent = DeviceEventFactory.CreateDeviceEvent(DeviceType.Mouse, 0, inputIndex, 0, this, this._elementToAttachTo);\r\n\r\n this._onInputChanged(DeviceType.Mouse, 0, deviceEvent);\r\n }\r\n }\r\n }\r\n\r\n // Handle Active Touches\r\n if (this.isDeviceAvailable(DeviceType.Touch)) {\r\n const pointer = this._inputs[DeviceType.Touch];\r\n\r\n for (let deviceSlot = 0; deviceSlot < this._activeTouchIds.length; deviceSlot++) {\r\n const pointerId = this._activeTouchIds[deviceSlot];\r\n\r\n if (this._elementToAttachTo.hasPointerCapture?.(pointerId)) {\r\n this._elementToAttachTo.releasePointerCapture(pointerId);\r\n }\r\n\r\n if (pointerId !== -1 && pointer[deviceSlot]?.[PointerInput.LeftClick] === 1) {\r\n pointer[deviceSlot][PointerInput.LeftClick] = 0;\r\n\r\n const deviceEvent: IUIEvent = DeviceEventFactory.CreateDeviceEvent(DeviceType.Touch, deviceSlot, PointerInput.LeftClick, 0, this, this._elementToAttachTo);\r\n\r\n this._onInputChanged(DeviceType.Touch, deviceSlot, deviceEvent);\r\n\r\n this._activeTouchIds[deviceSlot] = -1;\r\n this._onDeviceDisconnected(DeviceType.Touch, deviceSlot);\r\n }\r\n }\r\n }\r\n };\r\n\r\n this._pointerWheelEvent = (evt) => {\r\n const deviceType = DeviceType.Mouse;\r\n const deviceSlot = 0;\r\n\r\n if (!this._inputs[deviceType]) {\r\n this._inputs[deviceType] = [];\r\n }\r\n\r\n if (!this._inputs[deviceType][deviceSlot]) {\r\n this._pointerActive = true;\r\n this._registerDevice(deviceType, deviceSlot, MAX_POINTER_INPUTS);\r\n }\r\n\r\n const pointer = this._inputs[deviceType][deviceSlot];\r\n if (pointer) {\r\n pointer[PointerInput.MouseWheelX] = evt.deltaX || 0;\r\n pointer[PointerInput.MouseWheelY] = evt.deltaY || evt.wheelDelta || 0;\r\n pointer[PointerInput.MouseWheelZ] = evt.deltaZ || 0;\r\n\r\n const deviceEvent = evt as IUIEvent;\r\n\r\n if (pointer[PointerInput.MouseWheelX] !== 0) {\r\n deviceEvent.inputIndex = PointerInput.MouseWheelX;\r\n this._onInputChanged(deviceType, deviceSlot, deviceEvent);\r\n }\r\n if (pointer[PointerInput.MouseWheelY] !== 0) {\r\n deviceEvent.inputIndex = PointerInput.MouseWheelY;\r\n this._onInputChanged(deviceType, deviceSlot, deviceEvent);\r\n }\r\n if (pointer[PointerInput.MouseWheelZ] !== 0) {\r\n deviceEvent.inputIndex = PointerInput.MouseWheelZ;\r\n this._onInputChanged(deviceType, deviceSlot, deviceEvent);\r\n }\r\n }\r\n };\r\n\r\n this._elementToAttachTo.addEventListener(this._eventPrefix + \"move\", this._pointerMoveEvent);\r\n this._elementToAttachTo.addEventListener(this._eventPrefix + \"down\", this._pointerDownEvent);\r\n this._elementToAttachTo.addEventListener(this._eventPrefix + \"up\", this._pointerUpEvent);\r\n this._elementToAttachTo.addEventListener(this._eventPrefix + \"cancel\", this._pointerCancelEvent);\r\n this._elementToAttachTo.addEventListener(\"blur\", this._pointerBlurEvent);\r\n this._elementToAttachTo.addEventListener(this._wheelEventName, this._pointerWheelEvent, passiveSupported ? { passive: false } : false);\r\n\r\n // Since there's no up or down event for mouse wheel or delta x/y, clear mouse values at end of frame\r\n this._pointerInputClearObserver = this._engine.onEndFrameObservable.add(() => {\r\n if (this.isDeviceAvailable(DeviceType.Mouse)) {\r\n const pointer = this._inputs[DeviceType.Mouse][0];\r\n pointer[PointerInput.MouseWheelX] = 0;\r\n pointer[PointerInput.MouseWheelY] = 0;\r\n pointer[PointerInput.MouseWheelZ] = 0;\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Handle all actions that come from gamepad interaction\r\n */\r\n private _handleGamepadActions(): void {\r\n this._gamepadConnectedEvent = (evt: any) => {\r\n this._addGamePad(evt.gamepad);\r\n };\r\n\r\n this._gamepadDisconnectedEvent = (evt: any) => {\r\n if (this._gamepads) {\r\n const deviceType = this._getGamepadDeviceType(evt.gamepad.id);\r\n const deviceSlot = evt.gamepad.index;\r\n\r\n this._unregisterDevice(deviceType, deviceSlot);\r\n delete this._gamepads[deviceSlot];\r\n }\r\n };\r\n\r\n window.addEventListener(\"gamepadconnected\", this._gamepadConnectedEvent);\r\n window.addEventListener(\"gamepaddisconnected\", this._gamepadDisconnectedEvent);\r\n }\r\n\r\n /**\r\n * Update all non-event based devices with each frame\r\n * @param deviceType Enum specifying device type\r\n * @param deviceSlot \"Slot\" or index that device is referenced in\r\n * @param inputIndex Id of input to be checked\r\n */\r\n private _updateDevice(deviceType: DeviceType, deviceSlot: number, inputIndex: number): void {\r\n // Gamepads\r\n const gp = navigator.getGamepads()[deviceSlot];\r\n\r\n if (gp && deviceType === this._gamepads[deviceSlot]) {\r\n const device = this._inputs[deviceType][deviceSlot];\r\n\r\n if (inputIndex >= gp.buttons.length) {\r\n device[inputIndex] = gp.axes[inputIndex - gp.buttons.length].valueOf();\r\n } else {\r\n device[inputIndex] = gp.buttons[inputIndex].value;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Gets DeviceType from the device name\r\n * @param deviceName Name of Device from DeviceInputSystem\r\n * @returns DeviceType enum value\r\n */\r\n private _getGamepadDeviceType(deviceName: string): DeviceType {\r\n if (deviceName.indexOf(\"054c\") !== -1) {\r\n // DualShock 4 Gamepad\r\n return deviceName.indexOf(\"0ce6\") !== -1 ? DeviceType.DualSense : DeviceType.DualShock;\r\n } else if (deviceName.indexOf(\"Xbox One\") !== -1 || deviceName.search(\"Xbox 360\") !== -1 || deviceName.search(\"xinput\") !== -1) {\r\n // Xbox Gamepad\r\n return DeviceType.Xbox;\r\n } else if (deviceName.indexOf(\"057e\") !== -1) {\r\n // Switch Gamepad\r\n return DeviceType.Switch;\r\n }\r\n\r\n return DeviceType.Generic;\r\n }\r\n\r\n /**\r\n * Get DeviceType from a given pointer/mouse/touch event.\r\n * @param evt PointerEvent to evaluate\r\n * @returns DeviceType interpreted from event\r\n */\r\n private _getPointerType(evt: any): DeviceType {\r\n let deviceType = DeviceType.Mouse;\r\n\r\n if (evt.pointerType === \"touch\" || evt.pointerType === \"pen\" || evt.touches) {\r\n deviceType = DeviceType.Touch;\r\n }\r\n\r\n return deviceType;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"webDeviceInputSystem.js","sourceRoot":"","sources":["../../../../../lts/core/generated/DeviceInput/webDeviceInputSystem.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aA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O,UAAU,CAAC,OAAO,CAAC;IAC9B,CAAC;IAED;;;;OAIG;IACK,eAAe,CAAC,GAAQ;QAC5B,IAAI,UAAU,GAAG,UAAU,CAAC,KAAK,CAAC;QAElC,IAAI,GAAG,CAAC,WAAW,KAAK,OAAO,IAAI,GAAG,CAAC,WAAW,KAAK,KAAK,IAAI,GAAG,CAAC,OAAO,EAAE;YACzE,UAAU,GAAG,UAAU,CAAC,KAAK,CAAC;SACjC;QAED,OAAO,UAAU,CAAC;IACtB,CAAC;CACJ","sourcesContent":["import type { Engine } from \"../Engines/engine\";\r\nimport type { IPointerEvent, IUIEvent } from \"../Events/deviceInputEvents\";\r\nimport { DomManagement } from \"../Misc/domManagement\";\r\nimport type { Observer } from \"../Misc/observable\";\r\nimport { Tools } from \"../Misc/tools\";\r\nimport type { Nullable } from \"../types\";\r\nimport { DeviceEventFactory } from \"./eventFactory\";\r\nimport { DeviceType, PointerInput } from \"./InputDevices/deviceEnums\";\r\nimport type { IDeviceInputSystem } from \"./inputInterfaces\";\r\n\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nconst MAX_KEYCODES = 255;\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nconst MAX_POINTER_INPUTS = Object.keys(PointerInput).length / 2;\r\n\r\n/** @internal */\r\nexport class WebDeviceInputSystem implements IDeviceInputSystem {\r\n // Private Members\r\n private _inputs: Array<{ [deviceSlot: number]: Array<number> }> = [];\r\n private _gamepads: Array<DeviceType>;\r\n private _keyboardActive: boolean = false;\r\n private _pointerActive: boolean = false;\r\n private _elementToAttachTo: HTMLElement;\r\n private _metaKeys: Array<number>;\r\n private readonly _engine: Engine;\r\n private readonly _usingSafari: boolean = Tools.IsSafari();\r\n // Found solution for determining if MacOS is being used here:\r\n // https://stackoverflow.com/questions/10527983/best-way-to-detect-mac-os-x-or-windows-computers-with-javascript-or-jquery\r\n private readonly _usingMacOS: boolean = /(Mac|iPhone|iPod|iPad)/i.test(navigator.platform);\r\n\r\n private _onDeviceConnected: (deviceType: DeviceType, deviceSlot: number) => void;\r\n private _onDeviceDisconnected: (deviceType: DeviceType, deviceSlot: number) => void;\r\n private _onInputChanged: (deviceType: DeviceType, deviceSlot: number, eventData: IUIEvent) => void;\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n private _keyboardDownEvent = (evt: any) => {};\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n private _keyboardUpEvent = (evt: any) => {};\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n private _keyboardBlurEvent = (evt: any) => {};\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n private _pointerMoveEvent = (evt: any) => {};\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n private _pointerDownEvent = (evt: any) => {};\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n private _pointerUpEvent = (evt: any) => {};\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n private _pointerCancelEvent = (evt: any) => {};\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n private _pointerWheelEvent = (evt: any) => {};\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n private _pointerBlurEvent = (evt: any) => {};\r\n private _wheelEventName: string;\r\n private _eventsAttached: boolean = false;\r\n\r\n private _mouseId = -1;\r\n private readonly _isUsingFirefox = DomManagement.IsNavigatorAvailable() && navigator.userAgent && navigator.userAgent.indexOf(\"Firefox\") !== -1;\r\n\r\n // Array to store active Pointer ID values; prevents issues with negative pointerIds\r\n private _activeTouchIds: Array<number>;\r\n private _maxTouchPoints: number = 0;\r\n\r\n private _pointerInputClearObserver: Nullable<Observer<Engine>> = null;\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n private _gamepadConnectedEvent = (evt: any) => {};\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n private _gamepadDisconnectedEvent = (evt: any) => {};\r\n\r\n private _eventPrefix: string;\r\n\r\n constructor(\r\n engine: Engine,\r\n onDeviceConnected: (deviceType: DeviceType, deviceSlot: number) => void,\r\n onDeviceDisconnected: (deviceType: DeviceType, deviceSlot: number) => void,\r\n onInputChanged: (deviceType: DeviceType, deviceSlot: number, eventData: IUIEvent) => void\r\n ) {\r\n this._eventPrefix = Tools.GetPointerPrefix(engine);\r\n this._engine = engine;\r\n\r\n this._onDeviceConnected = onDeviceConnected;\r\n this._onDeviceDisconnected = onDeviceDisconnected;\r\n this._onInputChanged = onInputChanged;\r\n\r\n this._enableEvents();\r\n\r\n if (this._usingMacOS) {\r\n this._metaKeys = [];\r\n }\r\n\r\n // Set callback to enable event handler switching when inputElement changes\r\n if (!this._engine._onEngineViewChanged) {\r\n this._engine._onEngineViewChanged = () => {\r\n this._enableEvents();\r\n };\r\n }\r\n }\r\n\r\n // Public functions\r\n /**\r\n * Checks for current device input value, given an id and input index. Throws exception if requested device not initialized.\r\n * @param deviceType Enum specifying device type\r\n * @param deviceSlot \"Slot\" or index that device is referenced in\r\n * @param inputIndex Id of input to be checked\r\n * @returns Current value of input\r\n */\r\n public pollInput(deviceType: DeviceType, deviceSlot: number, inputIndex: number): number {\r\n const device = this._inputs[deviceType][deviceSlot];\r\n\r\n if (!device) {\r\n throw `Unable to find device ${DeviceType[deviceType]}`;\r\n }\r\n\r\n if (deviceType >= DeviceType.DualShock && deviceType <= DeviceType.DualSense) {\r\n this._updateDevice(deviceType, deviceSlot, inputIndex);\r\n }\r\n\r\n const currentValue = device[inputIndex];\r\n if (currentValue === undefined) {\r\n throw `Unable to find input ${inputIndex} for device ${DeviceType[deviceType]} in slot ${deviceSlot}`;\r\n }\r\n\r\n if (inputIndex === PointerInput.Move) {\r\n Tools.Warn(`Unable to provide information for PointerInput.Move. Try using PointerInput.Horizontal or PointerInput.Vertical for move data.`);\r\n }\r\n\r\n return currentValue;\r\n }\r\n\r\n /**\r\n * Check for a specific device in the DeviceInputSystem\r\n * @param deviceType Type of device to check for\r\n * @returns bool with status of device's existence\r\n */\r\n public isDeviceAvailable(deviceType: DeviceType): boolean {\r\n return this._inputs[deviceType] !== undefined;\r\n }\r\n\r\n /**\r\n * Dispose of all the eventlisteners\r\n */\r\n public dispose(): void {\r\n // Callbacks\r\n this._onDeviceConnected = () => {};\r\n this._onDeviceDisconnected = () => {};\r\n this._onInputChanged = () => {};\r\n delete this._engine._onEngineViewChanged;\r\n\r\n if (this._elementToAttachTo) {\r\n this._disableEvents();\r\n }\r\n }\r\n\r\n /**\r\n * Enable listening for user input events\r\n */\r\n private _enableEvents(): void {\r\n const inputElement = this?._engine.getInputElement();\r\n if (inputElement && (!this._eventsAttached || this._elementToAttachTo !== inputElement)) {\r\n // Remove events before adding to avoid double events or simultaneous events on multiple canvases\r\n this._disableEvents();\r\n\r\n // If the inputs array has already been created, zero it out to before setting up events\r\n if (this._inputs) {\r\n for (const inputs of this._inputs) {\r\n if (inputs) {\r\n for (const deviceSlotKey in inputs) {\r\n const deviceSlot = +deviceSlotKey;\r\n const device = inputs[deviceSlot];\r\n if (device) {\r\n for (let inputIndex = 0; inputIndex < device.length; inputIndex++) {\r\n device[inputIndex] = 0;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n this._elementToAttachTo = inputElement;\r\n // Set tab index for the inputElement to the engine's canvasTabIndex, if and only if the element's tab index is -1\r\n this._elementToAttachTo.tabIndex = this._elementToAttachTo.tabIndex !== -1 ? this._elementToAttachTo.tabIndex : this._engine.canvasTabIndex;\r\n this._handleKeyActions();\r\n this._handlePointerActions();\r\n this._handleGamepadActions();\r\n this._eventsAttached = true;\r\n\r\n // Check for devices that are already connected but aren't registered. Currently, only checks for gamepads and mouse\r\n this._checkForConnectedDevices();\r\n }\r\n }\r\n\r\n /**\r\n * Disable listening for user input events\r\n */\r\n private _disableEvents(): void {\r\n if (this._elementToAttachTo) {\r\n // Blur Events\r\n this._elementToAttachTo.removeEventListener(\"blur\", this._keyboardBlurEvent);\r\n this._elementToAttachTo.removeEventListener(\"blur\", this._pointerBlurEvent);\r\n\r\n // Keyboard Events\r\n this._elementToAttachTo.removeEventListener(\"keydown\", this._keyboardDownEvent);\r\n this._elementToAttachTo.removeEventListener(\"keyup\", this._keyboardUpEvent);\r\n\r\n // Pointer Events\r\n this._elementToAttachTo.removeEventListener(this._eventPrefix + \"move\", this._pointerMoveEvent);\r\n this._elementToAttachTo.removeEventListener(this._eventPrefix + \"down\", this._pointerDownEvent);\r\n this._elementToAttachTo.removeEventListener(this._eventPrefix + \"up\", this._pointerUpEvent);\r\n this._elementToAttachTo.removeEventListener(this._eventPrefix + \"cancel\", this._pointerCancelEvent);\r\n this._elementToAttachTo.removeEventListener(this._wheelEventName, this._pointerWheelEvent);\r\n\r\n // Gamepad Events\r\n window.removeEventListener(\"gamepadconnected\", this._gamepadConnectedEvent);\r\n window.removeEventListener(\"gamepaddisconnected\", this._gamepadDisconnectedEvent);\r\n }\r\n\r\n if (this._pointerInputClearObserver) {\r\n this._engine.onEndFrameObservable.remove(this._pointerInputClearObserver);\r\n }\r\n\r\n this._eventsAttached = false;\r\n }\r\n\r\n /**\r\n * Checks for existing connections to devices and register them, if necessary\r\n * Currently handles gamepads and mouse\r\n */\r\n private _checkForConnectedDevices(): void {\r\n if (navigator.getGamepads) {\r\n const gamepads = navigator.getGamepads();\r\n\r\n for (const gamepad of gamepads) {\r\n if (gamepad) {\r\n this._addGamePad(gamepad);\r\n }\r\n }\r\n }\r\n\r\n // If the device in use has mouse capabilities, pre-register mouse\r\n if (typeof matchMedia === \"function\" && matchMedia(\"(pointer:fine)\").matches) {\r\n // This will provide a dummy value for the cursor position and is expected to be overridden when the first mouse event happens.\r\n // There isn't any good way to get the current position outside of a pointer event so that's why this was done.\r\n this._addPointerDevice(DeviceType.Mouse, 0, 0, 0);\r\n }\r\n }\r\n\r\n // Private functions\r\n /**\r\n * Add a gamepad to the DeviceInputSystem\r\n * @param gamepad A single DOM Gamepad object\r\n */\r\n private _addGamePad(gamepad: any): void {\r\n const deviceType = this._getGamepadDeviceType(gamepad.id);\r\n const deviceSlot = gamepad.index;\r\n\r\n this._gamepads = this._gamepads || new Array<DeviceType>(gamepad.index + 1);\r\n this._registerDevice(deviceType, deviceSlot, gamepad.buttons.length + gamepad.axes.length);\r\n\r\n this._gamepads[deviceSlot] = deviceType;\r\n }\r\n\r\n /**\r\n * Add pointer device to DeviceInputSystem\r\n * @param deviceType Type of Pointer to add\r\n * @param deviceSlot Pointer ID (0 for mouse, pointerId for Touch)\r\n * @param currentX Current X at point of adding\r\n * @param currentY Current Y at point of adding\r\n */\r\n private _addPointerDevice(deviceType: DeviceType, deviceSlot: number, currentX: number, currentY: number): void {\r\n if (!this._pointerActive) {\r\n this._pointerActive = true;\r\n }\r\n this._registerDevice(deviceType, deviceSlot, MAX_POINTER_INPUTS);\r\n const pointer = this._inputs[deviceType][deviceSlot]; /* initialize our pointer position immediately after registration */\r\n pointer[0] = currentX;\r\n pointer[1] = currentY;\r\n }\r\n\r\n /**\r\n * Add device and inputs to device array\r\n * @param deviceType Enum specifying device type\r\n * @param deviceSlot \"Slot\" or index that device is referenced in\r\n * @param numberOfInputs Number of input entries to create for given device\r\n */\r\n private _registerDevice(deviceType: DeviceType, deviceSlot: number, numberOfInputs: number): void {\r\n if (deviceSlot === undefined) {\r\n throw `Unable to register device ${DeviceType[deviceType]} to undefined slot.`;\r\n }\r\n\r\n if (!this._inputs[deviceType]) {\r\n this._inputs[deviceType] = {};\r\n }\r\n\r\n if (!this._inputs[deviceType][deviceSlot]) {\r\n const device = new Array<number>(numberOfInputs);\r\n\r\n device.fill(0);\r\n\r\n this._inputs[deviceType][deviceSlot] = device;\r\n this._onDeviceConnected(deviceType, deviceSlot);\r\n }\r\n }\r\n\r\n /**\r\n * Given a specific device name, remove that device from the device map\r\n * @param deviceType Enum specifying device type\r\n * @param deviceSlot \"Slot\" or index that device is referenced in\r\n */\r\n private _unregisterDevice(deviceType: DeviceType, deviceSlot: number): void {\r\n if (this._inputs[deviceType][deviceSlot]) {\r\n delete this._inputs[deviceType][deviceSlot];\r\n this._onDeviceDisconnected(deviceType, deviceSlot);\r\n }\r\n }\r\n\r\n /**\r\n * Handle all actions that come from keyboard interaction\r\n */\r\n private _handleKeyActions(): void {\r\n this._keyboardDownEvent = (evt) => {\r\n if (!this._keyboardActive) {\r\n this._keyboardActive = true;\r\n this._registerDevice(DeviceType.Keyboard, 0, MAX_KEYCODES);\r\n }\r\n\r\n const kbKey = this._inputs[DeviceType.Keyboard][0];\r\n if (kbKey) {\r\n kbKey[evt.keyCode] = 1;\r\n\r\n const deviceEvent = evt as IUIEvent;\r\n deviceEvent.inputIndex = evt.keyCode;\r\n\r\n if (this._usingMacOS && evt.metaKey && evt.key !== \"Meta\") {\r\n if (!this._metaKeys.includes(evt.keyCode)) {\r\n this._metaKeys.push(evt.keyCode);\r\n }\r\n }\r\n\r\n this._onInputChanged(DeviceType.Keyboard, 0, deviceEvent);\r\n }\r\n };\r\n\r\n this._keyboardUpEvent = (evt) => {\r\n if (!this._keyboardActive) {\r\n this._keyboardActive = true;\r\n this._registerDevice(DeviceType.Keyboard, 0, MAX_KEYCODES);\r\n }\r\n\r\n const kbKey = this._inputs[DeviceType.Keyboard][0];\r\n if (kbKey) {\r\n kbKey[evt.keyCode] = 0;\r\n\r\n const deviceEvent = evt as IUIEvent;\r\n deviceEvent.inputIndex = evt.keyCode;\r\n\r\n if (this._usingMacOS && evt.key === \"Meta\" && this._metaKeys.length > 0) {\r\n for (const keyCode of this._metaKeys) {\r\n const deviceEvent: IUIEvent = DeviceEventFactory.CreateDeviceEvent(DeviceType.Keyboard, 0, keyCode, 0, this, this._elementToAttachTo);\r\n kbKey[keyCode] = 0;\r\n this._onInputChanged(DeviceType.Keyboard, 0, deviceEvent);\r\n }\r\n this._metaKeys.splice(0, this._metaKeys.length);\r\n }\r\n\r\n this._onInputChanged(DeviceType.Keyboard, 0, deviceEvent);\r\n }\r\n };\r\n\r\n this._keyboardBlurEvent = () => {\r\n if (this._keyboardActive) {\r\n const kbKey = this._inputs[DeviceType.Keyboard][0];\r\n\r\n for (let i = 0; i < kbKey.length; i++) {\r\n if (kbKey[i] !== 0) {\r\n kbKey[i] = 0;\r\n\r\n const deviceEvent: IUIEvent = DeviceEventFactory.CreateDeviceEvent(DeviceType.Keyboard, 0, i, 0, this, this._elementToAttachTo);\r\n\r\n this._onInputChanged(DeviceType.Keyboard, 0, deviceEvent);\r\n }\r\n }\r\n if (this._usingMacOS) {\r\n this._metaKeys.splice(0, this._metaKeys.length);\r\n }\r\n }\r\n };\r\n\r\n this._elementToAttachTo.addEventListener(\"keydown\", this._keyboardDownEvent);\r\n this._elementToAttachTo.addEventListener(\"keyup\", this._keyboardUpEvent);\r\n this._elementToAttachTo.addEventListener(\"blur\", this._keyboardBlurEvent);\r\n }\r\n\r\n /**\r\n * Handle all actions that come from pointer interaction\r\n */\r\n private _handlePointerActions(): void {\r\n // If maxTouchPoints is defined, use that value. Otherwise, allow for a minimum for supported gestures like pinch\r\n this._maxTouchPoints = (DomManagement.IsNavigatorAvailable() && navigator.maxTouchPoints) || 2;\r\n if (!this._activeTouchIds) {\r\n this._activeTouchIds = new Array<number>(this._maxTouchPoints);\r\n }\r\n\r\n for (let i = 0; i < this._maxTouchPoints; i++) {\r\n this._activeTouchIds[i] = -1;\r\n }\r\n\r\n this._pointerMoveEvent = (evt) => {\r\n const deviceType = this._getPointerType(evt);\r\n const deviceSlot = deviceType === DeviceType.Mouse ? 0 : this._activeTouchIds.indexOf(evt.pointerId);\r\n\r\n if (!this._inputs[deviceType]) {\r\n this._inputs[deviceType] = {};\r\n }\r\n\r\n if (!this._inputs[deviceType][deviceSlot]) {\r\n this._addPointerDevice(deviceType, deviceSlot, evt.clientX, evt.clientY);\r\n }\r\n\r\n const pointer = this._inputs[deviceType][deviceSlot];\r\n if (pointer) {\r\n const deviceEvent = evt as IPointerEvent;\r\n deviceEvent.inputIndex = PointerInput.Move;\r\n\r\n pointer[PointerInput.Horizontal] = evt.clientX;\r\n pointer[PointerInput.Vertical] = evt.clientY;\r\n\r\n this._onInputChanged(deviceType, deviceSlot, deviceEvent);\r\n\r\n // Lets Propagate the event for move with same position.\r\n if (!this._usingSafari && evt.button !== -1) {\r\n deviceEvent.inputIndex = evt.button + 2;\r\n pointer[evt.button + 2] = pointer[evt.button + 2] ? 0 : 1; // Reverse state of button if evt.button has value\r\n this._onInputChanged(deviceType, deviceSlot, deviceEvent);\r\n }\r\n }\r\n };\r\n\r\n this._pointerDownEvent = (evt) => {\r\n const deviceType = this._getPointerType(evt);\r\n let deviceSlot = deviceType === DeviceType.Mouse ? 0 : evt.pointerId;\r\n\r\n if (deviceType === DeviceType.Touch) {\r\n const idx = this._activeTouchIds.indexOf(-1);\r\n\r\n if (idx >= 0) {\r\n deviceSlot = idx;\r\n this._activeTouchIds[idx] = evt.pointerId;\r\n } else {\r\n // We can't find an open slot to store new pointer so just return (can only support max number of touches)\r\n Tools.Warn(`Max number of touches exceeded. Ignoring touches in excess of ${this._maxTouchPoints}`);\r\n return;\r\n }\r\n }\r\n\r\n if (!this._inputs[deviceType]) {\r\n this._inputs[deviceType] = {};\r\n }\r\n\r\n if (!this._inputs[deviceType][deviceSlot]) {\r\n this._addPointerDevice(deviceType, deviceSlot, evt.clientX, evt.clientY);\r\n } else if (deviceType === DeviceType.Touch) {\r\n this._onDeviceConnected(deviceType, deviceSlot);\r\n }\r\n\r\n const pointer = this._inputs[deviceType][deviceSlot];\r\n if (pointer) {\r\n const previousHorizontal = pointer[PointerInput.Horizontal];\r\n const previousVertical = pointer[PointerInput.Vertical];\r\n\r\n if (deviceType === DeviceType.Mouse) {\r\n // Mouse; Among supported browsers, value is either 1 or 0 for mouse\r\n if (this._mouseId === -1) {\r\n if (evt.pointerId === undefined) {\r\n // If there is no pointerId (eg. manually dispatched MouseEvent)\r\n this._mouseId = this._isUsingFirefox ? 0 : 1;\r\n } else {\r\n this._mouseId = evt.pointerId;\r\n }\r\n }\r\n\r\n if (!document.pointerLockElement) {\r\n try {\r\n this._elementToAttachTo.setPointerCapture(this._mouseId);\r\n } catch (e) {\r\n // DO NOTHING\r\n }\r\n }\r\n } else {\r\n // Touch; Since touches are dynamically assigned, only set capture if we have an id\r\n if (evt.pointerId && !document.pointerLockElement) {\r\n try {\r\n this._elementToAttachTo.setPointerCapture(evt.pointerId);\r\n } catch (e) {\r\n // DO NOTHING\r\n }\r\n }\r\n }\r\n\r\n pointer[PointerInput.Horizontal] = evt.clientX;\r\n pointer[PointerInput.Vertical] = evt.clientY;\r\n pointer[evt.button + 2] = 1;\r\n\r\n const deviceEvent = evt as IUIEvent;\r\n\r\n // NOTE: The +2 used here to is because PointerInput has the same value progression for its mouse buttons as PointerEvent.button\r\n // However, we have our X and Y values front-loaded to group together the touch inputs but not break this progression\r\n // EG. ([X, Y, Left-click], Middle-click, etc...)\r\n deviceEvent.inputIndex = evt.button + 2;\r\n\r\n this._onInputChanged(deviceType, deviceSlot, deviceEvent);\r\n\r\n if (previousHorizontal !== evt.clientX || previousVertical !== evt.clientY) {\r\n deviceEvent.inputIndex = PointerInput.Move;\r\n this._onInputChanged(deviceType, deviceSlot, deviceEvent);\r\n }\r\n }\r\n };\r\n\r\n this._pointerUpEvent = (evt) => {\r\n const deviceType = this._getPointerType(evt);\r\n const deviceSlot = deviceType === DeviceType.Mouse ? 0 : this._activeTouchIds.indexOf(evt.pointerId);\r\n\r\n if (deviceType === DeviceType.Touch) {\r\n if (deviceSlot === -1) {\r\n return;\r\n } else {\r\n this._activeTouchIds[deviceSlot] = -1;\r\n }\r\n }\r\n\r\n const pointer = this._inputs[deviceType]?.[deviceSlot];\r\n if (pointer && pointer[evt.button + 2] !== 0) {\r\n const previousHorizontal = pointer[PointerInput.Horizontal];\r\n const previousVertical = pointer[PointerInput.Vertical];\r\n\r\n pointer[PointerInput.Horizontal] = evt.clientX;\r\n pointer[PointerInput.Vertical] = evt.clientY;\r\n pointer[evt.button + 2] = 0;\r\n\r\n const deviceEvent = evt as IUIEvent;\r\n\r\n if (previousHorizontal !== evt.clientX || previousVertical !== evt.clientY) {\r\n deviceEvent.inputIndex = PointerInput.Move;\r\n this._onInputChanged(deviceType, deviceSlot, deviceEvent);\r\n }\r\n\r\n // NOTE: The +2 used here to is because PointerInput has the same value progression for its mouse buttons as PointerEvent.button\r\n // However, we have our X and Y values front-loaded to group together the touch inputs but not break this progression\r\n // EG. ([X, Y, Left-click], Middle-click, etc...)\r\n deviceEvent.inputIndex = evt.button + 2;\r\n\r\n if (deviceType === DeviceType.Mouse && this._mouseId >= 0 && this._elementToAttachTo.hasPointerCapture?.(this._mouseId)) {\r\n this._elementToAttachTo.releasePointerCapture(this._mouseId);\r\n } else if (evt.pointerId && this._elementToAttachTo.hasPointerCapture?.(evt.pointerId)) {\r\n this._elementToAttachTo.releasePointerCapture(evt.pointerId);\r\n }\r\n\r\n this._onInputChanged(deviceType, deviceSlot, deviceEvent);\r\n\r\n if (deviceType === DeviceType.Touch) {\r\n this._onDeviceDisconnected(deviceType, deviceSlot);\r\n }\r\n }\r\n };\r\n\r\n this._pointerCancelEvent = (evt) => {\r\n if (evt.pointerType === \"mouse\") {\r\n const pointer = this._inputs[DeviceType.Mouse][0];\r\n\r\n if (this._mouseId >= 0 && this._elementToAttachTo.hasPointerCapture?.(this._mouseId)) {\r\n this._elementToAttachTo.releasePointerCapture(this._mouseId);\r\n }\r\n\r\n for (let inputIndex = PointerInput.LeftClick; inputIndex <= PointerInput.BrowserForward; inputIndex++) {\r\n if (pointer[inputIndex] === 1) {\r\n pointer[inputIndex] = 0;\r\n\r\n const deviceEvent: IUIEvent = DeviceEventFactory.CreateDeviceEvent(DeviceType.Mouse, 0, inputIndex, 0, this, this._elementToAttachTo);\r\n\r\n this._onInputChanged(DeviceType.Mouse, 0, deviceEvent);\r\n }\r\n }\r\n } else {\r\n const deviceSlot = this._activeTouchIds.indexOf(evt.pointerId);\r\n\r\n if (this._elementToAttachTo.hasPointerCapture?.(evt.pointerId)) {\r\n this._elementToAttachTo.releasePointerCapture(evt.pointerId);\r\n }\r\n\r\n this._inputs[DeviceType.Touch][deviceSlot][PointerInput.LeftClick] = 0;\r\n\r\n const deviceEvent: IUIEvent = DeviceEventFactory.CreateDeviceEvent(DeviceType.Touch, deviceSlot, PointerInput.LeftClick, 0, this, this._elementToAttachTo);\r\n\r\n this._onInputChanged(DeviceType.Touch, deviceSlot, deviceEvent);\r\n\r\n this._activeTouchIds[deviceSlot] = -1;\r\n this._onDeviceDisconnected(DeviceType.Touch, deviceSlot);\r\n }\r\n };\r\n\r\n // Set Wheel Event Name, code originally from scene.inputManager\r\n this._wheelEventName =\r\n \"onwheel\" in document.createElement(\"div\")\r\n ? \"wheel\" // Modern browsers support \"wheel\"\r\n : (<any>document).onmousewheel !== undefined\r\n ? \"mousewheel\" // Webkit and IE support at least \"mousewheel\"\r\n : \"DOMMouseScroll\"; // let's assume that remaining browsers are older Firefox\r\n\r\n // Code originally in scene.inputManager.ts\r\n // Chrome reports warning in console if wheel listener doesn't set an explicit passive option.\r\n // IE11 only supports captureEvent:boolean, not options:object, and it defaults to false.\r\n // Feature detection technique copied from: https://github.com/github/eventlistener-polyfill (MIT license)\r\n let passiveSupported = false;\r\n const noop = function () {};\r\n\r\n try {\r\n const options = Object.defineProperty({}, \"passive\", {\r\n get: function () {\r\n passiveSupported = true;\r\n },\r\n });\r\n\r\n this._elementToAttachTo.addEventListener(\"test\", noop, options);\r\n this._elementToAttachTo.removeEventListener(\"test\", noop, options);\r\n } catch (e) {\r\n /* */\r\n }\r\n\r\n this._pointerBlurEvent = () => {\r\n // Handle mouse buttons\r\n if (this.isDeviceAvailable(DeviceType.Mouse)) {\r\n const pointer = this._inputs[DeviceType.Mouse][0];\r\n\r\n if (this._mouseId >= 0 && this._elementToAttachTo.hasPointerCapture?.(this._mouseId)) {\r\n this._elementToAttachTo.releasePointerCapture(this._mouseId);\r\n }\r\n\r\n for (let inputIndex = PointerInput.LeftClick; inputIndex <= PointerInput.BrowserForward; inputIndex++) {\r\n if (pointer[inputIndex] === 1) {\r\n pointer[inputIndex] = 0;\r\n\r\n const deviceEvent: IUIEvent = DeviceEventFactory.CreateDeviceEvent(DeviceType.Mouse, 0, inputIndex, 0, this, this._elementToAttachTo);\r\n\r\n this._onInputChanged(DeviceType.Mouse, 0, deviceEvent);\r\n }\r\n }\r\n }\r\n\r\n // Handle Active Touches\r\n if (this.isDeviceAvailable(DeviceType.Touch)) {\r\n const pointer = this._inputs[DeviceType.Touch];\r\n\r\n for (let deviceSlot = 0; deviceSlot < this._activeTouchIds.length; deviceSlot++) {\r\n const pointerId = this._activeTouchIds[deviceSlot];\r\n\r\n if (this._elementToAttachTo.hasPointerCapture?.(pointerId)) {\r\n this._elementToAttachTo.releasePointerCapture(pointerId);\r\n }\r\n\r\n if (pointerId !== -1 && pointer[deviceSlot]?.[PointerInput.LeftClick] === 1) {\r\n pointer[deviceSlot][PointerInput.LeftClick] = 0;\r\n\r\n const deviceEvent: IUIEvent = DeviceEventFactory.CreateDeviceEvent(DeviceType.Touch, deviceSlot, PointerInput.LeftClick, 0, this, this._elementToAttachTo);\r\n\r\n this._onInputChanged(DeviceType.Touch, deviceSlot, deviceEvent);\r\n\r\n this._activeTouchIds[deviceSlot] = -1;\r\n this._onDeviceDisconnected(DeviceType.Touch, deviceSlot);\r\n }\r\n }\r\n }\r\n };\r\n\r\n this._pointerWheelEvent = (evt) => {\r\n const deviceType = DeviceType.Mouse;\r\n const deviceSlot = 0;\r\n\r\n if (!this._inputs[deviceType]) {\r\n this._inputs[deviceType] = [];\r\n }\r\n\r\n if (!this._inputs[deviceType][deviceSlot]) {\r\n this._pointerActive = true;\r\n this._registerDevice(deviceType, deviceSlot, MAX_POINTER_INPUTS);\r\n }\r\n\r\n const pointer = this._inputs[deviceType][deviceSlot];\r\n if (pointer) {\r\n pointer[PointerInput.MouseWheelX] = evt.deltaX || 0;\r\n pointer[PointerInput.MouseWheelY] = evt.deltaY || evt.wheelDelta || 0;\r\n pointer[PointerInput.MouseWheelZ] = evt.deltaZ || 0;\r\n\r\n const deviceEvent = evt as IUIEvent;\r\n\r\n if (pointer[PointerInput.MouseWheelX] !== 0) {\r\n deviceEvent.inputIndex = PointerInput.MouseWheelX;\r\n this._onInputChanged(deviceType, deviceSlot, deviceEvent);\r\n }\r\n if (pointer[PointerInput.MouseWheelY] !== 0) {\r\n deviceEvent.inputIndex = PointerInput.MouseWheelY;\r\n this._onInputChanged(deviceType, deviceSlot, deviceEvent);\r\n }\r\n if (pointer[PointerInput.MouseWheelZ] !== 0) {\r\n deviceEvent.inputIndex = PointerInput.MouseWheelZ;\r\n this._onInputChanged(deviceType, deviceSlot, deviceEvent);\r\n }\r\n }\r\n };\r\n\r\n this._elementToAttachTo.addEventListener(this._eventPrefix + \"move\", this._pointerMoveEvent);\r\n this._elementToAttachTo.addEventListener(this._eventPrefix + \"down\", this._pointerDownEvent);\r\n this._elementToAttachTo.addEventListener(this._eventPrefix + \"up\", this._pointerUpEvent);\r\n this._elementToAttachTo.addEventListener(this._eventPrefix + \"cancel\", this._pointerCancelEvent);\r\n this._elementToAttachTo.addEventListener(\"blur\", this._pointerBlurEvent);\r\n this._elementToAttachTo.addEventListener(this._wheelEventName, this._pointerWheelEvent, passiveSupported ? { passive: false } : false);\r\n\r\n // Since there's no up or down event for mouse wheel or delta x/y, clear mouse values at end of frame\r\n this._pointerInputClearObserver = this._engine.onEndFrameObservable.add(() => {\r\n if (this.isDeviceAvailable(DeviceType.Mouse)) {\r\n const pointer = this._inputs[DeviceType.Mouse][0];\r\n pointer[PointerInput.MouseWheelX] = 0;\r\n pointer[PointerInput.MouseWheelY] = 0;\r\n pointer[PointerInput.MouseWheelZ] = 0;\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Handle all actions that come from gamepad interaction\r\n */\r\n private _handleGamepadActions(): void {\r\n this._gamepadConnectedEvent = (evt: any) => {\r\n this._addGamePad(evt.gamepad);\r\n };\r\n\r\n this._gamepadDisconnectedEvent = (evt: any) => {\r\n if (this._gamepads) {\r\n const deviceType = this._getGamepadDeviceType(evt.gamepad.id);\r\n const deviceSlot = evt.gamepad.index;\r\n\r\n this._unregisterDevice(deviceType, deviceSlot);\r\n delete this._gamepads[deviceSlot];\r\n }\r\n };\r\n\r\n window.addEventListener(\"gamepadconnected\", this._gamepadConnectedEvent);\r\n window.addEventListener(\"gamepaddisconnected\", this._gamepadDisconnectedEvent);\r\n }\r\n\r\n /**\r\n * Update all non-event based devices with each frame\r\n * @param deviceType Enum specifying device type\r\n * @param deviceSlot \"Slot\" or index that device is referenced in\r\n * @param inputIndex Id of input to be checked\r\n */\r\n private _updateDevice(deviceType: DeviceType, deviceSlot: number, inputIndex: number): void {\r\n // Gamepads\r\n const gp = navigator.getGamepads()[deviceSlot];\r\n\r\n if (gp && deviceType === this._gamepads[deviceSlot]) {\r\n const device = this._inputs[deviceType][deviceSlot];\r\n\r\n if (inputIndex >= gp.buttons.length) {\r\n device[inputIndex] = gp.axes[inputIndex - gp.buttons.length].valueOf();\r\n } else {\r\n device[inputIndex] = gp.buttons[inputIndex].value;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Gets DeviceType from the device name\r\n * @param deviceName Name of Device from DeviceInputSystem\r\n * @returns DeviceType enum value\r\n */\r\n private _getGamepadDeviceType(deviceName: string): DeviceType {\r\n if (deviceName.indexOf(\"054c\") !== -1) {\r\n // DualShock 4 Gamepad\r\n return deviceName.indexOf(\"0ce6\") !== -1 ? DeviceType.DualSense : DeviceType.DualShock;\r\n } else if (deviceName.indexOf(\"Xbox One\") !== -1 || deviceName.search(\"Xbox 360\") !== -1 || deviceName.search(\"xinput\") !== -1) {\r\n // Xbox Gamepad\r\n return DeviceType.Xbox;\r\n } else if (deviceName.indexOf(\"057e\") !== -1) {\r\n // Switch Gamepad\r\n return DeviceType.Switch;\r\n }\r\n\r\n return DeviceType.Generic;\r\n }\r\n\r\n /**\r\n * Get DeviceType from a given pointer/mouse/touch event.\r\n * @param evt PointerEvent to evaluate\r\n * @returns DeviceType interpreted from event\r\n */\r\n private _getPointerType(evt: any): DeviceType {\r\n let deviceType = DeviceType.Mouse;\r\n\r\n if (evt.pointerType === \"touch\" || evt.pointerType === \"pen\" || evt.touches) {\r\n deviceType = DeviceType.Touch;\r\n }\r\n\r\n return deviceType;\r\n }\r\n}\r\n"]}
|
|
@@ -173,11 +173,11 @@ ThinEngine.prototype.updateRawCubeTexture = function (texture, data, format, typ
|
|
|
173
173
|
ThinEngine.prototype.createRawCubeTextureFromUrl = function (url, scene, size, format, type, noMipmap, callback, mipmapGenerator, onLoad = null, onError = null, samplingMode = 3, invertY = false) {
|
|
174
174
|
const gl = this._gl;
|
|
175
175
|
const texture = this.createRawCubeTexture(null, size, format, type, !noMipmap, invertY, samplingMode, null);
|
|
176
|
-
scene
|
|
176
|
+
scene === null || scene === void 0 ? void 0 : scene.addPendingData(texture);
|
|
177
177
|
texture.url = url;
|
|
178
178
|
this._internalTexturesCache.push(texture);
|
|
179
179
|
const onerror = (request, exception) => {
|
|
180
|
-
scene
|
|
180
|
+
scene === null || scene === void 0 ? void 0 : scene.removePendingData(texture);
|
|
181
181
|
if (onError && request) {
|
|
182
182
|
onError(request.status + " " + request.statusText, exception);
|
|
183
183
|
}
|
|
@@ -217,7 +217,7 @@ ThinEngine.prototype.createRawCubeTextureFromUrl = function (url, scene, size, f
|
|
|
217
217
|
}
|
|
218
218
|
texture.isReady = true;
|
|
219
219
|
// this.resetTextureCache();
|
|
220
|
-
scene
|
|
220
|
+
scene === null || scene === void 0 ? void 0 : scene.removePendingData(texture);
|
|
221
221
|
texture.onLoadedObservable.notifyObservers(texture);
|
|
222
222
|
texture.onLoadedObservable.clear();
|
|
223
223
|
if (onLoad) {
|
|
@@ -226,7 +226,7 @@ ThinEngine.prototype.createRawCubeTextureFromUrl = function (url, scene, size, f
|
|
|
226
226
|
};
|
|
227
227
|
this._loadFile(url, (data) => {
|
|
228
228
|
internalCallback(data);
|
|
229
|
-
}, undefined, scene
|
|
229
|
+
}, undefined, scene === null || scene === void 0 ? void 0 : scene.offlineProvider, true, onerror);
|
|
230
230
|
return texture;
|
|
231
231
|
};
|
|
232
232
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine.rawTexture.js","sourceRoot":"","sources":["../../../../../../lts/core/generated/Engines/Extensions/engine.rawTexture.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AAClG,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AA4R3C,UAAU,CAAC,SAAS,CAAC,gBAAgB,GAAG,UACpC,OAAkC,EAClC,IAA+B,EAC/B,MAAc,EACd,OAAgB,EAChB,cAAgC,IAAI,EACpC,OAAe,SAAS,CAAC,wBAAwB,EACjD,gBAAyB,KAAK;IAE9B,IAAI,CAAC,OAAO,EAAE;QACV,OAAO;KACV;IACD,kEAAkE;IAClE,MAAM,kBAAkB,GAAG,IAAI,CAAC,iCAAiC,CAAC,IAAI,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC;IAE/F,sDAAsD;IACtD,MAAM,cAAc,GAAG,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC;IACvD,MAAM,WAAW,GAAG,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC;IACpD,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;IAC9D,IAAI,CAAC,YAAY,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IAEzE,IAAI,CAAC,IAAI,CAAC,uBAAuB,EAAE;QAC/B,OAAO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C,uBAAuB,GAAG,6BAA6B,CAAC,KAAK,CAAC,CAAC;AACpF,UAAU,CAAC,SAAS,CAAC,kBAAkB,GAAG,6BAA6B,CAAC,IAAI,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"../../types\";\r\nimport { InternalTexture, InternalTextureSource } from \"../../Materials/Textures/internalTexture\";\r\nimport { Logger } from \"../../Misc/logger\";\r\nimport { Tools } from \"../../Misc/tools\";\r\nimport type { Scene } from \"../../scene\";\r\nimport { Constants } from \"../constants\";\r\nimport { ThinEngine } from \"../thinEngine\";\r\nimport type { IWebRequest } from \"../../Misc/interfaces/iWebRequest\";\r\n\r\ndeclare module \"../../Engines/thinEngine\" {\r\n export interface ThinEngine {\r\n /**\r\n * Creates a raw texture\r\n * @param data defines the data to store in the texture\r\n * @param width defines the width of the texture\r\n * @param height defines the height of the texture\r\n * @param format defines the format of the data\r\n * @param generateMipMaps defines if the engine should generate the mip levels\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param samplingMode defines the required sampling mode (Texture.NEAREST_SAMPLINGMODE by default)\r\n * @param compression defines the compression used (null by default)\r\n * @param type defines the type fo the data (Engine.TEXTURETYPE_UNSIGNED_INT by default)\r\n * @param creationFlags specific flags to use when creating the texture (Constants.TEXTURE_CREATIONFLAG_STORAGE for storage textures, for eg)\r\n * @param useSRGBBuffer defines if the texture must be loaded in a sRGB GPU buffer (if supported by the GPU).\r\n * @returns the raw texture inside an InternalTexture\r\n */\r\n createRawTexture(\r\n data: Nullable<ArrayBufferView>,\r\n width: number,\r\n height: number,\r\n format: number,\r\n generateMipMaps: boolean,\r\n invertY: boolean,\r\n samplingMode: number,\r\n compression: Nullable<string>,\r\n type: number,\r\n creationFlags?: number,\r\n useSRGBBuffer?: boolean\r\n ): InternalTexture;\r\n\r\n /**\r\n * Update a raw texture\r\n * @param texture defines the texture to update\r\n * @param data defines the data to store in the texture\r\n * @param format defines the format of the data\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n */\r\n updateRawTexture(texture: Nullable<InternalTexture>, data: Nullable<ArrayBufferView>, format: number, invertY: boolean): void;\r\n\r\n /**\r\n * Update a raw texture\r\n * @param texture defines the texture to update\r\n * @param data defines the data to store in the texture\r\n * @param format defines the format of the data\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param compression defines the compression used (null by default)\r\n * @param type defines the type fo the data (Engine.TEXTURETYPE_UNSIGNED_INT by default)\r\n * @param useSRGBBuffer defines if the texture must be loaded in a sRGB GPU buffer (if supported by the GPU).\r\n */\r\n updateRawTexture(\r\n texture: Nullable<InternalTexture>,\r\n data: Nullable<ArrayBufferView>,\r\n format: number,\r\n invertY: boolean,\r\n compression: Nullable<string>,\r\n type: number,\r\n useSRGBBuffer: boolean\r\n ): void;\r\n\r\n /**\r\n * Creates a new raw cube texture\r\n * @param data defines the array of data to use to create each face\r\n * @param size defines the size of the textures\r\n * @param format defines the format of the data\r\n * @param type defines the type of the data (like Engine.TEXTURETYPE_UNSIGNED_INT)\r\n * @param generateMipMaps defines if the engine should generate the mip levels\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param samplingMode defines the required sampling mode (like Texture.NEAREST_SAMPLINGMODE)\r\n * @param compression defines the compression used (null by default)\r\n * @returns the cube texture as an InternalTexture\r\n */\r\n createRawCubeTexture(\r\n data: Nullable<ArrayBufferView[]>,\r\n size: number,\r\n format: number,\r\n type: number,\r\n generateMipMaps: boolean,\r\n invertY: boolean,\r\n samplingMode: number,\r\n compression: Nullable<string>\r\n ): InternalTexture;\r\n\r\n /**\r\n * Update a raw cube texture\r\n * @param texture defines the texture to update\r\n * @param data defines the data to store\r\n * @param format defines the data format\r\n * @param type defines the type fo the data (Engine.TEXTURETYPE_UNSIGNED_INT by default)\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n */\r\n updateRawCubeTexture(texture: InternalTexture, data: ArrayBufferView[], format: number, type: number, invertY: boolean): void;\r\n\r\n /**\r\n * Update a raw cube texture\r\n * @param texture defines the texture to update\r\n * @param data defines the data to store\r\n * @param format defines the data format\r\n * @param type defines the type fo the data (Engine.TEXTURETYPE_UNSIGNED_INT by default)\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param compression defines the compression used (null by default)\r\n */\r\n updateRawCubeTexture(texture: InternalTexture, data: ArrayBufferView[], format: number, type: number, invertY: boolean, compression: Nullable<string>): void;\r\n\r\n /**\r\n * Update a raw cube texture\r\n * @param texture defines the texture to update\r\n * @param data defines the data to store\r\n * @param format defines the data format\r\n * @param type defines the type fo the data (Engine.TEXTURETYPE_UNSIGNED_INT by default)\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param compression defines the compression used (null by default)\r\n * @param level defines which level of the texture to update\r\n */\r\n updateRawCubeTexture(texture: InternalTexture, data: ArrayBufferView[], format: number, type: number, invertY: boolean, compression: Nullable<string>, level: number): void;\r\n\r\n /**\r\n * Creates a new raw cube texture from a specified url\r\n * @param url defines the url where the data is located\r\n * @param scene defines the current scene\r\n * @param size defines the size of the textures\r\n * @param format defines the format of the data\r\n * @param type defines the type fo the data (like Engine.TEXTURETYPE_UNSIGNED_INT)\r\n * @param noMipmap defines if the engine should avoid generating the mip levels\r\n * @param callback defines a callback used to extract texture data from loaded data\r\n * @param mipmapGenerator defines to provide an optional tool to generate mip levels\r\n * @param onLoad defines a callback called when texture is loaded\r\n * @param onError defines a callback called if there is an error\r\n * @returns the cube texture as an InternalTexture\r\n */\r\n createRawCubeTextureFromUrl(\r\n url: string,\r\n scene: Nullable<Scene>,\r\n size: number,\r\n format: number,\r\n type: number,\r\n noMipmap: boolean,\r\n callback: (ArrayBuffer: ArrayBuffer) => Nullable<ArrayBufferView[]>,\r\n mipmapGenerator: Nullable<(faces: ArrayBufferView[]) => ArrayBufferView[][]>,\r\n onLoad: Nullable<() => void>,\r\n onError: Nullable<(message?: string, exception?: any) => void>\r\n ): InternalTexture;\r\n\r\n /**\r\n * Creates a new raw cube texture from a specified url\r\n * @param url defines the url where the data is located\r\n * @param scene defines the current scene\r\n * @param size defines the size of the textures\r\n * @param format defines the format of the data\r\n * @param type defines the type fo the data (like Engine.TEXTURETYPE_UNSIGNED_INT)\r\n * @param noMipmap defines if the engine should avoid generating the mip levels\r\n * @param callback defines a callback used to extract texture data from loaded data\r\n * @param mipmapGenerator defines to provide an optional tool to generate mip levels\r\n * @param onLoad defines a callback called when texture is loaded\r\n * @param onError defines a callback called if there is an error\r\n * @param samplingMode defines the required sampling mode (like Texture.NEAREST_SAMPLINGMODE)\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @returns the cube texture as an InternalTexture\r\n */\r\n createRawCubeTextureFromUrl(\r\n url: string,\r\n scene: Nullable<Scene>,\r\n size: number,\r\n format: number,\r\n type: number,\r\n noMipmap: boolean,\r\n callback: (ArrayBuffer: ArrayBuffer) => Nullable<ArrayBufferView[]>,\r\n mipmapGenerator: Nullable<(faces: ArrayBufferView[]) => ArrayBufferView[][]>,\r\n onLoad: Nullable<() => void>,\r\n onError: Nullable<(message?: string, exception?: any) => void>,\r\n samplingMode: number,\r\n invertY: boolean\r\n ): InternalTexture;\r\n\r\n /**\r\n * Creates a new raw 3D texture\r\n * @param data defines the data used to create the texture\r\n * @param width defines the width of the texture\r\n * @param height defines the height of the texture\r\n * @param depth defines the depth of the texture\r\n * @param format defines the format of the texture\r\n * @param generateMipMaps defines if the engine must generate mip levels\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param samplingMode defines the required sampling mode (like Texture.NEAREST_SAMPLINGMODE)\r\n * @param compression defines the compressed used (can be null)\r\n * @param textureType defines the compressed used (can be null)\r\n * @param creationFlags specific flags to use when creating the texture (Constants.TEXTURE_CREATIONFLAG_STORAGE for storage textures, for eg)\r\n * @returns a new raw 3D texture (stored in an InternalTexture)\r\n */\r\n createRawTexture3D(\r\n data: Nullable<ArrayBufferView>,\r\n width: number,\r\n height: number,\r\n depth: number,\r\n format: number,\r\n generateMipMaps: boolean,\r\n invertY: boolean,\r\n samplingMode: number,\r\n compression: Nullable<string>,\r\n textureType: number,\r\n creationFlags?: number\r\n ): InternalTexture;\r\n\r\n /**\r\n * Update a raw 3D texture\r\n * @param texture defines the texture to update\r\n * @param data defines the data to store\r\n * @param format defines the data format\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n */\r\n updateRawTexture3D(texture: InternalTexture, data: Nullable<ArrayBufferView>, format: number, invertY: boolean): void;\r\n\r\n /**\r\n * Update a raw 3D texture\r\n * @param texture defines the texture to update\r\n * @param data defines the data to store\r\n * @param format defines the data format\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param compression defines the used compression (can be null)\r\n * @param textureType defines the texture Type (Engine.TEXTURETYPE_UNSIGNED_INT, Engine.TEXTURETYPE_FLOAT...)\r\n */\r\n updateRawTexture3D(texture: InternalTexture, data: Nullable<ArrayBufferView>, format: number, invertY: boolean, compression: Nullable<string>, textureType: number): void;\r\n\r\n /**\r\n * Creates a new raw 2D array texture\r\n * @param data defines the data used to create the texture\r\n * @param width defines the width of the texture\r\n * @param height defines the height of the texture\r\n * @param depth defines the number of layers of the texture\r\n * @param format defines the format of the texture\r\n * @param generateMipMaps defines if the engine must generate mip levels\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param samplingMode defines the required sampling mode (like Texture.NEAREST_SAMPLINGMODE)\r\n * @param compression defines the compressed used (can be null)\r\n * @param textureType defines the compressed used (can be null)\r\n * @param creationFlags specific flags to use when creating the texture (Constants.TEXTURE_CREATIONFLAG_STORAGE for storage textures, for eg)\r\n * @returns a new raw 2D array texture (stored in an InternalTexture)\r\n */\r\n createRawTexture2DArray(\r\n data: Nullable<ArrayBufferView>,\r\n width: number,\r\n height: number,\r\n depth: number,\r\n format: number,\r\n generateMipMaps: boolean,\r\n invertY: boolean,\r\n samplingMode: number,\r\n compression: Nullable<string>,\r\n textureType: number,\r\n creationFlags?: number\r\n ): InternalTexture;\r\n\r\n /**\r\n * Update a raw 2D array texture\r\n * @param texture defines the texture to update\r\n * @param data defines the data to store\r\n * @param format defines the data format\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n */\r\n updateRawTexture2DArray(texture: InternalTexture, data: Nullable<ArrayBufferView>, format: number, invertY: boolean): void;\r\n\r\n /**\r\n * Update a raw 2D array texture\r\n * @param texture defines the texture to update\r\n * @param data defines the data to store\r\n * @param format defines the data format\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param compression defines the used compression (can be null)\r\n * @param textureType defines the texture Type (Engine.TEXTURETYPE_UNSIGNED_INT, Engine.TEXTURETYPE_FLOAT...)\r\n */\r\n updateRawTexture2DArray(\r\n texture: InternalTexture,\r\n data: Nullable<ArrayBufferView>,\r\n format: number,\r\n invertY: boolean,\r\n compression: Nullable<string>,\r\n textureType: number\r\n ): void;\r\n }\r\n}\r\n\r\nThinEngine.prototype.updateRawTexture = function (\r\n texture: Nullable<InternalTexture>,\r\n data: Nullable<ArrayBufferView>,\r\n format: number,\r\n invertY: boolean,\r\n compression: Nullable<string> = null,\r\n type: number = Constants.TEXTURETYPE_UNSIGNED_INT,\r\n useSRGBBuffer: boolean = false\r\n): void {\r\n if (!texture) {\r\n return;\r\n }\r\n // Babylon's internalSizedFomat but gl's texImage2D internalFormat\r\n const internalSizedFomat = this._getRGBABufferInternalSizedFormat(type, format, useSRGBBuffer);\r\n\r\n // Babylon's internalFormat but gl's texImage2D format\r\n const internalFormat = this._getInternalFormat(format);\r\n const textureType = this._getWebGLTextureType(type);\r\n this._bindTextureDirectly(this._gl.TEXTURE_2D, texture, true);\r\n this._unpackFlipY(invertY === undefined ? true : invertY ? true : false);\r\n\r\n if (!this._doNotHandleContextLost) {\r\n texture._bufferView = data;\r\n texture.format = format;\r\n texture.type = type;\r\n texture.invertY = invertY;\r\n texture._compression = compression;\r\n }\r\n\r\n if (texture.width % 4 !== 0) {\r\n this._gl.pixelStorei(this._gl.UNPACK_ALIGNMENT, 1);\r\n }\r\n\r\n if (compression && data) {\r\n this._gl.compressedTexImage2D(this._gl.TEXTURE_2D, 0, (<any>this.getCaps().s3tc)[compression], texture.width, texture.height, 0, <DataView>data);\r\n } else {\r\n this._gl.texImage2D(this._gl.TEXTURE_2D, 0, internalSizedFomat, texture.width, texture.height, 0, internalFormat, textureType, data);\r\n }\r\n\r\n if (texture.generateMipMaps) {\r\n this._gl.generateMipmap(this._gl.TEXTURE_2D);\r\n }\r\n this._bindTextureDirectly(this._gl.TEXTURE_2D, null);\r\n // this.resetTextureCache();\r\n texture.isReady = true;\r\n};\r\n\r\nThinEngine.prototype.createRawTexture = function (\r\n data: Nullable<ArrayBufferView>,\r\n width: number,\r\n height: number,\r\n format: number,\r\n generateMipMaps: boolean,\r\n invertY: boolean,\r\n samplingMode: number,\r\n compression: Nullable<string> = null,\r\n type: number = Constants.TEXTURETYPE_UNSIGNED_INT,\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n creationFlags = 0,\r\n useSRGBBuffer = false\r\n): InternalTexture {\r\n const texture = new InternalTexture(this, InternalTextureSource.Raw);\r\n texture.baseWidth = width;\r\n texture.baseHeight = height;\r\n texture.width = width;\r\n texture.height = height;\r\n texture.format = format;\r\n texture.generateMipMaps = generateMipMaps;\r\n texture.samplingMode = samplingMode;\r\n texture.invertY = invertY;\r\n texture._compression = compression;\r\n texture.type = type;\r\n texture._useSRGBBuffer = this._getUseSRGBBuffer(useSRGBBuffer, !generateMipMaps);\r\n\r\n if (!this._doNotHandleContextLost) {\r\n texture._bufferView = data;\r\n }\r\n\r\n this.updateRawTexture(texture, data, format, invertY, compression, type, texture._useSRGBBuffer);\r\n this._bindTextureDirectly(this._gl.TEXTURE_2D, texture, true);\r\n\r\n // Filters\r\n const filters = this._getSamplingParameters(samplingMode, generateMipMaps);\r\n\r\n this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MAG_FILTER, filters.mag);\r\n this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MIN_FILTER, filters.min);\r\n\r\n if (generateMipMaps) {\r\n this._gl.generateMipmap(this._gl.TEXTURE_2D);\r\n }\r\n\r\n this._bindTextureDirectly(this._gl.TEXTURE_2D, null);\r\n\r\n this._internalTexturesCache.push(texture);\r\n\r\n return texture;\r\n};\r\n\r\nThinEngine.prototype.createRawCubeTexture = function (\r\n data: Nullable<ArrayBufferView[]>,\r\n size: number,\r\n format: number,\r\n type: number,\r\n generateMipMaps: boolean,\r\n invertY: boolean,\r\n samplingMode: number,\r\n compression: Nullable<string> = null\r\n): InternalTexture {\r\n const gl = this._gl;\r\n const texture = new InternalTexture(this, InternalTextureSource.CubeRaw);\r\n texture.isCube = true;\r\n texture.format = format;\r\n texture.type = type;\r\n if (!this._doNotHandleContextLost) {\r\n texture._bufferViewArray = data;\r\n }\r\n\r\n const textureType = this._getWebGLTextureType(type);\r\n let internalFormat = this._getInternalFormat(format);\r\n\r\n if (internalFormat === gl.RGB) {\r\n internalFormat = gl.RGBA;\r\n }\r\n\r\n // Mipmap generation needs a sized internal format that is both color-renderable and texture-filterable\r\n if (textureType === gl.FLOAT && !this._caps.textureFloatLinearFiltering) {\r\n generateMipMaps = false;\r\n samplingMode = Constants.TEXTURE_NEAREST_SAMPLINGMODE;\r\n Logger.Warn(\"Float texture filtering is not supported. Mipmap generation and sampling mode are forced to false and TEXTURE_NEAREST_SAMPLINGMODE, respectively.\");\r\n } else if (textureType === this._gl.HALF_FLOAT_OES && !this._caps.textureHalfFloatLinearFiltering) {\r\n generateMipMaps = false;\r\n samplingMode = Constants.TEXTURE_NEAREST_SAMPLINGMODE;\r\n Logger.Warn(\"Half float texture filtering is not supported. Mipmap generation and sampling mode are forced to false and TEXTURE_NEAREST_SAMPLINGMODE, respectively.\");\r\n } else if (textureType === gl.FLOAT && !this._caps.textureFloatRender) {\r\n generateMipMaps = false;\r\n Logger.Warn(\"Render to float textures is not supported. Mipmap generation forced to false.\");\r\n } else if (textureType === gl.HALF_FLOAT && !this._caps.colorBufferFloat) {\r\n generateMipMaps = false;\r\n Logger.Warn(\"Render to half float textures is not supported. Mipmap generation forced to false.\");\r\n }\r\n\r\n const width = size;\r\n const height = width;\r\n\r\n texture.width = width;\r\n texture.height = height;\r\n\r\n // Double check on POT to generate Mips.\r\n const isPot = !this.needPOTTextures || (Tools.IsExponentOfTwo(texture.width) && Tools.IsExponentOfTwo(texture.height));\r\n if (!isPot) {\r\n generateMipMaps = false;\r\n }\r\n\r\n // Upload data if needed. The texture won't be ready until then.\r\n if (data) {\r\n this.updateRawCubeTexture(texture, data, format, type, invertY, compression);\r\n }\r\n\r\n this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, texture, true);\r\n\r\n // Filters\r\n if (data && generateMipMaps) {\r\n this._gl.generateMipmap(this._gl.TEXTURE_CUBE_MAP);\r\n }\r\n\r\n const filters = this._getSamplingParameters(samplingMode, generateMipMaps);\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MAG_FILTER, filters.mag);\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, filters.min);\r\n\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\r\n this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, null);\r\n\r\n texture.generateMipMaps = generateMipMaps;\r\n texture.samplingMode = samplingMode;\r\n\r\n return texture;\r\n};\r\n\r\nThinEngine.prototype.updateRawCubeTexture = function (\r\n texture: InternalTexture,\r\n data: ArrayBufferView[],\r\n format: number,\r\n type: number,\r\n invertY: boolean,\r\n compression: Nullable<string> = null,\r\n level: number = 0\r\n): void {\r\n texture._bufferViewArray = data;\r\n texture.format = format;\r\n texture.type = type;\r\n texture.invertY = invertY;\r\n texture._compression = compression;\r\n\r\n const gl = this._gl;\r\n const textureType = this._getWebGLTextureType(type);\r\n let internalFormat = this._getInternalFormat(format);\r\n const internalSizedFomat = this._getRGBABufferInternalSizedFormat(type);\r\n\r\n let needConversion = false;\r\n if (internalFormat === gl.RGB) {\r\n internalFormat = gl.RGBA;\r\n needConversion = true;\r\n }\r\n\r\n this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, texture, true);\r\n this._unpackFlipY(invertY === undefined ? true : invertY ? true : false);\r\n\r\n if (texture.width % 4 !== 0) {\r\n gl.pixelStorei(gl.UNPACK_ALIGNMENT, 1);\r\n }\r\n\r\n // Data are known to be in +X +Y +Z -X -Y -Z\r\n for (let faceIndex = 0; faceIndex < 6; faceIndex++) {\r\n let faceData = data[faceIndex];\r\n\r\n if (compression) {\r\n gl.compressedTexImage2D(\r\n gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex,\r\n level,\r\n (<any>this.getCaps().s3tc)[compression],\r\n texture.width,\r\n texture.height,\r\n 0,\r\n <DataView>faceData\r\n );\r\n } else {\r\n if (needConversion) {\r\n faceData = _convertRGBtoRGBATextureData(faceData, texture.width, texture.height, type);\r\n }\r\n gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex, level, internalSizedFomat, texture.width, texture.height, 0, internalFormat, textureType, faceData);\r\n }\r\n }\r\n\r\n const isPot = !this.needPOTTextures || (Tools.IsExponentOfTwo(texture.width) && Tools.IsExponentOfTwo(texture.height));\r\n if (isPot && texture.generateMipMaps && level === 0) {\r\n this._gl.generateMipmap(this._gl.TEXTURE_CUBE_MAP);\r\n }\r\n this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, null);\r\n\r\n // this.resetTextureCache();\r\n texture.isReady = true;\r\n};\r\n\r\nThinEngine.prototype.createRawCubeTextureFromUrl = function (\r\n url: string,\r\n scene: Nullable<Scene>,\r\n size: number,\r\n format: number,\r\n type: number,\r\n noMipmap: boolean,\r\n callback: (ArrayBuffer: ArrayBuffer) => Nullable<ArrayBufferView[]>,\r\n mipmapGenerator: Nullable<(faces: ArrayBufferView[]) => ArrayBufferView[][]>,\r\n onLoad: Nullable<() => void> = null,\r\n onError: Nullable<(message?: string, exception?: any) => void> = null,\r\n samplingMode: number = Constants.TEXTURE_TRILINEAR_SAMPLINGMODE,\r\n invertY: boolean = false\r\n): InternalTexture {\r\n const gl = this._gl;\r\n const texture = this.createRawCubeTexture(null, size, format, type, !noMipmap, invertY, samplingMode, null);\r\n scene?.addPendingData(texture);\r\n texture.url = url;\r\n this._internalTexturesCache.push(texture);\r\n\r\n const onerror = (request?: IWebRequest, exception?: any) => {\r\n scene?.removePendingData(texture);\r\n if (onError && request) {\r\n onError(request.status + \" \" + request.statusText, exception);\r\n }\r\n };\r\n\r\n const internalCallback = (data: any) => {\r\n const width = texture.width;\r\n const faceDataArrays = callback(data);\r\n\r\n if (!faceDataArrays) {\r\n return;\r\n }\r\n\r\n if (mipmapGenerator) {\r\n const textureType = this._getWebGLTextureType(type);\r\n let internalFormat = this._getInternalFormat(format);\r\n const internalSizedFomat = this._getRGBABufferInternalSizedFormat(type);\r\n\r\n let needConversion = false;\r\n if (internalFormat === gl.RGB) {\r\n internalFormat = gl.RGBA;\r\n needConversion = true;\r\n }\r\n\r\n this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, texture, true);\r\n this._unpackFlipY(false);\r\n\r\n const mipData = mipmapGenerator(faceDataArrays);\r\n for (let level = 0; level < mipData.length; level++) {\r\n const mipSize = width >> level;\r\n\r\n for (let faceIndex = 0; faceIndex < 6; faceIndex++) {\r\n let mipFaceData = mipData[level][faceIndex];\r\n if (needConversion) {\r\n mipFaceData = _convertRGBtoRGBATextureData(mipFaceData, mipSize, mipSize, type);\r\n }\r\n gl.texImage2D(faceIndex, level, internalSizedFomat, mipSize, mipSize, 0, internalFormat, textureType, mipFaceData);\r\n }\r\n }\r\n\r\n this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, null);\r\n } else {\r\n this.updateRawCubeTexture(texture, faceDataArrays, format, type, invertY);\r\n }\r\n\r\n texture.isReady = true;\r\n // this.resetTextureCache();\r\n scene?.removePendingData(texture);\r\n\r\n texture.onLoadedObservable.notifyObservers(texture);\r\n texture.onLoadedObservable.clear();\r\n\r\n if (onLoad) {\r\n onLoad();\r\n }\r\n };\r\n\r\n this._loadFile(\r\n url,\r\n (data) => {\r\n internalCallback(data);\r\n },\r\n undefined,\r\n scene?.offlineProvider,\r\n true,\r\n onerror\r\n );\r\n\r\n return texture;\r\n};\r\n\r\n/**\r\n * @internal\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nfunction _convertRGBtoRGBATextureData(rgbData: any, width: number, height: number, textureType: number): ArrayBufferView {\r\n // Create new RGBA data container.\r\n let rgbaData: any;\r\n let val1 = 1;\r\n if (textureType === Constants.TEXTURETYPE_FLOAT) {\r\n rgbaData = new Float32Array(width * height * 4);\r\n } else if (textureType === Constants.TEXTURETYPE_HALF_FLOAT) {\r\n rgbaData = new Uint16Array(width * height * 4);\r\n val1 = 15360; // 15360 is the encoding of 1 in half float\r\n } else if (textureType === Constants.TEXTURETYPE_UNSIGNED_INTEGER) {\r\n rgbaData = new Uint32Array(width * height * 4);\r\n } else {\r\n rgbaData = new Uint8Array(width * height * 4);\r\n }\r\n\r\n // Convert each pixel.\r\n for (let x = 0; x < width; x++) {\r\n for (let y = 0; y < height; y++) {\r\n const index = (y * width + x) * 3;\r\n const newIndex = (y * width + x) * 4;\r\n\r\n // Map Old Value to new value.\r\n rgbaData[newIndex + 0] = rgbData[index + 0];\r\n rgbaData[newIndex + 1] = rgbData[index + 1];\r\n rgbaData[newIndex + 2] = rgbData[index + 2];\r\n\r\n // Add fully opaque alpha channel.\r\n rgbaData[newIndex + 3] = val1;\r\n }\r\n }\r\n\r\n return rgbaData;\r\n}\r\n\r\n/**\r\n * Create a function for createRawTexture3D/createRawTexture2DArray\r\n * @param is3D true for TEXTURE_3D and false for TEXTURE_2D_ARRAY\r\n * @internal\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nfunction _makeCreateRawTextureFunction(is3D: boolean) {\r\n return function (\r\n this: ThinEngine,\r\n data: Nullable<ArrayBufferView>,\r\n width: number,\r\n height: number,\r\n depth: number,\r\n format: number,\r\n generateMipMaps: boolean,\r\n invertY: boolean,\r\n samplingMode: number,\r\n compression: Nullable<string> = null,\r\n textureType: number = Constants.TEXTURETYPE_UNSIGNED_INT\r\n ): InternalTexture {\r\n const target = is3D ? this._gl.TEXTURE_3D : this._gl.TEXTURE_2D_ARRAY;\r\n const source = is3D ? InternalTextureSource.Raw3D : InternalTextureSource.Raw2DArray;\r\n const texture = new InternalTexture(this, source);\r\n texture.baseWidth = width;\r\n texture.baseHeight = height;\r\n texture.baseDepth = depth;\r\n texture.width = width;\r\n texture.height = height;\r\n texture.depth = depth;\r\n texture.format = format;\r\n texture.type = textureType;\r\n texture.generateMipMaps = generateMipMaps;\r\n texture.samplingMode = samplingMode;\r\n if (is3D) {\r\n texture.is3D = true;\r\n } else {\r\n texture.is2DArray = true;\r\n }\r\n\r\n if (!this._doNotHandleContextLost) {\r\n texture._bufferView = data;\r\n }\r\n\r\n if (is3D) {\r\n this.updateRawTexture3D(texture, data, format, invertY, compression, textureType);\r\n } else {\r\n this.updateRawTexture2DArray(texture, data, format, invertY, compression, textureType);\r\n }\r\n this._bindTextureDirectly(target, texture, true);\r\n\r\n // Filters\r\n const filters = this._getSamplingParameters(samplingMode, generateMipMaps);\r\n\r\n this._gl.texParameteri(target, this._gl.TEXTURE_MAG_FILTER, filters.mag);\r\n this._gl.texParameteri(target, this._gl.TEXTURE_MIN_FILTER, filters.min);\r\n\r\n if (generateMipMaps) {\r\n this._gl.generateMipmap(target);\r\n }\r\n\r\n this._bindTextureDirectly(target, null);\r\n\r\n this._internalTexturesCache.push(texture);\r\n\r\n return texture;\r\n };\r\n}\r\n\r\nThinEngine.prototype.createRawTexture2DArray = _makeCreateRawTextureFunction(false);\r\nThinEngine.prototype.createRawTexture3D = _makeCreateRawTextureFunction(true);\r\n\r\n/**\r\n * Create a function for updateRawTexture3D/updateRawTexture2DArray\r\n * @param is3D true for TEXTURE_3D and false for TEXTURE_2D_ARRAY\r\n * @internal\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nfunction _makeUpdateRawTextureFunction(is3D: boolean) {\r\n return function (\r\n this: ThinEngine,\r\n texture: InternalTexture,\r\n data: Nullable<ArrayBufferView>,\r\n format: number,\r\n invertY: boolean,\r\n compression: Nullable<string> = null,\r\n textureType: number = Constants.TEXTURETYPE_UNSIGNED_INT\r\n ): void {\r\n const target = is3D ? this._gl.TEXTURE_3D : this._gl.TEXTURE_2D_ARRAY;\r\n const internalType = this._getWebGLTextureType(textureType);\r\n const internalFormat = this._getInternalFormat(format);\r\n const internalSizedFomat = this._getRGBABufferInternalSizedFormat(textureType, format);\r\n\r\n this._bindTextureDirectly(target, texture, true);\r\n this._unpackFlipY(invertY === undefined ? true : invertY ? true : false);\r\n\r\n if (!this._doNotHandleContextLost) {\r\n texture._bufferView = data;\r\n texture.format = format;\r\n texture.invertY = invertY;\r\n texture._compression = compression;\r\n }\r\n\r\n if (texture.width % 4 !== 0) {\r\n this._gl.pixelStorei(this._gl.UNPACK_ALIGNMENT, 1);\r\n }\r\n\r\n if (compression && data) {\r\n this._gl.compressedTexImage3D(target, 0, (<any>this.getCaps().s3tc)[compression], texture.width, texture.height, texture.depth, 0, data);\r\n } else {\r\n this._gl.texImage3D(target, 0, internalSizedFomat, texture.width, texture.height, texture.depth, 0, internalFormat, internalType, data);\r\n }\r\n\r\n if (texture.generateMipMaps) {\r\n this._gl.generateMipmap(target);\r\n }\r\n this._bindTextureDirectly(target, null);\r\n // this.resetTextureCache();\r\n texture.isReady = true;\r\n };\r\n}\r\n\r\nThinEngine.prototype.updateRawTexture2DArray = _makeUpdateRawTextureFunction(false);\r\nThinEngine.prototype.updateRawTexture3D = _makeUpdateRawTextureFunction(true);\r\n"]}
|
|
1
|
+
{"version":3,"file":"engine.rawTexture.js","sourceRoot":"","sources":["../../../../../../lts/core/generated/Engines/Extensions/engine.rawTexture.ts"],"names":[],"mappings":"AACA,OAAO,EAAE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AG,6BAA6B,CAAC,IAAI,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"../../types\";\r\nimport { InternalTexture, InternalTextureSource } from \"../../Materials/Textures/internalTexture\";\r\nimport { Logger } from \"../../Misc/logger\";\r\nimport { Tools } from \"../../Misc/tools\";\r\nimport type { Scene } from \"../../scene\";\r\nimport { Constants } from \"../constants\";\r\nimport { ThinEngine } from \"../thinEngine\";\r\nimport type { IWebRequest } from \"../../Misc/interfaces/iWebRequest\";\r\n\r\ndeclare module \"../../Engines/thinEngine\" {\r\n export interface ThinEngine {\r\n /**\r\n * Creates a raw texture\r\n * @param data defines the data to store in the texture\r\n * @param width defines the width of the texture\r\n * @param height defines the height of the texture\r\n * @param format defines the format of the data\r\n * @param generateMipMaps defines if the engine should generate the mip levels\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param samplingMode defines the required sampling mode (Texture.NEAREST_SAMPLINGMODE by default)\r\n * @param compression defines the compression used (null by default)\r\n * @param type defines the type fo the data (Engine.TEXTURETYPE_UNSIGNED_INT by default)\r\n * @param creationFlags specific flags to use when creating the texture (Constants.TEXTURE_CREATIONFLAG_STORAGE for storage textures, for eg)\r\n * @param useSRGBBuffer defines if the texture must be loaded in a sRGB GPU buffer (if supported by the GPU).\r\n * @returns the raw texture inside an InternalTexture\r\n */\r\n createRawTexture(\r\n data: Nullable<ArrayBufferView>,\r\n width: number,\r\n height: number,\r\n format: number,\r\n generateMipMaps: boolean,\r\n invertY: boolean,\r\n samplingMode: number,\r\n compression: Nullable<string>,\r\n type: number,\r\n creationFlags?: number,\r\n useSRGBBuffer?: boolean\r\n ): InternalTexture;\r\n\r\n /**\r\n * Update a raw texture\r\n * @param texture defines the texture to update\r\n * @param data defines the data to store in the texture\r\n * @param format defines the format of the data\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n */\r\n updateRawTexture(texture: Nullable<InternalTexture>, data: Nullable<ArrayBufferView>, format: number, invertY: boolean): void;\r\n\r\n /**\r\n * Update a raw texture\r\n * @param texture defines the texture to update\r\n * @param data defines the data to store in the texture\r\n * @param format defines the format of the data\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param compression defines the compression used (null by default)\r\n * @param type defines the type fo the data (Engine.TEXTURETYPE_UNSIGNED_INT by default)\r\n * @param useSRGBBuffer defines if the texture must be loaded in a sRGB GPU buffer (if supported by the GPU).\r\n */\r\n updateRawTexture(\r\n texture: Nullable<InternalTexture>,\r\n data: Nullable<ArrayBufferView>,\r\n format: number,\r\n invertY: boolean,\r\n compression: Nullable<string>,\r\n type: number,\r\n useSRGBBuffer: boolean\r\n ): void;\r\n\r\n /**\r\n * Creates a new raw cube texture\r\n * @param data defines the array of data to use to create each face\r\n * @param size defines the size of the textures\r\n * @param format defines the format of the data\r\n * @param type defines the type of the data (like Engine.TEXTURETYPE_UNSIGNED_INT)\r\n * @param generateMipMaps defines if the engine should generate the mip levels\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param samplingMode defines the required sampling mode (like Texture.NEAREST_SAMPLINGMODE)\r\n * @param compression defines the compression used (null by default)\r\n * @returns the cube texture as an InternalTexture\r\n */\r\n createRawCubeTexture(\r\n data: Nullable<ArrayBufferView[]>,\r\n size: number,\r\n format: number,\r\n type: number,\r\n generateMipMaps: boolean,\r\n invertY: boolean,\r\n samplingMode: number,\r\n compression: Nullable<string>\r\n ): InternalTexture;\r\n\r\n /**\r\n * Update a raw cube texture\r\n * @param texture defines the texture to update\r\n * @param data defines the data to store\r\n * @param format defines the data format\r\n * @param type defines the type fo the data (Engine.TEXTURETYPE_UNSIGNED_INT by default)\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n */\r\n updateRawCubeTexture(texture: InternalTexture, data: ArrayBufferView[], format: number, type: number, invertY: boolean): void;\r\n\r\n /**\r\n * Update a raw cube texture\r\n * @param texture defines the texture to update\r\n * @param data defines the data to store\r\n * @param format defines the data format\r\n * @param type defines the type fo the data (Engine.TEXTURETYPE_UNSIGNED_INT by default)\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param compression defines the compression used (null by default)\r\n */\r\n updateRawCubeTexture(texture: InternalTexture, data: ArrayBufferView[], format: number, type: number, invertY: boolean, compression: Nullable<string>): void;\r\n\r\n /**\r\n * Update a raw cube texture\r\n * @param texture defines the texture to update\r\n * @param data defines the data to store\r\n * @param format defines the data format\r\n * @param type defines the type fo the data (Engine.TEXTURETYPE_UNSIGNED_INT by default)\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param compression defines the compression used (null by default)\r\n * @param level defines which level of the texture to update\r\n */\r\n updateRawCubeTexture(texture: InternalTexture, data: ArrayBufferView[], format: number, type: number, invertY: boolean, compression: Nullable<string>, level: number): void;\r\n\r\n /**\r\n * Creates a new raw cube texture from a specified url\r\n * @param url defines the url where the data is located\r\n * @param scene defines the current scene\r\n * @param size defines the size of the textures\r\n * @param format defines the format of the data\r\n * @param type defines the type fo the data (like Engine.TEXTURETYPE_UNSIGNED_INT)\r\n * @param noMipmap defines if the engine should avoid generating the mip levels\r\n * @param callback defines a callback used to extract texture data from loaded data\r\n * @param mipmapGenerator defines to provide an optional tool to generate mip levels\r\n * @param onLoad defines a callback called when texture is loaded\r\n * @param onError defines a callback called if there is an error\r\n * @returns the cube texture as an InternalTexture\r\n */\r\n createRawCubeTextureFromUrl(\r\n url: string,\r\n scene: Nullable<Scene>,\r\n size: number,\r\n format: number,\r\n type: number,\r\n noMipmap: boolean,\r\n callback: (ArrayBuffer: ArrayBuffer) => Nullable<ArrayBufferView[]>,\r\n mipmapGenerator: Nullable<(faces: ArrayBufferView[]) => ArrayBufferView[][]>,\r\n onLoad: Nullable<() => void>,\r\n onError: Nullable<(message?: string, exception?: any) => void>\r\n ): InternalTexture;\r\n\r\n /**\r\n * Creates a new raw cube texture from a specified url\r\n * @param url defines the url where the data is located\r\n * @param scene defines the current scene\r\n * @param size defines the size of the textures\r\n * @param format defines the format of the data\r\n * @param type defines the type fo the data (like Engine.TEXTURETYPE_UNSIGNED_INT)\r\n * @param noMipmap defines if the engine should avoid generating the mip levels\r\n * @param callback defines a callback used to extract texture data from loaded data\r\n * @param mipmapGenerator defines to provide an optional tool to generate mip levels\r\n * @param onLoad defines a callback called when texture is loaded\r\n * @param onError defines a callback called if there is an error\r\n * @param samplingMode defines the required sampling mode (like Texture.NEAREST_SAMPLINGMODE)\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @returns the cube texture as an InternalTexture\r\n */\r\n createRawCubeTextureFromUrl(\r\n url: string,\r\n scene: Nullable<Scene>,\r\n size: number,\r\n format: number,\r\n type: number,\r\n noMipmap: boolean,\r\n callback: (ArrayBuffer: ArrayBuffer) => Nullable<ArrayBufferView[]>,\r\n mipmapGenerator: Nullable<(faces: ArrayBufferView[]) => ArrayBufferView[][]>,\r\n onLoad: Nullable<() => void>,\r\n onError: Nullable<(message?: string, exception?: any) => void>,\r\n samplingMode: number,\r\n invertY: boolean\r\n ): InternalTexture;\r\n\r\n /**\r\n * Creates a new raw 3D texture\r\n * @param data defines the data used to create the texture\r\n * @param width defines the width of the texture\r\n * @param height defines the height of the texture\r\n * @param depth defines the depth of the texture\r\n * @param format defines the format of the texture\r\n * @param generateMipMaps defines if the engine must generate mip levels\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param samplingMode defines the required sampling mode (like Texture.NEAREST_SAMPLINGMODE)\r\n * @param compression defines the compressed used (can be null)\r\n * @param textureType defines the compressed used (can be null)\r\n * @param creationFlags specific flags to use when creating the texture (Constants.TEXTURE_CREATIONFLAG_STORAGE for storage textures, for eg)\r\n * @returns a new raw 3D texture (stored in an InternalTexture)\r\n */\r\n createRawTexture3D(\r\n data: Nullable<ArrayBufferView>,\r\n width: number,\r\n height: number,\r\n depth: number,\r\n format: number,\r\n generateMipMaps: boolean,\r\n invertY: boolean,\r\n samplingMode: number,\r\n compression: Nullable<string>,\r\n textureType: number,\r\n creationFlags?: number\r\n ): InternalTexture;\r\n\r\n /**\r\n * Update a raw 3D texture\r\n * @param texture defines the texture to update\r\n * @param data defines the data to store\r\n * @param format defines the data format\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n */\r\n updateRawTexture3D(texture: InternalTexture, data: Nullable<ArrayBufferView>, format: number, invertY: boolean): void;\r\n\r\n /**\r\n * Update a raw 3D texture\r\n * @param texture defines the texture to update\r\n * @param data defines the data to store\r\n * @param format defines the data format\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param compression defines the used compression (can be null)\r\n * @param textureType defines the texture Type (Engine.TEXTURETYPE_UNSIGNED_INT, Engine.TEXTURETYPE_FLOAT...)\r\n */\r\n updateRawTexture3D(texture: InternalTexture, data: Nullable<ArrayBufferView>, format: number, invertY: boolean, compression: Nullable<string>, textureType: number): void;\r\n\r\n /**\r\n * Creates a new raw 2D array texture\r\n * @param data defines the data used to create the texture\r\n * @param width defines the width of the texture\r\n * @param height defines the height of the texture\r\n * @param depth defines the number of layers of the texture\r\n * @param format defines the format of the texture\r\n * @param generateMipMaps defines if the engine must generate mip levels\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param samplingMode defines the required sampling mode (like Texture.NEAREST_SAMPLINGMODE)\r\n * @param compression defines the compressed used (can be null)\r\n * @param textureType defines the compressed used (can be null)\r\n * @param creationFlags specific flags to use when creating the texture (Constants.TEXTURE_CREATIONFLAG_STORAGE for storage textures, for eg)\r\n * @returns a new raw 2D array texture (stored in an InternalTexture)\r\n */\r\n createRawTexture2DArray(\r\n data: Nullable<ArrayBufferView>,\r\n width: number,\r\n height: number,\r\n depth: number,\r\n format: number,\r\n generateMipMaps: boolean,\r\n invertY: boolean,\r\n samplingMode: number,\r\n compression: Nullable<string>,\r\n textureType: number,\r\n creationFlags?: number\r\n ): InternalTexture;\r\n\r\n /**\r\n * Update a raw 2D array texture\r\n * @param texture defines the texture to update\r\n * @param data defines the data to store\r\n * @param format defines the data format\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n */\r\n updateRawTexture2DArray(texture: InternalTexture, data: Nullable<ArrayBufferView>, format: number, invertY: boolean): void;\r\n\r\n /**\r\n * Update a raw 2D array texture\r\n * @param texture defines the texture to update\r\n * @param data defines the data to store\r\n * @param format defines the data format\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param compression defines the used compression (can be null)\r\n * @param textureType defines the texture Type (Engine.TEXTURETYPE_UNSIGNED_INT, Engine.TEXTURETYPE_FLOAT...)\r\n */\r\n updateRawTexture2DArray(\r\n texture: InternalTexture,\r\n data: Nullable<ArrayBufferView>,\r\n format: number,\r\n invertY: boolean,\r\n compression: Nullable<string>,\r\n textureType: number\r\n ): void;\r\n }\r\n}\r\n\r\nThinEngine.prototype.updateRawTexture = function (\r\n texture: Nullable<InternalTexture>,\r\n data: Nullable<ArrayBufferView>,\r\n format: number,\r\n invertY: boolean,\r\n compression: Nullable<string> = null,\r\n type: number = Constants.TEXTURETYPE_UNSIGNED_INT,\r\n useSRGBBuffer: boolean = false\r\n): void {\r\n if (!texture) {\r\n return;\r\n }\r\n // Babylon's internalSizedFomat but gl's texImage2D internalFormat\r\n const internalSizedFomat = this._getRGBABufferInternalSizedFormat(type, format, useSRGBBuffer);\r\n\r\n // Babylon's internalFormat but gl's texImage2D format\r\n const internalFormat = this._getInternalFormat(format);\r\n const textureType = this._getWebGLTextureType(type);\r\n this._bindTextureDirectly(this._gl.TEXTURE_2D, texture, true);\r\n this._unpackFlipY(invertY === undefined ? true : invertY ? true : false);\r\n\r\n if (!this._doNotHandleContextLost) {\r\n texture._bufferView = data;\r\n texture.format = format;\r\n texture.type = type;\r\n texture.invertY = invertY;\r\n texture._compression = compression;\r\n }\r\n\r\n if (texture.width % 4 !== 0) {\r\n this._gl.pixelStorei(this._gl.UNPACK_ALIGNMENT, 1);\r\n }\r\n\r\n if (compression && data) {\r\n this._gl.compressedTexImage2D(this._gl.TEXTURE_2D, 0, (<any>this.getCaps().s3tc)[compression], texture.width, texture.height, 0, <DataView>data);\r\n } else {\r\n this._gl.texImage2D(this._gl.TEXTURE_2D, 0, internalSizedFomat, texture.width, texture.height, 0, internalFormat, textureType, data);\r\n }\r\n\r\n if (texture.generateMipMaps) {\r\n this._gl.generateMipmap(this._gl.TEXTURE_2D);\r\n }\r\n this._bindTextureDirectly(this._gl.TEXTURE_2D, null);\r\n // this.resetTextureCache();\r\n texture.isReady = true;\r\n};\r\n\r\nThinEngine.prototype.createRawTexture = function (\r\n data: Nullable<ArrayBufferView>,\r\n width: number,\r\n height: number,\r\n format: number,\r\n generateMipMaps: boolean,\r\n invertY: boolean,\r\n samplingMode: number,\r\n compression: Nullable<string> = null,\r\n type: number = Constants.TEXTURETYPE_UNSIGNED_INT,\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n creationFlags = 0,\r\n useSRGBBuffer = false\r\n): InternalTexture {\r\n const texture = new InternalTexture(this, InternalTextureSource.Raw);\r\n texture.baseWidth = width;\r\n texture.baseHeight = height;\r\n texture.width = width;\r\n texture.height = height;\r\n texture.format = format;\r\n texture.generateMipMaps = generateMipMaps;\r\n texture.samplingMode = samplingMode;\r\n texture.invertY = invertY;\r\n texture._compression = compression;\r\n texture.type = type;\r\n texture._useSRGBBuffer = this._getUseSRGBBuffer(useSRGBBuffer, !generateMipMaps);\r\n\r\n if (!this._doNotHandleContextLost) {\r\n texture._bufferView = data;\r\n }\r\n\r\n this.updateRawTexture(texture, data, format, invertY, compression, type, texture._useSRGBBuffer);\r\n this._bindTextureDirectly(this._gl.TEXTURE_2D, texture, true);\r\n\r\n // Filters\r\n const filters = this._getSamplingParameters(samplingMode, generateMipMaps);\r\n\r\n this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MAG_FILTER, filters.mag);\r\n this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MIN_FILTER, filters.min);\r\n\r\n if (generateMipMaps) {\r\n this._gl.generateMipmap(this._gl.TEXTURE_2D);\r\n }\r\n\r\n this._bindTextureDirectly(this._gl.TEXTURE_2D, null);\r\n\r\n this._internalTexturesCache.push(texture);\r\n\r\n return texture;\r\n};\r\n\r\nThinEngine.prototype.createRawCubeTexture = function (\r\n data: Nullable<ArrayBufferView[]>,\r\n size: number,\r\n format: number,\r\n type: number,\r\n generateMipMaps: boolean,\r\n invertY: boolean,\r\n samplingMode: number,\r\n compression: Nullable<string> = null\r\n): InternalTexture {\r\n const gl = this._gl;\r\n const texture = new InternalTexture(this, InternalTextureSource.CubeRaw);\r\n texture.isCube = true;\r\n texture.format = format;\r\n texture.type = type;\r\n if (!this._doNotHandleContextLost) {\r\n texture._bufferViewArray = data;\r\n }\r\n\r\n const textureType = this._getWebGLTextureType(type);\r\n let internalFormat = this._getInternalFormat(format);\r\n\r\n if (internalFormat === gl.RGB) {\r\n internalFormat = gl.RGBA;\r\n }\r\n\r\n // Mipmap generation needs a sized internal format that is both color-renderable and texture-filterable\r\n if (textureType === gl.FLOAT && !this._caps.textureFloatLinearFiltering) {\r\n generateMipMaps = false;\r\n samplingMode = Constants.TEXTURE_NEAREST_SAMPLINGMODE;\r\n Logger.Warn(\"Float texture filtering is not supported. Mipmap generation and sampling mode are forced to false and TEXTURE_NEAREST_SAMPLINGMODE, respectively.\");\r\n } else if (textureType === this._gl.HALF_FLOAT_OES && !this._caps.textureHalfFloatLinearFiltering) {\r\n generateMipMaps = false;\r\n samplingMode = Constants.TEXTURE_NEAREST_SAMPLINGMODE;\r\n Logger.Warn(\"Half float texture filtering is not supported. Mipmap generation and sampling mode are forced to false and TEXTURE_NEAREST_SAMPLINGMODE, respectively.\");\r\n } else if (textureType === gl.FLOAT && !this._caps.textureFloatRender) {\r\n generateMipMaps = false;\r\n Logger.Warn(\"Render to float textures is not supported. Mipmap generation forced to false.\");\r\n } else if (textureType === gl.HALF_FLOAT && !this._caps.colorBufferFloat) {\r\n generateMipMaps = false;\r\n Logger.Warn(\"Render to half float textures is not supported. Mipmap generation forced to false.\");\r\n }\r\n\r\n const width = size;\r\n const height = width;\r\n\r\n texture.width = width;\r\n texture.height = height;\r\n\r\n // Double check on POT to generate Mips.\r\n const isPot = !this.needPOTTextures || (Tools.IsExponentOfTwo(texture.width) && Tools.IsExponentOfTwo(texture.height));\r\n if (!isPot) {\r\n generateMipMaps = false;\r\n }\r\n\r\n // Upload data if needed. The texture won't be ready until then.\r\n if (data) {\r\n this.updateRawCubeTexture(texture, data, format, type, invertY, compression);\r\n }\r\n\r\n this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, texture, true);\r\n\r\n // Filters\r\n if (data && generateMipMaps) {\r\n this._gl.generateMipmap(this._gl.TEXTURE_CUBE_MAP);\r\n }\r\n\r\n const filters = this._getSamplingParameters(samplingMode, generateMipMaps);\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MAG_FILTER, filters.mag);\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, filters.min);\r\n\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\r\n this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, null);\r\n\r\n texture.generateMipMaps = generateMipMaps;\r\n texture.samplingMode = samplingMode;\r\n\r\n return texture;\r\n};\r\n\r\nThinEngine.prototype.updateRawCubeTexture = function (\r\n texture: InternalTexture,\r\n data: ArrayBufferView[],\r\n format: number,\r\n type: number,\r\n invertY: boolean,\r\n compression: Nullable<string> = null,\r\n level: number = 0\r\n): void {\r\n texture._bufferViewArray = data;\r\n texture.format = format;\r\n texture.type = type;\r\n texture.invertY = invertY;\r\n texture._compression = compression;\r\n\r\n const gl = this._gl;\r\n const textureType = this._getWebGLTextureType(type);\r\n let internalFormat = this._getInternalFormat(format);\r\n const internalSizedFomat = this._getRGBABufferInternalSizedFormat(type);\r\n\r\n let needConversion = false;\r\n if (internalFormat === gl.RGB) {\r\n internalFormat = gl.RGBA;\r\n needConversion = true;\r\n }\r\n\r\n this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, texture, true);\r\n this._unpackFlipY(invertY === undefined ? true : invertY ? true : false);\r\n\r\n if (texture.width % 4 !== 0) {\r\n gl.pixelStorei(gl.UNPACK_ALIGNMENT, 1);\r\n }\r\n\r\n // Data are known to be in +X +Y +Z -X -Y -Z\r\n for (let faceIndex = 0; faceIndex < 6; faceIndex++) {\r\n let faceData = data[faceIndex];\r\n\r\n if (compression) {\r\n gl.compressedTexImage2D(\r\n gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex,\r\n level,\r\n (<any>this.getCaps().s3tc)[compression],\r\n texture.width,\r\n texture.height,\r\n 0,\r\n <DataView>faceData\r\n );\r\n } else {\r\n if (needConversion) {\r\n faceData = _convertRGBtoRGBATextureData(faceData, texture.width, texture.height, type);\r\n }\r\n gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex, level, internalSizedFomat, texture.width, texture.height, 0, internalFormat, textureType, faceData);\r\n }\r\n }\r\n\r\n const isPot = !this.needPOTTextures || (Tools.IsExponentOfTwo(texture.width) && Tools.IsExponentOfTwo(texture.height));\r\n if (isPot && texture.generateMipMaps && level === 0) {\r\n this._gl.generateMipmap(this._gl.TEXTURE_CUBE_MAP);\r\n }\r\n this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, null);\r\n\r\n // this.resetTextureCache();\r\n texture.isReady = true;\r\n};\r\n\r\nThinEngine.prototype.createRawCubeTextureFromUrl = function (\r\n url: string,\r\n scene: Nullable<Scene>,\r\n size: number,\r\n format: number,\r\n type: number,\r\n noMipmap: boolean,\r\n callback: (ArrayBuffer: ArrayBuffer) => Nullable<ArrayBufferView[]>,\r\n mipmapGenerator: Nullable<(faces: ArrayBufferView[]) => ArrayBufferView[][]>,\r\n onLoad: Nullable<() => void> = null,\r\n onError: Nullable<(message?: string, exception?: any) => void> = null,\r\n samplingMode: number = Constants.TEXTURE_TRILINEAR_SAMPLINGMODE,\r\n invertY: boolean = false\r\n): InternalTexture {\r\n const gl = this._gl;\r\n const texture = this.createRawCubeTexture(null, size, format, type, !noMipmap, invertY, samplingMode, null);\r\n scene?.addPendingData(texture);\r\n texture.url = url;\r\n this._internalTexturesCache.push(texture);\r\n\r\n const onerror = (request?: IWebRequest, exception?: any) => {\r\n scene?.removePendingData(texture);\r\n if (onError && request) {\r\n onError(request.status + \" \" + request.statusText, exception);\r\n }\r\n };\r\n\r\n const internalCallback = (data: any) => {\r\n const width = texture.width;\r\n const faceDataArrays = callback(data);\r\n\r\n if (!faceDataArrays) {\r\n return;\r\n }\r\n\r\n if (mipmapGenerator) {\r\n const textureType = this._getWebGLTextureType(type);\r\n let internalFormat = this._getInternalFormat(format);\r\n const internalSizedFomat = this._getRGBABufferInternalSizedFormat(type);\r\n\r\n let needConversion = false;\r\n if (internalFormat === gl.RGB) {\r\n internalFormat = gl.RGBA;\r\n needConversion = true;\r\n }\r\n\r\n this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, texture, true);\r\n this._unpackFlipY(false);\r\n\r\n const mipData = mipmapGenerator(faceDataArrays);\r\n for (let level = 0; level < mipData.length; level++) {\r\n const mipSize = width >> level;\r\n\r\n for (let faceIndex = 0; faceIndex < 6; faceIndex++) {\r\n let mipFaceData = mipData[level][faceIndex];\r\n if (needConversion) {\r\n mipFaceData = _convertRGBtoRGBATextureData(mipFaceData, mipSize, mipSize, type);\r\n }\r\n gl.texImage2D(faceIndex, level, internalSizedFomat, mipSize, mipSize, 0, internalFormat, textureType, mipFaceData);\r\n }\r\n }\r\n\r\n this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, null);\r\n } else {\r\n this.updateRawCubeTexture(texture, faceDataArrays, format, type, invertY);\r\n }\r\n\r\n texture.isReady = true;\r\n // this.resetTextureCache();\r\n scene?.removePendingData(texture);\r\n\r\n texture.onLoadedObservable.notifyObservers(texture);\r\n texture.onLoadedObservable.clear();\r\n\r\n if (onLoad) {\r\n onLoad();\r\n }\r\n };\r\n\r\n this._loadFile(\r\n url,\r\n (data) => {\r\n internalCallback(data);\r\n },\r\n undefined,\r\n scene?.offlineProvider,\r\n true,\r\n onerror\r\n );\r\n\r\n return texture;\r\n};\r\n\r\n/**\r\n * @internal\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nfunction _convertRGBtoRGBATextureData(rgbData: any, width: number, height: number, textureType: number): ArrayBufferView {\r\n // Create new RGBA data container.\r\n let rgbaData: any;\r\n let val1 = 1;\r\n if (textureType === Constants.TEXTURETYPE_FLOAT) {\r\n rgbaData = new Float32Array(width * height * 4);\r\n } else if (textureType === Constants.TEXTURETYPE_HALF_FLOAT) {\r\n rgbaData = new Uint16Array(width * height * 4);\r\n val1 = 15360; // 15360 is the encoding of 1 in half float\r\n } else if (textureType === Constants.TEXTURETYPE_UNSIGNED_INTEGER) {\r\n rgbaData = new Uint32Array(width * height * 4);\r\n } else {\r\n rgbaData = new Uint8Array(width * height * 4);\r\n }\r\n\r\n // Convert each pixel.\r\n for (let x = 0; x < width; x++) {\r\n for (let y = 0; y < height; y++) {\r\n const index = (y * width + x) * 3;\r\n const newIndex = (y * width + x) * 4;\r\n\r\n // Map Old Value to new value.\r\n rgbaData[newIndex + 0] = rgbData[index + 0];\r\n rgbaData[newIndex + 1] = rgbData[index + 1];\r\n rgbaData[newIndex + 2] = rgbData[index + 2];\r\n\r\n // Add fully opaque alpha channel.\r\n rgbaData[newIndex + 3] = val1;\r\n }\r\n }\r\n\r\n return rgbaData;\r\n}\r\n\r\n/**\r\n * Create a function for createRawTexture3D/createRawTexture2DArray\r\n * @param is3D true for TEXTURE_3D and false for TEXTURE_2D_ARRAY\r\n * @internal\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nfunction _makeCreateRawTextureFunction(is3D: boolean) {\r\n return function (\r\n this: ThinEngine,\r\n data: Nullable<ArrayBufferView>,\r\n width: number,\r\n height: number,\r\n depth: number,\r\n format: number,\r\n generateMipMaps: boolean,\r\n invertY: boolean,\r\n samplingMode: number,\r\n compression: Nullable<string> = null,\r\n textureType: number = Constants.TEXTURETYPE_UNSIGNED_INT\r\n ): InternalTexture {\r\n const target = is3D ? this._gl.TEXTURE_3D : this._gl.TEXTURE_2D_ARRAY;\r\n const source = is3D ? InternalTextureSource.Raw3D : InternalTextureSource.Raw2DArray;\r\n const texture = new InternalTexture(this, source);\r\n texture.baseWidth = width;\r\n texture.baseHeight = height;\r\n texture.baseDepth = depth;\r\n texture.width = width;\r\n texture.height = height;\r\n texture.depth = depth;\r\n texture.format = format;\r\n texture.type = textureType;\r\n texture.generateMipMaps = generateMipMaps;\r\n texture.samplingMode = samplingMode;\r\n if (is3D) {\r\n texture.is3D = true;\r\n } else {\r\n texture.is2DArray = true;\r\n }\r\n\r\n if (!this._doNotHandleContextLost) {\r\n texture._bufferView = data;\r\n }\r\n\r\n if (is3D) {\r\n this.updateRawTexture3D(texture, data, format, invertY, compression, textureType);\r\n } else {\r\n this.updateRawTexture2DArray(texture, data, format, invertY, compression, textureType);\r\n }\r\n this._bindTextureDirectly(target, texture, true);\r\n\r\n // Filters\r\n const filters = this._getSamplingParameters(samplingMode, generateMipMaps);\r\n\r\n this._gl.texParameteri(target, this._gl.TEXTURE_MAG_FILTER, filters.mag);\r\n this._gl.texParameteri(target, this._gl.TEXTURE_MIN_FILTER, filters.min);\r\n\r\n if (generateMipMaps) {\r\n this._gl.generateMipmap(target);\r\n }\r\n\r\n this._bindTextureDirectly(target, null);\r\n\r\n this._internalTexturesCache.push(texture);\r\n\r\n return texture;\r\n };\r\n}\r\n\r\nThinEngine.prototype.createRawTexture2DArray = _makeCreateRawTextureFunction(false);\r\nThinEngine.prototype.createRawTexture3D = _makeCreateRawTextureFunction(true);\r\n\r\n/**\r\n * Create a function for updateRawTexture3D/updateRawTexture2DArray\r\n * @param is3D true for TEXTURE_3D and false for TEXTURE_2D_ARRAY\r\n * @internal\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nfunction _makeUpdateRawTextureFunction(is3D: boolean) {\r\n return function (\r\n this: ThinEngine,\r\n texture: InternalTexture,\r\n data: Nullable<ArrayBufferView>,\r\n format: number,\r\n invertY: boolean,\r\n compression: Nullable<string> = null,\r\n textureType: number = Constants.TEXTURETYPE_UNSIGNED_INT\r\n ): void {\r\n const target = is3D ? this._gl.TEXTURE_3D : this._gl.TEXTURE_2D_ARRAY;\r\n const internalType = this._getWebGLTextureType(textureType);\r\n const internalFormat = this._getInternalFormat(format);\r\n const internalSizedFomat = this._getRGBABufferInternalSizedFormat(textureType, format);\r\n\r\n this._bindTextureDirectly(target, texture, true);\r\n this._unpackFlipY(invertY === undefined ? true : invertY ? true : false);\r\n\r\n if (!this._doNotHandleContextLost) {\r\n texture._bufferView = data;\r\n texture.format = format;\r\n texture.invertY = invertY;\r\n texture._compression = compression;\r\n }\r\n\r\n if (texture.width % 4 !== 0) {\r\n this._gl.pixelStorei(this._gl.UNPACK_ALIGNMENT, 1);\r\n }\r\n\r\n if (compression && data) {\r\n this._gl.compressedTexImage3D(target, 0, (<any>this.getCaps().s3tc)[compression], texture.width, texture.height, texture.depth, 0, data);\r\n } else {\r\n this._gl.texImage3D(target, 0, internalSizedFomat, texture.width, texture.height, texture.depth, 0, internalFormat, internalType, data);\r\n }\r\n\r\n if (texture.generateMipMaps) {\r\n this._gl.generateMipmap(target);\r\n }\r\n this._bindTextureDirectly(target, null);\r\n // this.resetTextureCache();\r\n texture.isReady = true;\r\n };\r\n}\r\n\r\nThinEngine.prototype.updateRawTexture2DArray = _makeUpdateRawTextureFunction(false);\r\nThinEngine.prototype.updateRawTexture3D = _makeUpdateRawTextureFunction(true);\r\n"]}
|
|
@@ -76,6 +76,7 @@ export function allocateAndCopyTypedBuffer(type, sizeOrDstBuffer, sizeInBytes =
|
|
|
76
76
|
return buffer;
|
|
77
77
|
}
|
|
78
78
|
ThinEngine.prototype._readTexturePixelsSync = function (texture, width, height, faceIndex = -1, level = 0, buffer = null, flushRenderer = true, noDataConversion = false, x = 0, y = 0) {
|
|
79
|
+
var _a, _b;
|
|
79
80
|
const gl = this._gl;
|
|
80
81
|
if (!gl) {
|
|
81
82
|
throw new Error("Engine does not have gl rendering context.");
|
|
@@ -89,10 +90,10 @@ ThinEngine.prototype._readTexturePixelsSync = function (texture, width, height,
|
|
|
89
90
|
}
|
|
90
91
|
gl.bindFramebuffer(gl.FRAMEBUFFER, this._dummyFramebuffer);
|
|
91
92
|
if (faceIndex > -1) {
|
|
92
|
-
gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex, texture._hardwareTexture
|
|
93
|
+
gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex, (_a = texture._hardwareTexture) === null || _a === void 0 ? void 0 : _a.underlyingResource, level);
|
|
93
94
|
}
|
|
94
95
|
else {
|
|
95
|
-
gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture._hardwareTexture
|
|
96
|
+
gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, (_b = texture._hardwareTexture) === null || _b === void 0 ? void 0 : _b.underlyingResource, level);
|
|
96
97
|
}
|
|
97
98
|
let readType = texture.type !== undefined ? this._getWebGLTextureType(texture.type) : gl.UNSIGNED_BYTE;
|
|
98
99
|
if (!noDataConversion) {
|