@babylonjs/core 7.43.0 → 7.44.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/Actions/actionEvent.d.ts +4 -4
- package/Buffers/bufferUtils.d.ts +8 -1
- package/Buffers/bufferUtils.js +15 -0
- package/Buffers/bufferUtils.js.map +1 -1
- package/Culling/Helper/boundingInfoHelper.d.ts +2 -9
- package/Culling/Helper/boundingInfoHelper.js +2 -9
- package/Culling/Helper/boundingInfoHelper.js.map +1 -1
- package/Debug/debugLayer.d.ts +4 -0
- package/Debug/debugLayer.js +9 -0
- package/Debug/debugLayer.js.map +1 -1
- package/Engines/Extensions/engine.renderTarget.js +2 -4
- package/Engines/Extensions/engine.renderTarget.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.renderTarget.js +2 -4
- package/Engines/WebGPU/Extensions/engine.renderTarget.js.map +1 -1
- package/Engines/abstractEngine.d.ts +19 -1
- package/Engines/abstractEngine.js +48 -9
- package/Engines/abstractEngine.js.map +1 -1
- package/Engines/engine.d.ts +6 -3
- package/Engines/engine.js +2 -20
- package/Engines/engine.js.map +1 -1
- package/Engines/renderTargetWrapper.js +2 -2
- package/Engines/renderTargetWrapper.js.map +1 -1
- package/Engines/thinEngine.js +1 -5
- package/Engines/thinEngine.js.map +1 -1
- package/Engines/webgpuEngine.js +1 -0
- package/Engines/webgpuEngine.js.map +1 -1
- package/FlowGraph/flowGraphConnection.d.ts +1 -1
- package/FrameGraph/Node/Blocks/Layers/glowLayerBlock.d.ts +16 -12
- package/FrameGraph/Node/Blocks/Layers/glowLayerBlock.js +63 -27
- package/FrameGraph/Node/Blocks/Layers/glowLayerBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/Layers/highlightLayerBlock.d.ts +72 -0
- package/FrameGraph/Node/Blocks/Layers/highlightLayerBlock.js +197 -0
- package/FrameGraph/Node/Blocks/Layers/highlightLayerBlock.js.map +1 -0
- package/FrameGraph/Node/Blocks/PostProcesses/basePostProcessBlock.d.ts +42 -0
- package/FrameGraph/Node/Blocks/PostProcesses/basePostProcessBlock.js +78 -0
- package/FrameGraph/Node/Blocks/PostProcesses/basePostProcessBlock.js.map +1 -0
- package/FrameGraph/Node/Blocks/PostProcesses/blackAndWhitePostProcessBlock.d.ts +3 -19
- package/FrameGraph/Node/Blocks/PostProcesses/blackAndWhitePostProcessBlock.js +3 -49
- package/FrameGraph/Node/Blocks/PostProcesses/blackAndWhitePostProcessBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/bloomPostProcessBlock.d.ts +3 -19
- package/FrameGraph/Node/Blocks/PostProcesses/bloomPostProcessBlock.js +3 -49
- package/FrameGraph/Node/Blocks/PostProcesses/bloomPostProcessBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/blurPostProcessBlock.d.ts +3 -19
- package/FrameGraph/Node/Blocks/PostProcesses/blurPostProcessBlock.js +3 -49
- package/FrameGraph/Node/Blocks/PostProcesses/blurPostProcessBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/circleOfConfusionPostProcessBlock.d.ts +2 -17
- package/FrameGraph/Node/Blocks/PostProcesses/circleOfConfusionPostProcessBlock.js +3 -45
- package/FrameGraph/Node/Blocks/PostProcesses/circleOfConfusionPostProcessBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/depthOfFieldPostProcessBlock.d.ts +2 -17
- package/FrameGraph/Node/Blocks/PostProcesses/depthOfFieldPostProcessBlock.js +3 -44
- package/FrameGraph/Node/Blocks/PostProcesses/depthOfFieldPostProcessBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/extractHighlightsPostProcessBlock.d.ts +3 -19
- package/FrameGraph/Node/Blocks/PostProcesses/extractHighlightsPostProcessBlock.js +3 -49
- package/FrameGraph/Node/Blocks/PostProcesses/extractHighlightsPostProcessBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/passPostProcessBlock.d.ts +47 -0
- package/FrameGraph/Node/Blocks/PostProcesses/passPostProcessBlock.js +65 -0
- package/FrameGraph/Node/Blocks/PostProcesses/passPostProcessBlock.js.map +1 -0
- package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.d.ts +4 -0
- package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.js +9 -0
- package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/index.d.ts +2 -0
- package/FrameGraph/Node/Blocks/index.js +2 -0
- package/FrameGraph/Node/Blocks/index.js.map +1 -1
- package/FrameGraph/Node/Types/nodeRenderGraphTypes.d.ts +4 -2
- package/FrameGraph/Node/Types/nodeRenderGraphTypes.js +2 -0
- package/FrameGraph/Node/Types/nodeRenderGraphTypes.js.map +1 -1
- package/FrameGraph/Node/nodeRenderGraph.d.ts +3 -2
- package/FrameGraph/Node/nodeRenderGraph.js +4 -3
- package/FrameGraph/Node/nodeRenderGraph.js.map +1 -1
- package/FrameGraph/Node/nodeRenderGraphBlock.js +4 -4
- package/FrameGraph/Node/nodeRenderGraphBlock.js.map +1 -1
- package/FrameGraph/Node/nodeRenderGraphBlockConnectionPoint.d.ts +8 -0
- package/FrameGraph/Node/nodeRenderGraphBlockConnectionPoint.js +10 -0
- package/FrameGraph/Node/nodeRenderGraphBlockConnectionPoint.js.map +1 -1
- package/FrameGraph/Node/nodeRenderGraphConnectionPointCustomObject.d.ts +21 -0
- package/FrameGraph/Node/nodeRenderGraphConnectionPointCustomObject.js +31 -0
- package/FrameGraph/Node/nodeRenderGraphConnectionPointCustomObject.js.map +1 -0
- package/FrameGraph/Passes/pass.d.ts +1 -0
- package/FrameGraph/Passes/pass.js +4 -1
- package/FrameGraph/Passes/pass.js.map +1 -1
- package/FrameGraph/Tasks/Layers/baseLayerTask.d.ts +81 -0
- package/FrameGraph/Tasks/Layers/baseLayerTask.js +304 -0
- package/FrameGraph/Tasks/Layers/baseLayerTask.js.map +1 -0
- package/FrameGraph/Tasks/Layers/glowLayerTask.d.ts +3 -40
- package/FrameGraph/Tasks/Layers/glowLayerTask.js +4 -158
- package/FrameGraph/Tasks/Layers/glowLayerTask.js.map +1 -1
- package/FrameGraph/Tasks/Layers/highlightLayerTask.d.ts +21 -0
- package/FrameGraph/Tasks/Layers/highlightLayerTask.js +32 -0
- package/FrameGraph/Tasks/Layers/highlightLayerTask.js.map +1 -0
- package/FrameGraph/Tasks/Misc/executeTask.d.ts +2 -2
- package/FrameGraph/Tasks/Misc/executeTask.js +1 -0
- package/FrameGraph/Tasks/Misc/executeTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/bloomMergeTask.js +1 -1
- package/FrameGraph/Tasks/PostProcesses/bloomMergeTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/bloomTask.js +1 -1
- package/FrameGraph/Tasks/PostProcesses/bloomTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/circleOfConfusionTask.js +5 -4
- package/FrameGraph/Tasks/PostProcesses/circleOfConfusionTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldBlurTask.js +5 -4
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldBlurTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldMergeTask.js +2 -4
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldMergeTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/passTask.d.ts +29 -0
- package/FrameGraph/Tasks/PostProcesses/passTask.js +31 -0
- package/FrameGraph/Tasks/PostProcesses/passTask.js.map +1 -0
- package/FrameGraph/Tasks/PostProcesses/postProcessTask.js +4 -2
- package/FrameGraph/Tasks/PostProcesses/postProcessTask.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/objectRendererTask.d.ts +2 -2
- package/FrameGraph/Tasks/Rendering/objectRendererTask.js +1 -0
- package/FrameGraph/Tasks/Rendering/objectRendererTask.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/taaObjectRendererTask.d.ts +2 -2
- package/FrameGraph/Tasks/Rendering/taaObjectRendererTask.js +1 -0
- package/FrameGraph/Tasks/Rendering/taaObjectRendererTask.js.map +1 -1
- package/FrameGraph/Tasks/Texture/clearTextureTask.d.ts +2 -2
- package/FrameGraph/Tasks/Texture/clearTextureTask.js +1 -0
- package/FrameGraph/Tasks/Texture/clearTextureTask.js.map +1 -1
- package/FrameGraph/Tasks/Texture/copyToTextureTask.js +1 -1
- package/FrameGraph/Tasks/Texture/copyToTextureTask.js.map +1 -1
- package/FrameGraph/frameGraph.d.ts +8 -2
- package/FrameGraph/frameGraph.js +31 -5
- package/FrameGraph/frameGraph.js.map +1 -1
- package/FrameGraph/frameGraphRenderContext.d.ts +10 -0
- package/FrameGraph/frameGraphRenderContext.js +14 -0
- package/FrameGraph/frameGraphRenderContext.js.map +1 -1
- package/FrameGraph/frameGraphTask.d.ts +3 -2
- package/FrameGraph/frameGraphTask.js +12 -2
- package/FrameGraph/frameGraphTask.js.map +1 -1
- package/FrameGraph/frameGraphTextureManager.d.ts +1 -1
- package/FrameGraph/frameGraphTypes.d.ts +4 -0
- package/FrameGraph/frameGraphTypes.js.map +1 -1
- package/FrameGraph/index.d.ts +2 -0
- package/FrameGraph/index.js +2 -0
- package/FrameGraph/index.js.map +1 -1
- package/Gizmos/planeRotationGizmo.js +10 -0
- package/Gizmos/planeRotationGizmo.js.map +1 -1
- package/Helpers/environmentHelper.js +7 -6
- package/Helpers/environmentHelper.js.map +1 -1
- package/Inputs/scene.inputManager.js +2 -2
- package/Inputs/scene.inputManager.js.map +1 -1
- package/Layers/effectLayer.d.ts +1 -1
- package/Layers/effectLayer.js.map +1 -1
- package/Layers/glowLayer.d.ts +2 -14
- package/Layers/glowLayer.js +34 -36
- package/Layers/glowLayer.js.map +1 -1
- package/Layers/highlightLayer.d.ts +13 -74
- package/Layers/highlightLayer.js +123 -309
- package/Layers/highlightLayer.js.map +1 -1
- package/Layers/index.d.ts +1 -0
- package/Layers/index.js +1 -0
- package/Layers/index.js.map +1 -1
- package/Layers/thinEffectLayer.d.ts +55 -2
- package/Layers/thinEffectLayer.js +66 -0
- package/Layers/thinEffectLayer.js.map +1 -1
- package/Layers/thinGlowLayer.d.ts +3 -6
- package/Layers/thinGlowLayer.js +4 -1
- package/Layers/thinGlowLayer.js.map +1 -1
- package/Layers/thinHighlightLayer.d.ts +197 -0
- package/Layers/thinHighlightLayer.js +417 -0
- package/Layers/thinHighlightLayer.js.map +1 -0
- package/Materials/GreasedLine/greasedLinePluginMaterial.d.ts +6 -2
- package/Materials/GreasedLine/greasedLinePluginMaterial.js +8 -2
- package/Materials/GreasedLine/greasedLinePluginMaterial.js.map +1 -1
- package/Materials/GreasedLine/greasedLinePluginMaterialShadersWGSL.js +11 -3
- package/Materials/GreasedLine/greasedLinePluginMaterialShadersWGSL.js.map +1 -1
- package/Materials/GreasedLine/greasedLineSimpleMaterial.d.ts +1 -0
- package/Materials/GreasedLine/greasedLineSimpleMaterial.js +1 -0
- package/Materials/GreasedLine/greasedLineSimpleMaterial.js.map +1 -1
- package/Materials/Node/Blocks/PBR/reflectionBlock.js +1 -3
- package/Materials/Node/Blocks/PBR/reflectionBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/subSurfaceBlock.js +3 -3
- package/Materials/Node/Blocks/PBR/subSurfaceBlock.js.map +1 -1
- package/Materials/Node/nodeMaterial.d.ts +4 -2
- package/Materials/Node/nodeMaterial.js +9 -6
- package/Materials/Node/nodeMaterial.js.map +1 -1
- package/Materials/PBR/pbrBaseMaterial.js +1 -0
- package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
- package/Materials/Textures/Filtering/hdrFiltering.js +1 -0
- package/Materials/Textures/Filtering/hdrFiltering.js.map +1 -1
- package/Materials/Textures/Filtering/hdrIrradianceFiltering.d.ts +69 -0
- package/Materials/Textures/Filtering/hdrIrradianceFiltering.js +187 -0
- package/Materials/Textures/Filtering/hdrIrradianceFiltering.js.map +1 -0
- package/Materials/Textures/hdrCubeTexture.d.ts +5 -1
- package/Materials/Textures/hdrCubeTexture.js +29 -3
- package/Materials/Textures/hdrCubeTexture.js.map +1 -1
- package/Materials/Textures/index.d.ts +4 -0
- package/Materials/Textures/index.js +4 -0
- package/Materials/Textures/index.js.map +1 -1
- package/Materials/effect.d.ts +5 -0
- package/Materials/effect.js +15 -0
- package/Materials/effect.js.map +1 -1
- package/Materials/standardMaterial.d.ts +1 -2
- package/Materials/standardMaterial.js +0 -2
- package/Materials/standardMaterial.js.map +1 -1
- package/Meshes/Builders/planeBuilder.js +2 -2
- package/Meshes/Builders/planeBuilder.js.map +1 -1
- package/Meshes/Compression/dracoCodec.d.ts +4 -4
- package/Meshes/Compression/dracoCodec.js.map +1 -1
- package/Meshes/Compression/dracoCompression.d.ts +5 -3
- package/Meshes/Compression/dracoCompression.js +24 -11
- package/Meshes/Compression/dracoCompression.js.map +1 -1
- package/Meshes/Compression/dracoCompressionWorker.d.ts +16 -30
- package/Meshes/Compression/dracoCompressionWorker.js +128 -22
- package/Meshes/Compression/dracoCompressionWorker.js.map +1 -1
- package/Meshes/Compression/dracoDecoder.d.ts +4 -9
- package/Meshes/Compression/dracoDecoder.js +5 -5
- package/Meshes/Compression/dracoDecoder.js.map +1 -1
- package/Meshes/Compression/dracoDecoder.types.d.ts +52 -0
- package/Meshes/Compression/dracoDecoder.types.js +2 -0
- package/Meshes/Compression/dracoDecoder.types.js.map +1 -0
- package/Meshes/Compression/dracoEncoder.d.ts +95 -0
- package/Meshes/Compression/dracoEncoder.js +245 -0
- package/Meshes/Compression/dracoEncoder.js.map +1 -0
- package/Meshes/Compression/dracoEncoder.types.d.ts +82 -0
- package/Meshes/Compression/dracoEncoder.types.js +2 -0
- package/Meshes/Compression/dracoEncoder.types.js.map +1 -0
- package/Meshes/Compression/index.d.ts +1 -0
- package/Meshes/Compression/index.js +1 -0
- package/Meshes/Compression/index.js.map +1 -1
- package/Meshes/Compression/meshoptCompression.js +17 -2
- package/Meshes/Compression/meshoptCompression.js.map +1 -1
- package/Meshes/Compression/test/integration/draco.test.d.ts +1 -0
- package/Meshes/Compression/test/integration/draco.test.js +30 -0
- package/Meshes/Compression/test/integration/draco.test.js.map +1 -0
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.d.ts +92 -2
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +286 -10
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
- package/Meshes/GreasedLine/greasedLineBaseMesh.js +4 -2
- package/Meshes/GreasedLine/greasedLineBaseMesh.js.map +1 -1
- package/Meshes/GreasedLine/greasedLineRibbonMesh.js +1 -1
- package/Meshes/GreasedLine/greasedLineRibbonMesh.js.map +1 -1
- package/Meshes/Node/Blocks/Textures/geometryTextureBlock.d.ts +1 -1
- package/Meshes/csg.js +4 -0
- package/Meshes/csg.js.map +1 -1
- package/Meshes/mesh.d.ts +2 -2
- package/Meshes/transformNode.d.ts +4 -1
- package/Meshes/transformNode.js +6 -1
- package/Meshes/transformNode.js.map +1 -1
- package/Misc/copyTextureToTexture.js +1 -1
- package/Misc/copyTextureToTexture.js.map +1 -1
- package/Misc/decorators.serialization.js +2 -0
- package/Misc/decorators.serialization.js.map +1 -1
- package/Misc/greasedLineTools.d.ts +1 -1
- package/Misc/logger.d.ts +2 -1
- package/Misc/logger.js +2 -1
- package/Misc/logger.js.map +1 -1
- package/Misc/screenshotTools.js +58 -5
- package/Misc/screenshotTools.js.map +1 -1
- package/Misc/tools.d.ts +21 -1
- package/Misc/tools.js +33 -0
- package/Misc/tools.js.map +1 -1
- package/Morph/morphTargetManager.d.ts +1 -0
- package/Morph/morphTargetManager.js +6 -1
- package/Morph/morphTargetManager.js.map +1 -1
- package/Particles/particleHelper.js +2 -1
- package/Particles/particleHelper.js.map +1 -1
- package/Particles/particleSystemSet.d.ts +1 -0
- package/Particles/particleSystemSet.js +1 -0
- package/Particles/particleSystemSet.js.map +1 -1
- package/Particles/pointsCloudSystem.d.ts +3 -3
- package/Particles/webgl2ParticleSystem.d.ts +1 -1
- package/Particles/webgl2ParticleSystem.js +1 -2
- package/Particles/webgl2ParticleSystem.js.map +1 -1
- package/Physics/v2/Plugins/havokPlugin.d.ts +2 -2
- package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js +2 -1
- package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js.map +1 -1
- package/PostProcesses/index.d.ts +1 -0
- package/PostProcesses/index.js +1 -0
- package/PostProcesses/index.js.map +1 -1
- package/PostProcesses/passPostProcess.d.ts +2 -3
- package/PostProcesses/passPostProcess.js +36 -48
- package/PostProcesses/passPostProcess.js.map +1 -1
- package/PostProcesses/thinPassPostProcess.d.ts +48 -0
- package/PostProcesses/thinPassPostProcess.js +113 -0
- package/PostProcesses/thinPassPostProcess.js.map +1 -0
- package/Rendering/IBLShadows/iblShadowsVoxelTracingPass.js +1 -1
- package/Rendering/IBLShadows/iblShadowsVoxelTracingPass.js.map +1 -1
- package/Rendering/depthRenderer.js +1 -1
- package/Rendering/depthRenderer.js.map +1 -1
- package/Rendering/iblCdfGenerator.d.ts +13 -5
- package/Rendering/iblCdfGenerator.js +67 -10
- package/Rendering/iblCdfGenerator.js.map +1 -1
- package/Rendering/objectRenderer.d.ts +5 -3
- package/Rendering/objectRenderer.js +5 -3
- package/Rendering/objectRenderer.js.map +1 -1
- package/Rendering/renderingManager.d.ts +4 -0
- package/Rendering/renderingManager.js +1 -0
- package/Rendering/renderingManager.js.map +1 -1
- package/Shaders/ShadersInclude/gaussianSplatting.js +6 -6
- package/Shaders/ShadersInclude/gaussianSplatting.js.map +1 -1
- package/Shaders/ShadersInclude/intersectionFunctions.d.ts +5 -0
- package/Shaders/ShadersInclude/intersectionFunctions.js +14 -0
- package/Shaders/ShadersInclude/intersectionFunctions.js.map +1 -0
- package/Shaders/ShadersInclude/pbrBlockReflection.js +13 -8
- package/Shaders/ShadersInclude/pbrBlockReflection.js.map +1 -1
- package/Shaders/background.fragment.d.ts +1 -0
- package/Shaders/background.fragment.js +3 -5
- package/Shaders/background.fragment.js.map +1 -1
- package/Shaders/gaussianSplatting.vertex.js +2 -1
- package/Shaders/gaussianSplatting.vertex.js.map +1 -1
- package/Shaders/hdrIrradianceFiltering.fragment.d.ts +9 -0
- package/Shaders/hdrIrradianceFiltering.fragment.js +25 -0
- package/Shaders/hdrIrradianceFiltering.fragment.js.map +1 -0
- package/Shaders/hdrIrradianceFiltering.vertex.d.ts +5 -0
- package/Shaders/hdrIrradianceFiltering.vertex.js +15 -0
- package/Shaders/hdrIrradianceFiltering.vertex.js.map +1 -0
- package/Shaders/pbr.fragment.js +1 -3
- package/Shaders/pbr.fragment.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/intersectionFunctions.d.ts +5 -0
- package/ShadersWGSL/ShadersInclude/intersectionFunctions.js +14 -0
- package/ShadersWGSL/ShadersInclude/intersectionFunctions.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/pbrBlockReflection.js +13 -8
- package/ShadersWGSL/ShadersInclude/pbrBlockReflection.js.map +1 -1
- package/ShadersWGSL/background.fragment.d.ts +1 -0
- package/ShadersWGSL/background.fragment.js +3 -5
- package/ShadersWGSL/background.fragment.js.map +1 -1
- package/ShadersWGSL/greasedLine.fragment.js +9 -3
- package/ShadersWGSL/greasedLine.fragment.js.map +1 -1
- package/ShadersWGSL/greasedLine.vertex.js +12 -2
- package/ShadersWGSL/greasedLine.vertex.js.map +1 -1
- package/ShadersWGSL/hdrIrradianceFiltering.fragment.d.ts +9 -0
- package/ShadersWGSL/hdrIrradianceFiltering.fragment.js +26 -0
- package/ShadersWGSL/hdrIrradianceFiltering.fragment.js.map +1 -0
- package/ShadersWGSL/hdrIrradianceFiltering.vertex.d.ts +5 -0
- package/ShadersWGSL/hdrIrradianceFiltering.vertex.js +16 -0
- package/ShadersWGSL/hdrIrradianceFiltering.vertex.js.map +1 -0
- package/ShadersWGSL/outline.fragment.js +1 -1
- package/ShadersWGSL/outline.fragment.js.map +1 -1
- package/ShadersWGSL/passCube.fragment.js +1 -1
- package/ShadersWGSL/passCube.fragment.js.map +1 -1
- package/ShadersWGSL/pbr.fragment.js +1 -3
- package/ShadersWGSL/pbr.fragment.js.map +1 -1
- package/XR/features/WebXRDepthSensing.d.ts +24 -2
- package/XR/features/WebXRDepthSensing.js +320 -26
- package/XR/features/WebXRDepthSensing.js.map +1 -1
- package/XR/features/WebXRHandTracking.js +8 -7
- package/XR/features/WebXRHandTracking.js.map +1 -1
- package/package.json +1 -1
- package/scene.js +9 -5
- package/scene.js.map +1 -1
- package/types.d.ts +4 -0
- package/types.js.map +1 -1
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import { _IsConfigurationAvailable, DracoCodec } from "./dracoCodec.js";
|
|
2
|
+
import { EncodeMesh, EncoderWorkerFunction } from "./dracoCompressionWorker.js";
|
|
3
|
+
import { Tools } from "../../Misc/tools.js";
|
|
4
|
+
import { VertexBuffer } from "../buffer.js";
|
|
5
|
+
import { Mesh } from "../mesh.js";
|
|
6
|
+
import { Logger } from "../../Misc/logger.js";
|
|
7
|
+
import { deepMerge } from "../../Misc/deepMerger.js";
|
|
8
|
+
import { AreIndices32Bits } from "../../Buffers/bufferUtils.js";
|
|
9
|
+
/**
|
|
10
|
+
* Map the Babylon.js attribute kind to the Draco attribute kind, defined by the `GeometryAttributeType` enum.
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
function GetDracoAttributeName(kind) {
|
|
14
|
+
if (kind === VertexBuffer.PositionKind) {
|
|
15
|
+
return "POSITION";
|
|
16
|
+
}
|
|
17
|
+
else if (kind === VertexBuffer.NormalKind) {
|
|
18
|
+
return "NORMAL";
|
|
19
|
+
}
|
|
20
|
+
else if (kind === VertexBuffer.ColorKind) {
|
|
21
|
+
return "COLOR";
|
|
22
|
+
}
|
|
23
|
+
else if (kind.startsWith(VertexBuffer.UVKind)) {
|
|
24
|
+
return "TEX_COORD";
|
|
25
|
+
}
|
|
26
|
+
return "GENERIC";
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Get the indices for the geometry, if present. Eventually used as
|
|
30
|
+
* `AddFacesToMesh(mesh: Mesh, numFaces: number, faces: Uint16Array | Uint32Array)`;
|
|
31
|
+
* where `numFaces = indices.length / 3` and `faces = indices`.
|
|
32
|
+
* @internal
|
|
33
|
+
*/
|
|
34
|
+
function PrepareIndicesForDraco(input) {
|
|
35
|
+
let indices = input.getIndices();
|
|
36
|
+
// Convert number[] and Int32Array types, if needed
|
|
37
|
+
if (indices && !(indices instanceof Uint32Array) && !(indices instanceof Uint16Array)) {
|
|
38
|
+
indices = (AreIndices32Bits(indices, indices.length) ? Uint32Array : Uint16Array).from(indices);
|
|
39
|
+
}
|
|
40
|
+
return indices;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Get relevant information about the geometry's vertex attributes for Draco encoding. Eventually used for each attribute as
|
|
44
|
+
* `AddFloatAttribute(mesh: Mesh, attribute: number, count: number, itemSize: number, array: TypedArray)`
|
|
45
|
+
* where `attribute = EncoderModule[<dracoAttribute>]`, `itemSize = <size>`, `array = <data>`, and count is the number of position vertices.
|
|
46
|
+
* @internal
|
|
47
|
+
*/
|
|
48
|
+
function PrepareAttributesForDraco(input, excludedAttributes) {
|
|
49
|
+
const attributes = [];
|
|
50
|
+
for (const kind of input.getVerticesDataKinds()) {
|
|
51
|
+
if (excludedAttributes?.includes(kind)) {
|
|
52
|
+
if (kind === VertexBuffer.PositionKind) {
|
|
53
|
+
throw new Error("Cannot exclude position attribute from Draco encoding.");
|
|
54
|
+
}
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
// Convert number[] to typed array, if needed
|
|
58
|
+
let data = input.getVerticesData(kind);
|
|
59
|
+
if (!(data instanceof Float32Array)) {
|
|
60
|
+
data = Float32Array.from(data);
|
|
61
|
+
}
|
|
62
|
+
attributes.push({ kind: kind, dracoName: GetDracoAttributeName(kind), size: input.getVertexBuffer(kind).getSize(), data: data });
|
|
63
|
+
}
|
|
64
|
+
return attributes;
|
|
65
|
+
}
|
|
66
|
+
const DefaultEncoderOptions = {
|
|
67
|
+
decodeSpeed: 5,
|
|
68
|
+
encodeSpeed: 5,
|
|
69
|
+
method: "MESH_EDGEBREAKER_ENCODING",
|
|
70
|
+
quantizationBits: {
|
|
71
|
+
POSITION: 14,
|
|
72
|
+
NORMAL: 10,
|
|
73
|
+
COLOR: 8,
|
|
74
|
+
TEX_COORD: 12,
|
|
75
|
+
GENERIC: 12,
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* @experimental This class is subject to change.
|
|
80
|
+
*
|
|
81
|
+
* Draco Encoder (https://google.github.io/draco/)
|
|
82
|
+
*
|
|
83
|
+
* This class wraps the Draco encoder module.
|
|
84
|
+
*
|
|
85
|
+
* By default, the configuration points to a copy of the Draco encoder files from the Babylon.js cdn https://cdn.babylonjs.com/draco_encoder_wasm_wrapper.js.
|
|
86
|
+
*
|
|
87
|
+
* To update the configuration, use the following code:
|
|
88
|
+
* ```javascript
|
|
89
|
+
* DracoEncoder.DefaultConfiguration = {
|
|
90
|
+
* wasmUrl: "<url to the WebAssembly library>",
|
|
91
|
+
* wasmBinaryUrl: "<url to the WebAssembly binary>",
|
|
92
|
+
* fallbackUrl: "<url to the fallback JavaScript library>",
|
|
93
|
+
* };
|
|
94
|
+
* ```
|
|
95
|
+
*
|
|
96
|
+
* Draco has two versions, one for WebAssembly and one for JavaScript. The encoder configuration can be set to only support WebAssembly or only support the JavaScript version.
|
|
97
|
+
* Decoding will automatically fallback to the JavaScript version if WebAssembly version is not configured or if WebAssembly is not supported by the browser.
|
|
98
|
+
* Use `DracoEncoder.DefaultAvailable` to determine if the encoder configuration is available for the current context.
|
|
99
|
+
*
|
|
100
|
+
* To encode Draco compressed data, get the default DracoEncoder object and call encodeMeshAsync:
|
|
101
|
+
* ```javascript
|
|
102
|
+
* var dracoData = await DracoEncoder.Default.encodeMeshAsync(mesh);
|
|
103
|
+
* ```
|
|
104
|
+
*
|
|
105
|
+
* Currently, DracoEncoder only encodes to meshes. Encoding to point clouds is not yet supported.
|
|
106
|
+
*
|
|
107
|
+
* Only position, normal, color, and UV attributes are supported natively by the encoder. All other attributes are treated as generic. This means that,
|
|
108
|
+
* when decoding these generic attributes later, additional information about their original Babylon types will be needed to interpret the data correctly.
|
|
109
|
+
* You can use the return value of `encodeMeshAsync` to source this information, specifically the `attributes` field. E.g.,
|
|
110
|
+
* ```javascript
|
|
111
|
+
* var dracoData = await DracoEncoder.Default.encodeMeshAsync(mesh);
|
|
112
|
+
* var meshData = await DracoDecoder.Default.decodeMeshToMeshDataAsync(dracoData.data, dracoData.attributes);
|
|
113
|
+
* ```
|
|
114
|
+
*
|
|
115
|
+
* By default, DracoEncoder will encode all available attributes of the mesh. To exclude specific attributes, use the following code:
|
|
116
|
+
* ```javascript
|
|
117
|
+
* var options = { excludedAttributes: [VertexBuffer.MatricesIndicesKind, VertexBuffer.MatricesWeightsKind] };
|
|
118
|
+
* var dracoData = await DracoDecoder.Default.encodeMeshAsync(mesh, options);
|
|
119
|
+
* ```
|
|
120
|
+
*/
|
|
121
|
+
export class DracoEncoder extends DracoCodec {
|
|
122
|
+
/**
|
|
123
|
+
* Returns true if the encoder's `DefaultConfiguration` is available.
|
|
124
|
+
*/
|
|
125
|
+
static get DefaultAvailable() {
|
|
126
|
+
return _IsConfigurationAvailable(DracoEncoder.DefaultConfiguration);
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Default instance for the DracoEncoder.
|
|
130
|
+
*/
|
|
131
|
+
static get Default() {
|
|
132
|
+
DracoEncoder._Default ?? (DracoEncoder._Default = new DracoEncoder());
|
|
133
|
+
return DracoEncoder._Default;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Reset the default DracoEncoder object to null and disposing the removed default instance.
|
|
137
|
+
* Note that if the workerPool is a member of the static DefaultConfiguration object it is recommended not to run dispose,
|
|
138
|
+
* unless the static worker pool is no longer needed.
|
|
139
|
+
* @param skipDispose set to true to not dispose the removed default instance
|
|
140
|
+
*/
|
|
141
|
+
static ResetDefault(skipDispose) {
|
|
142
|
+
if (DracoEncoder._Default) {
|
|
143
|
+
if (!skipDispose) {
|
|
144
|
+
DracoEncoder._Default.dispose();
|
|
145
|
+
}
|
|
146
|
+
DracoEncoder._Default = null;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
_isModuleAvailable() {
|
|
150
|
+
return typeof DracoEncoderModule !== "undefined";
|
|
151
|
+
}
|
|
152
|
+
async _createModuleAsync(wasmBinary, jsModule /** DracoEncoderModule */) {
|
|
153
|
+
const module = await (jsModule || DracoEncoderModule)({ wasmBinary });
|
|
154
|
+
return { module };
|
|
155
|
+
}
|
|
156
|
+
_getWorkerContent() {
|
|
157
|
+
return `${EncodeMesh}(${EncoderWorkerFunction})()`;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Creates a new Draco encoder.
|
|
161
|
+
* @param configuration Optional override of the configuration for the DracoEncoder. If not provided, defaults to {@link DracoEncoder.DefaultConfiguration}.
|
|
162
|
+
*/
|
|
163
|
+
constructor(configuration = DracoEncoder.DefaultConfiguration) {
|
|
164
|
+
super(configuration);
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* @internal
|
|
168
|
+
*/
|
|
169
|
+
async _encodeAsync(attributes, indices, options) {
|
|
170
|
+
const mergedOptions = options ? deepMerge(DefaultEncoderOptions, options) : DefaultEncoderOptions;
|
|
171
|
+
if (this._workerPoolPromise) {
|
|
172
|
+
const workerPool = await this._workerPoolPromise;
|
|
173
|
+
return new Promise((resolve, reject) => {
|
|
174
|
+
workerPool.push((worker, onComplete) => {
|
|
175
|
+
const onError = (error) => {
|
|
176
|
+
worker.removeEventListener("error", onError);
|
|
177
|
+
worker.removeEventListener("message", onMessage);
|
|
178
|
+
reject(error);
|
|
179
|
+
onComplete();
|
|
180
|
+
};
|
|
181
|
+
const onMessage = (message) => {
|
|
182
|
+
if (message.data.id === "encodeMeshDone") {
|
|
183
|
+
worker.removeEventListener("error", onError);
|
|
184
|
+
worker.removeEventListener("message", onMessage);
|
|
185
|
+
resolve(message.data.encodedMeshData);
|
|
186
|
+
onComplete();
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
worker.addEventListener("error", onError);
|
|
190
|
+
worker.addEventListener("message", onMessage);
|
|
191
|
+
// Manually create copies of our attribute data and add them to the transfer list to ensure we only copy the ArrayBuffer data we need.
|
|
192
|
+
const transferList = [];
|
|
193
|
+
attributes.forEach((attribute) => {
|
|
194
|
+
attribute.data = attribute.data.slice();
|
|
195
|
+
transferList.push(attribute.data.buffer);
|
|
196
|
+
});
|
|
197
|
+
if (indices) {
|
|
198
|
+
indices = indices.slice();
|
|
199
|
+
transferList.push(indices.buffer);
|
|
200
|
+
}
|
|
201
|
+
worker.postMessage({ id: "encodeMesh", attributes: attributes, indices: indices, options: mergedOptions }, transferList);
|
|
202
|
+
});
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
if (this._modulePromise) {
|
|
206
|
+
const encoder = await this._modulePromise;
|
|
207
|
+
return EncodeMesh(encoder.module, attributes, indices, mergedOptions);
|
|
208
|
+
}
|
|
209
|
+
throw new Error("Draco encoder module is not available");
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Encodes a mesh or geometry into a Draco-encoded mesh data.
|
|
213
|
+
* @param input the mesh or geometry to encode
|
|
214
|
+
* @param options options for the encoding
|
|
215
|
+
* @returns a promise that resolves to the newly-encoded data
|
|
216
|
+
*/
|
|
217
|
+
async encodeMeshAsync(input, options) {
|
|
218
|
+
const verticesCount = input.getTotalVertices();
|
|
219
|
+
if (verticesCount == 0) {
|
|
220
|
+
throw new Error("Cannot compress geometry with Draco. There are no vertices.");
|
|
221
|
+
}
|
|
222
|
+
// Prepare parameters for encoding
|
|
223
|
+
if (input instanceof Mesh && input.morphTargetManager && options?.method === "MESH_EDGEBREAKER_ENCODING") {
|
|
224
|
+
Logger.Warn("Cannot use Draco EDGEBREAKER method with morph targets. Falling back to SEQUENTIAL method.");
|
|
225
|
+
options.method = "MESH_SEQUENTIAL_ENCODING";
|
|
226
|
+
}
|
|
227
|
+
const indices = PrepareIndicesForDraco(input);
|
|
228
|
+
const attributes = PrepareAttributesForDraco(input, options?.excludedAttributes);
|
|
229
|
+
return this._encodeAsync(attributes, indices, options);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Default configuration for the DracoEncoder. Defaults to the following:
|
|
234
|
+
* - numWorkers: 50% of the available logical processors, capped to 4. If no logical processors are available, defaults to 1.
|
|
235
|
+
* - wasmUrl: `"https://cdn.babylonjs.com/draco_encoder_wasm_wrapper.js"`
|
|
236
|
+
* - wasmBinaryUrl: `"https://cdn.babylonjs.com/draco_encoder.wasm"`
|
|
237
|
+
* - fallbackUrl: `"https://cdn.babylonjs.com/draco_encoder.js"`
|
|
238
|
+
*/
|
|
239
|
+
DracoEncoder.DefaultConfiguration = {
|
|
240
|
+
wasmUrl: `${Tools._DefaultCdnUrl}/draco_encoder_wasm_wrapper.js`,
|
|
241
|
+
wasmBinaryUrl: `${Tools._DefaultCdnUrl}/draco_encoder.wasm`,
|
|
242
|
+
fallbackUrl: `${Tools._DefaultCdnUrl}/draco_encoder.js`,
|
|
243
|
+
};
|
|
244
|
+
DracoEncoder._Default = null;
|
|
245
|
+
//# sourceMappingURL=dracoEncoder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dracoEncoder.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/Compression/dracoEncoder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,UAAU,EAAiC,MAAM,cAAc,CAAC;AAEpG,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAC7E,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,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AO,EAAE,GAAG,KAAK,CAAC,cAAc,gCAAgC;IAChE,aAAa,EAAE,GAAG,KAAK,CAAC,cAAc,qBAAqB;IAC3D,WAAW,EAAE,GAAG,KAAK,CAAC,cAAc,mBAAmB;CAC1D,CAAC;AASe,qBAAQ,GAA2B,IAAI,CAAC","sourcesContent":["import { _IsConfigurationAvailable, DracoCodec, type IDracoCodecConfiguration } from \"./dracoCodec\";\r\nimport type { EncoderMessage, IDracoAttributeData, IDracoEncodedMeshData, IDracoEncoderOptions, DracoAttributeName } from \"./dracoEncoder.types\";\r\nimport { EncodeMesh, EncoderWorkerFunction } from \"./dracoCompressionWorker\";\r\nimport { Tools } from \"../../Misc/tools\";\r\nimport { VertexBuffer } from \"../buffer\";\r\nimport type { Nullable } from \"../../types\";\r\nimport { Mesh } from \"../mesh\";\r\nimport type { Geometry } from \"../geometry\";\r\nimport { Logger } from \"../../Misc/logger\";\r\nimport { deepMerge } from \"../../Misc/deepMerger\";\r\nimport type { EncoderModule } from \"draco3d\";\r\nimport { AreIndices32Bits } from \"core/Buffers/bufferUtils\";\r\n\r\n// Missing type from types/draco3d. Do not use in public scope; UMD tests will fail because of EncoderModule.\r\ntype DracoEncoderModule = (props: { wasmBinary?: ArrayBuffer }) => Promise<EncoderModule>;\r\n\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\ndeclare let DracoEncoderModule: DracoEncoderModule;\r\n\r\n/**\r\n * Map the Babylon.js attribute kind to the Draco attribute kind, defined by the `GeometryAttributeType` enum.\r\n * @internal\r\n */\r\nfunction GetDracoAttributeName(kind: string): DracoAttributeName {\r\n if (kind === VertexBuffer.PositionKind) {\r\n return \"POSITION\";\r\n } else if (kind === VertexBuffer.NormalKind) {\r\n return \"NORMAL\";\r\n } else if (kind === VertexBuffer.ColorKind) {\r\n return \"COLOR\";\r\n } else if (kind.startsWith(VertexBuffer.UVKind)) {\r\n return \"TEX_COORD\";\r\n }\r\n return \"GENERIC\";\r\n}\r\n\r\n/**\r\n * Get the indices for the geometry, if present. Eventually used as\r\n * `AddFacesToMesh(mesh: Mesh, numFaces: number, faces: Uint16Array | Uint32Array)`;\r\n * where `numFaces = indices.length / 3` and `faces = indices`.\r\n * @internal\r\n */\r\nfunction PrepareIndicesForDraco(input: Mesh | Geometry): Nullable<Uint32Array | Uint16Array> {\r\n let indices = input.getIndices();\r\n\r\n // Convert number[] and Int32Array types, if needed\r\n if (indices && !(indices instanceof Uint32Array) && !(indices instanceof Uint16Array)) {\r\n indices = (AreIndices32Bits(indices, indices.length) ? Uint32Array : Uint16Array).from(indices);\r\n }\r\n\r\n return indices;\r\n}\r\n\r\n/**\r\n * Get relevant information about the geometry's vertex attributes for Draco encoding. Eventually used for each attribute as\r\n * `AddFloatAttribute(mesh: Mesh, attribute: number, count: number, itemSize: number, array: TypedArray)`\r\n * where `attribute = EncoderModule[<dracoAttribute>]`, `itemSize = <size>`, `array = <data>`, and count is the number of position vertices.\r\n * @internal\r\n */\r\nfunction PrepareAttributesForDraco(input: Mesh | Geometry, excludedAttributes?: string[]): Array<IDracoAttributeData> {\r\n const attributes: Array<IDracoAttributeData> = [];\r\n\r\n for (const kind of input.getVerticesDataKinds()) {\r\n if (excludedAttributes?.includes(kind)) {\r\n if (kind === VertexBuffer.PositionKind) {\r\n throw new Error(\"Cannot exclude position attribute from Draco encoding.\");\r\n }\r\n continue;\r\n }\r\n\r\n // Convert number[] to typed array, if needed\r\n let data = input.getVerticesData(kind)!;\r\n if (!(data instanceof Float32Array)) {\r\n data = Float32Array.from(data!);\r\n }\r\n attributes.push({ kind: kind, dracoName: GetDracoAttributeName(kind), size: input.getVertexBuffer(kind)!.getSize(), data: data });\r\n }\r\n\r\n return attributes;\r\n}\r\n\r\nconst DefaultEncoderOptions: IDracoEncoderOptions = {\r\n decodeSpeed: 5,\r\n encodeSpeed: 5,\r\n method: \"MESH_EDGEBREAKER_ENCODING\",\r\n quantizationBits: {\r\n POSITION: 14,\r\n NORMAL: 10,\r\n COLOR: 8,\r\n TEX_COORD: 12,\r\n GENERIC: 12,\r\n },\r\n};\r\n\r\n/**\r\n * @experimental This class is subject to change.\r\n *\r\n * Draco Encoder (https://google.github.io/draco/)\r\n *\r\n * This class wraps the Draco encoder module.\r\n *\r\n * By default, the configuration points to a copy of the Draco encoder files from the Babylon.js cdn https://cdn.babylonjs.com/draco_encoder_wasm_wrapper.js.\r\n *\r\n * To update the configuration, use the following code:\r\n * ```javascript\r\n * DracoEncoder.DefaultConfiguration = {\r\n * wasmUrl: \"<url to the WebAssembly library>\",\r\n * wasmBinaryUrl: \"<url to the WebAssembly binary>\",\r\n * fallbackUrl: \"<url to the fallback JavaScript library>\",\r\n * };\r\n * ```\r\n *\r\n * Draco has two versions, one for WebAssembly and one for JavaScript. The encoder configuration can be set to only support WebAssembly or only support the JavaScript version.\r\n * Decoding will automatically fallback to the JavaScript version if WebAssembly version is not configured or if WebAssembly is not supported by the browser.\r\n * Use `DracoEncoder.DefaultAvailable` to determine if the encoder configuration is available for the current context.\r\n *\r\n * To encode Draco compressed data, get the default DracoEncoder object and call encodeMeshAsync:\r\n * ```javascript\r\n * var dracoData = await DracoEncoder.Default.encodeMeshAsync(mesh);\r\n * ```\r\n *\r\n * Currently, DracoEncoder only encodes to meshes. Encoding to point clouds is not yet supported.\r\n *\r\n * Only position, normal, color, and UV attributes are supported natively by the encoder. All other attributes are treated as generic. This means that,\r\n * when decoding these generic attributes later, additional information about their original Babylon types will be needed to interpret the data correctly.\r\n * You can use the return value of `encodeMeshAsync` to source this information, specifically the `attributes` field. E.g.,\r\n * ```javascript\r\n * var dracoData = await DracoEncoder.Default.encodeMeshAsync(mesh);\r\n * var meshData = await DracoDecoder.Default.decodeMeshToMeshDataAsync(dracoData.data, dracoData.attributes);\r\n * ```\r\n *\r\n * By default, DracoEncoder will encode all available attributes of the mesh. To exclude specific attributes, use the following code:\r\n * ```javascript\r\n * var options = { excludedAttributes: [VertexBuffer.MatricesIndicesKind, VertexBuffer.MatricesWeightsKind] };\r\n * var dracoData = await DracoDecoder.Default.encodeMeshAsync(mesh, options);\r\n * ```\r\n */\r\nexport class DracoEncoder extends DracoCodec {\r\n /**\r\n * Default configuration for the DracoEncoder. Defaults to the following:\r\n * - numWorkers: 50% of the available logical processors, capped to 4. If no logical processors are available, defaults to 1.\r\n * - wasmUrl: `\"https://cdn.babylonjs.com/draco_encoder_wasm_wrapper.js\"`\r\n * - wasmBinaryUrl: `\"https://cdn.babylonjs.com/draco_encoder.wasm\"`\r\n * - fallbackUrl: `\"https://cdn.babylonjs.com/draco_encoder.js\"`\r\n */\r\n public static DefaultConfiguration: IDracoCodecConfiguration = {\r\n wasmUrl: `${Tools._DefaultCdnUrl}/draco_encoder_wasm_wrapper.js`,\r\n wasmBinaryUrl: `${Tools._DefaultCdnUrl}/draco_encoder.wasm`,\r\n fallbackUrl: `${Tools._DefaultCdnUrl}/draco_encoder.js`,\r\n };\r\n\r\n /**\r\n * Returns true if the encoder's `DefaultConfiguration` is available.\r\n */\r\n public static get DefaultAvailable(): boolean {\r\n return _IsConfigurationAvailable(DracoEncoder.DefaultConfiguration);\r\n }\r\n\r\n protected static _Default: Nullable<DracoEncoder> = null;\r\n /**\r\n * Default instance for the DracoEncoder.\r\n */\r\n public static get Default(): DracoEncoder {\r\n DracoEncoder._Default ??= new DracoEncoder();\r\n return DracoEncoder._Default;\r\n }\r\n\r\n /**\r\n * Reset the default DracoEncoder object to null and disposing the removed default instance.\r\n * Note that if the workerPool is a member of the static DefaultConfiguration object it is recommended not to run dispose,\r\n * unless the static worker pool is no longer needed.\r\n * @param skipDispose set to true to not dispose the removed default instance\r\n */\r\n public static ResetDefault(skipDispose?: boolean): void {\r\n if (DracoEncoder._Default) {\r\n if (!skipDispose) {\r\n DracoEncoder._Default.dispose();\r\n }\r\n DracoEncoder._Default = null;\r\n }\r\n }\r\n\r\n protected override _isModuleAvailable(): boolean {\r\n return typeof DracoEncoderModule !== \"undefined\";\r\n }\r\n\r\n protected override async _createModuleAsync(wasmBinary?: ArrayBuffer, jsModule?: unknown /** DracoEncoderModule */): Promise<{ module: unknown /** EncoderModule */ }> {\r\n const module = await ((jsModule as DracoEncoderModule) || DracoEncoderModule)({ wasmBinary });\r\n return { module };\r\n }\r\n\r\n protected override _getWorkerContent(): string {\r\n return `${EncodeMesh}(${EncoderWorkerFunction})()`;\r\n }\r\n\r\n /**\r\n * Creates a new Draco encoder.\r\n * @param configuration Optional override of the configuration for the DracoEncoder. If not provided, defaults to {@link DracoEncoder.DefaultConfiguration}.\r\n */\r\n constructor(configuration: IDracoCodecConfiguration = DracoEncoder.DefaultConfiguration) {\r\n super(configuration);\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public async _encodeAsync(\r\n attributes: Array<IDracoAttributeData>,\r\n indices: Nullable<Uint16Array | Uint32Array>,\r\n options?: IDracoEncoderOptions\r\n ): Promise<Nullable<IDracoEncodedMeshData>> {\r\n const mergedOptions = options ? deepMerge(DefaultEncoderOptions, options) : DefaultEncoderOptions;\r\n\r\n if (this._workerPoolPromise) {\r\n const workerPool = await this._workerPoolPromise;\r\n return new Promise<Nullable<IDracoEncodedMeshData>>((resolve, reject) => {\r\n workerPool.push((worker, onComplete) => {\r\n const onError = (error: ErrorEvent) => {\r\n worker.removeEventListener(\"error\", onError);\r\n worker.removeEventListener(\"message\", onMessage);\r\n reject(error);\r\n onComplete();\r\n };\r\n\r\n const onMessage = (message: MessageEvent<EncoderMessage>) => {\r\n if (message.data.id === \"encodeMeshDone\") {\r\n worker.removeEventListener(\"error\", onError);\r\n worker.removeEventListener(\"message\", onMessage);\r\n resolve(message.data.encodedMeshData);\r\n onComplete();\r\n }\r\n };\r\n\r\n worker.addEventListener(\"error\", onError);\r\n worker.addEventListener(\"message\", onMessage);\r\n\r\n // Manually create copies of our attribute data and add them to the transfer list to ensure we only copy the ArrayBuffer data we need.\r\n const transferList = [];\r\n attributes.forEach((attribute) => {\r\n attribute.data = attribute.data.slice();\r\n transferList.push(attribute.data.buffer);\r\n });\r\n if (indices) {\r\n indices = indices.slice();\r\n transferList.push(indices.buffer);\r\n }\r\n\r\n worker.postMessage({ id: \"encodeMesh\", attributes: attributes, indices: indices, options: mergedOptions }, transferList);\r\n });\r\n });\r\n }\r\n\r\n if (this._modulePromise) {\r\n const encoder = await this._modulePromise;\r\n return EncodeMesh(encoder.module, attributes, indices, mergedOptions);\r\n }\r\n\r\n throw new Error(\"Draco encoder module is not available\");\r\n }\r\n\r\n /**\r\n * Encodes a mesh or geometry into a Draco-encoded mesh data.\r\n * @param input the mesh or geometry to encode\r\n * @param options options for the encoding\r\n * @returns a promise that resolves to the newly-encoded data\r\n */\r\n public async encodeMeshAsync(input: Mesh | Geometry, options?: IDracoEncoderOptions): Promise<Nullable<IDracoEncodedMeshData>> {\r\n const verticesCount = input.getTotalVertices();\r\n if (verticesCount == 0) {\r\n throw new Error(\"Cannot compress geometry with Draco. There are no vertices.\");\r\n }\r\n\r\n // Prepare parameters for encoding\r\n if (input instanceof Mesh && input.morphTargetManager && options?.method === \"MESH_EDGEBREAKER_ENCODING\") {\r\n Logger.Warn(\"Cannot use Draco EDGEBREAKER method with morph targets. Falling back to SEQUENTIAL method.\");\r\n options.method = \"MESH_SEQUENTIAL_ENCODING\";\r\n }\r\n\r\n const indices = PrepareIndicesForDraco(input);\r\n const attributes = PrepareAttributesForDraco(input, options?.excludedAttributes);\r\n\r\n return this._encodeAsync(attributes, indices, options);\r\n }\r\n}\r\n"]}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import type { Nullable } from "../../types.js";
|
|
2
|
+
/**
|
|
3
|
+
* The available Draco attribute names.
|
|
4
|
+
*/
|
|
5
|
+
export type DracoAttributeName = "POSITION" | "NORMAL" | "COLOR" | "TEX_COORD" | "GENERIC";
|
|
6
|
+
/**
|
|
7
|
+
* Draco encoding method (from EncoderMethod enum in `draco_encoder.ts`).
|
|
8
|
+
*/
|
|
9
|
+
export type DracoEncoderMethod = "MESH_SEQUENTIAL_ENCODING" | "MESH_EDGEBREAKER_ENCODING";
|
|
10
|
+
/**
|
|
11
|
+
* Options for a particular encoding.
|
|
12
|
+
*/
|
|
13
|
+
export interface IDracoEncoderOptions {
|
|
14
|
+
/**
|
|
15
|
+
* Tune how fast decoding should be (0 = fastest but least compressed, 10 = slowest but most compressed).
|
|
16
|
+
*/
|
|
17
|
+
decodeSpeed?: number;
|
|
18
|
+
/**
|
|
19
|
+
* Tune how fast encoding should be (0 = fastest but least compressed, 10 = slowest but most compressed).
|
|
20
|
+
*/
|
|
21
|
+
encodeSpeed?: number;
|
|
22
|
+
/**
|
|
23
|
+
* The method to use for encoding the data (EDGEBREAKER or SEQUENTIAL). Defaults to EDGEBREAKER, if possible.
|
|
24
|
+
*/
|
|
25
|
+
method?: DracoEncoderMethod;
|
|
26
|
+
/**
|
|
27
|
+
* The number of bits to use for each DRACO attribute kind.
|
|
28
|
+
*/
|
|
29
|
+
quantizationBits?: Record<DracoAttributeName, number>;
|
|
30
|
+
/**
|
|
31
|
+
* The list of BABYLON attribute kinds to skip exporting, if present. Defaults to none.
|
|
32
|
+
*/
|
|
33
|
+
excludedAttributes?: string[];
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Encoder parameter carrying Babylon attribute data.
|
|
37
|
+
* @internal
|
|
38
|
+
*/
|
|
39
|
+
export interface IDracoAttributeData {
|
|
40
|
+
/**
|
|
41
|
+
* The kind of the attribute.
|
|
42
|
+
*/
|
|
43
|
+
kind: string;
|
|
44
|
+
/**
|
|
45
|
+
* The Draco name for the kind of the attribute.
|
|
46
|
+
*/
|
|
47
|
+
dracoName: DracoAttributeName;
|
|
48
|
+
/**
|
|
49
|
+
* The size of the attribute.
|
|
50
|
+
*/
|
|
51
|
+
size: number;
|
|
52
|
+
/**
|
|
53
|
+
* The buffer view of the attribute.
|
|
54
|
+
*/
|
|
55
|
+
data: Float32Array;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Encoded Draco mesh data.
|
|
59
|
+
* @internal
|
|
60
|
+
*/
|
|
61
|
+
export interface IDracoEncodedMeshData {
|
|
62
|
+
/**
|
|
63
|
+
* The encoded data.
|
|
64
|
+
*/
|
|
65
|
+
data: Int8Array;
|
|
66
|
+
/**
|
|
67
|
+
* A map of Babylon vertex attributes to their Draco unique ids in the encoded data.
|
|
68
|
+
*/
|
|
69
|
+
attributeIDs: Record<string, number>;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* @internal
|
|
73
|
+
*/
|
|
74
|
+
interface EncodeDoneMessage {
|
|
75
|
+
id: "encodeMeshDone";
|
|
76
|
+
encodedMeshData: Nullable<IDracoEncodedMeshData>;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* @internal
|
|
80
|
+
*/
|
|
81
|
+
export type EncoderMessage = EncodeDoneMessage;
|
|
82
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dracoEncoder.types.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/Compression/dracoEncoder.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Nullable } from \"core/types\";\n\n/**\n * The available Draco attribute names.\n */\nexport type DracoAttributeName = \"POSITION\" | \"NORMAL\" | \"COLOR\" | \"TEX_COORD\" | \"GENERIC\";\n\n/**\n * Draco encoding method (from EncoderMethod enum in `draco_encoder.ts`).\n */\nexport type DracoEncoderMethod = \"MESH_SEQUENTIAL_ENCODING\" | \"MESH_EDGEBREAKER_ENCODING\";\n\n/**\n * Options for a particular encoding.\n */\nexport interface IDracoEncoderOptions {\n /**\n * Tune how fast decoding should be (0 = fastest but least compressed, 10 = slowest but most compressed).\n */\n decodeSpeed?: number;\n /**\n * Tune how fast encoding should be (0 = fastest but least compressed, 10 = slowest but most compressed).\n */\n encodeSpeed?: number;\n /**\n * The method to use for encoding the data (EDGEBREAKER or SEQUENTIAL). Defaults to EDGEBREAKER, if possible.\n */\n method?: DracoEncoderMethod;\n /**\n * The number of bits to use for each DRACO attribute kind.\n */\n quantizationBits?: Record<DracoAttributeName, number>;\n /**\n * The list of BABYLON attribute kinds to skip exporting, if present. Defaults to none.\n */\n excludedAttributes?: string[];\n}\n\n/**\n * Encoder parameter carrying Babylon attribute data.\n * @internal\n */\nexport interface IDracoAttributeData {\n /**\n * The kind of the attribute.\n */\n kind: string;\n /**\n * The Draco name for the kind of the attribute.\n */\n dracoName: DracoAttributeName;\n /**\n * The size of the attribute.\n */\n size: number;\n /**\n * The buffer view of the attribute.\n */\n data: Float32Array;\n}\n\n/**\n * Encoded Draco mesh data.\n * @internal\n */\nexport interface IDracoEncodedMeshData {\n /**\n * The encoded data.\n */\n data: Int8Array;\n /**\n * A map of Babylon vertex attributes to their Draco unique ids in the encoded data.\n */\n attributeIDs: Record<string, number>;\n}\n\n/**\n * @internal\n */\ninterface EncodeDoneMessage {\n id: \"encodeMeshDone\";\n encodedMeshData: Nullable<IDracoEncodedMeshData>;\n}\n\n/**\n * @internal\n */\nexport type EncoderMessage = EncodeDoneMessage;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/Compression/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC","sourcesContent":["export * from \"./dracoCompression\";\r\nexport * from \"./meshoptCompression\";\r\nexport * from \"./dracoDecoder\";\r\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/Compression/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC","sourcesContent":["export * from \"./dracoCompression\";\r\nexport * from \"./meshoptCompression\";\r\nexport * from \"./dracoDecoder\";\r\nexport * from \"./dracoEncoder\";\r\n"]}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { Tools } from "../../Misc/tools.js";
|
|
2
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
3
|
+
let NumberOfWorkers = 0;
|
|
4
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
5
|
+
let WorkerTimeout = null;
|
|
2
6
|
/**
|
|
3
7
|
* Meshopt compression (https://github.com/zeux/meshoptimizer)
|
|
4
8
|
*
|
|
@@ -59,9 +63,20 @@ export class MeshoptCompression {
|
|
|
59
63
|
*/
|
|
60
64
|
decodeGltfBufferAsync(source, count, stride, mode, filter) {
|
|
61
65
|
return this._decoderModulePromise.then(async () => {
|
|
62
|
-
|
|
66
|
+
if (NumberOfWorkers === 0) {
|
|
67
|
+
MeshoptDecoder.useWorkers(1);
|
|
68
|
+
NumberOfWorkers = 1;
|
|
69
|
+
}
|
|
63
70
|
const result = await MeshoptDecoder.decodeGltfBufferAsync(count, stride, source, mode, filter);
|
|
64
|
-
|
|
71
|
+
// a simple debounce to avoid switching back and forth between workers and no workers while decoding
|
|
72
|
+
if (WorkerTimeout !== null) {
|
|
73
|
+
clearTimeout(WorkerTimeout);
|
|
74
|
+
}
|
|
75
|
+
WorkerTimeout = setTimeout(() => {
|
|
76
|
+
MeshoptDecoder.useWorkers(0);
|
|
77
|
+
NumberOfWorkers = 0;
|
|
78
|
+
WorkerTimeout = null;
|
|
79
|
+
}, 1000);
|
|
65
80
|
return result;
|
|
66
81
|
});
|
|
67
82
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"meshoptCompression.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/Compression/meshoptCompression.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"meshoptCompression.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/Compression/meshoptCompression.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAOzC,gEAA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AC,CAAC;YAChC,CAAC;YACD,aAAa,GAAG,UAAU,CAAC,GAAG,EAAE;gBAC5B,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;gBAC7B,eAAe,GAAG,CAAC,CAAC;gBACpB,aAAa,GAAG,IAAI,CAAC;YACzB,CAAC,EAAE,IAAI,CAAC,CAAC;YACT,OAAO,MAAM,CAAC;QAClB,CAAC,CAAC,CAAC;IACP,CAAC;;AA1ED;;;;;;;GAOG;AACW,gCAAa,GAAqC;IAC5D,OAAO,EAAE;QACL,GAAG,EAAE,GAAG,KAAK,CAAC,cAAc,qBAAqB;KACpD;CACJ,CAAC;AAEa,2BAAQ,GAAiC,IAAI,CAAC","sourcesContent":["import { Tools } from \"../../Misc/tools\";\r\nimport type { IDisposable } from \"../../scene\";\r\nimport type { Nullable } from \"../../types\";\r\n\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\ndeclare let MeshoptDecoder: any;\r\n\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nlet NumberOfWorkers = 0;\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nlet WorkerTimeout: Nullable<ReturnType<typeof setTimeout>> = null;\r\n\r\n/**\r\n * Configuration for meshoptimizer compression\r\n */\r\nexport interface IMeshoptCompressionConfiguration {\r\n /**\r\n * Configuration for the decoder.\r\n */\r\n decoder: {\r\n /**\r\n * The url to the meshopt decoder library.\r\n */\r\n url: string;\r\n };\r\n}\r\n\r\n/**\r\n * Meshopt compression (https://github.com/zeux/meshoptimizer)\r\n *\r\n * This class wraps the meshopt library from https://github.com/zeux/meshoptimizer/tree/master/js.\r\n *\r\n * **Encoder**\r\n *\r\n * The encoder is not currently implemented.\r\n *\r\n * **Decoder**\r\n *\r\n * By default, the configuration points to a copy of the meshopt files on the Babylon.js preview CDN (e.g. https://preview.babylonjs.com/meshopt_decoder.js).\r\n *\r\n * To update the configuration, use the following code:\r\n * ```javascript\r\n * MeshoptCompression.Configuration = {\r\n * decoder: {\r\n * url: \"<url to the meshopt decoder library>\"\r\n * }\r\n * };\r\n * ```\r\n */\r\nexport class MeshoptCompression implements IDisposable {\r\n private _decoderModulePromise?: Promise<any>;\r\n\r\n /**\r\n * The configuration. Defaults to the following:\r\n * ```javascript\r\n * decoder: {\r\n * url: \"https://cdn.babylonjs.com/meshopt_decoder.js\"\r\n * }\r\n * ```\r\n */\r\n public static Configuration: IMeshoptCompressionConfiguration = {\r\n decoder: {\r\n url: `${Tools._DefaultCdnUrl}/meshopt_decoder.js`,\r\n },\r\n };\r\n\r\n private static _Default: Nullable<MeshoptCompression> = null;\r\n\r\n /**\r\n * Default instance for the meshoptimizer object.\r\n */\r\n public static get Default(): MeshoptCompression {\r\n if (!MeshoptCompression._Default) {\r\n MeshoptCompression._Default = new MeshoptCompression();\r\n }\r\n\r\n return MeshoptCompression._Default;\r\n }\r\n\r\n /**\r\n * Constructor\r\n */\r\n constructor() {\r\n const decoder = MeshoptCompression.Configuration.decoder;\r\n\r\n this._decoderModulePromise = Tools.LoadBabylonScriptAsync(decoder.url).then(() => {\r\n // Wait for WebAssembly compilation before resolving promise\r\n return MeshoptDecoder.ready;\r\n });\r\n }\r\n\r\n /**\r\n * Stop all async operations and release resources.\r\n */\r\n public dispose(): void {\r\n delete this._decoderModulePromise;\r\n }\r\n\r\n /**\r\n * Decode meshopt data.\r\n * @see https://github.com/zeux/meshoptimizer/tree/master/js#decoder\r\n * @param source The input data.\r\n * @param count The number of elements.\r\n * @param stride The stride in bytes.\r\n * @param mode The compression mode.\r\n * @param filter The compression filter.\r\n * @returns a Promise<Uint8Array> that resolves to the decoded data\r\n */\r\n public decodeGltfBufferAsync(source: Uint8Array, count: number, stride: number, mode: \"ATTRIBUTES\" | \"TRIANGLES\" | \"INDICES\", filter?: string): Promise<Uint8Array> {\r\n return this._decoderModulePromise!.then(async () => {\r\n if (NumberOfWorkers === 0) {\r\n MeshoptDecoder.useWorkers(1);\r\n NumberOfWorkers = 1;\r\n }\r\n const result = await MeshoptDecoder.decodeGltfBufferAsync(count, stride, source, mode, filter);\r\n // a simple debounce to avoid switching back and forth between workers and no workers while decoding\r\n if (WorkerTimeout !== null) {\r\n clearTimeout(WorkerTimeout);\r\n }\r\n WorkerTimeout = setTimeout(() => {\r\n MeshoptDecoder.useWorkers(0);\r\n NumberOfWorkers = 0;\r\n WorkerTimeout = null;\r\n }, 1000);\r\n return result;\r\n });\r\n }\r\n}\r\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { DracoDecoder } from "../../dracoDecoder.js";
|
|
2
|
+
import { DracoCompression } from "../../dracoCompression.js";
|
|
3
|
+
describe("Draco Mesh Compression tests", () => {
|
|
4
|
+
describe("DracoDecoder's configuration is affected by updates to DracoCompression's", () => {
|
|
5
|
+
const originalConfig = { ...DracoDecoder.DefaultConfiguration };
|
|
6
|
+
const testUrl = "testUrl";
|
|
7
|
+
afterEach(() => {
|
|
8
|
+
expect(DracoDecoder.DefaultConfiguration.fallbackUrl).toBe(testUrl);
|
|
9
|
+
expect(DracoDecoder.DefaultConfiguration.fallbackUrl).toBe(DracoCompression.Configuration.decoder.fallbackUrl);
|
|
10
|
+
expect(DracoDecoder.DefaultConfiguration).toBe(DracoCompression.Configuration.decoder);
|
|
11
|
+
DracoDecoder.DefaultConfiguration = originalConfig;
|
|
12
|
+
});
|
|
13
|
+
it("updates via DracoCompression.Configuration.decoder.fallbackUrl", () => {
|
|
14
|
+
DracoCompression.Configuration.decoder.fallbackUrl = testUrl;
|
|
15
|
+
});
|
|
16
|
+
it("updates via DracoCompression.Configuration.decoder", () => {
|
|
17
|
+
DracoCompression.Configuration.decoder = {
|
|
18
|
+
fallbackUrl: testUrl,
|
|
19
|
+
};
|
|
20
|
+
});
|
|
21
|
+
it("updates via DracoCompression.Configuration", () => {
|
|
22
|
+
DracoCompression.Configuration = {
|
|
23
|
+
decoder: {
|
|
24
|
+
fallbackUrl: testUrl,
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
//# sourceMappingURL=draco.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"draco.test.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Meshes/Compression/test/integration/draco.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D,QAAQ,CAAC,8BAA8B,EAAE,GAAG,EAAE;IAC1C,QAAQ,CAAC,2EAA2E,EAAE,GAAG,EAAE;QACvF,MAAM,cAAc,GAA6B,EAAE,GAAG,YAAY,CAAC,oBAAoB,EAAE,CAAC;QAC1F,MAAM,OAAO,GAAG,SAAS,CAAC;QAE1B,SAAS,CAAC,GAAG,EAAE;YACX,MAAM,CAAC,YAAY,CAAC,oBAAoB,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACpE,MAAM,CAAC,YAAY,CAAC,oBAAoB,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,aAAa,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;YAC/G,MAAM,CAAC,YAAY,CAAC,oBAAoB,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;YACvF,YAAY,CAAC,oBAAoB,GAAG,cAAc,CAAC;QACvD,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,gEAAgE,EAAE,GAAG,EAAE;YACtE,gBAAgB,CAAC,aAAa,CAAC,OAAO,CAAC,WAAW,GAAG,OAAO,CAAC;QACjE,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,oDAAoD,EAAE,GAAG,EAAE;YAC1D,gBAAgB,CAAC,aAAa,CAAC,OAAO,GAAG;gBACrC,WAAW,EAAE,OAAO;aACvB,CAAC;QACN,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,4CAA4C,EAAE,GAAG,EAAE;YAClD,gBAAgB,CAAC,aAAa,GAAG;gBAC7B,OAAO,EAAE;oBACL,WAAW,EAAE,OAAO;iBACvB;aACJ,CAAC;QACN,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC","sourcesContent":["import { DracoDecoder } from \"../../dracoDecoder\";\nimport type { IDracoCodecConfiguration } from \"../../dracoCodec\";\nimport { DracoCompression } from \"../../dracoCompression\";\n\ndescribe(\"Draco Mesh Compression tests\", () => {\n describe(\"DracoDecoder's configuration is affected by updates to DracoCompression's\", () => {\n const originalConfig: IDracoCodecConfiguration = { ...DracoDecoder.DefaultConfiguration };\n const testUrl = \"testUrl\";\n\n afterEach(() => {\n expect(DracoDecoder.DefaultConfiguration.fallbackUrl).toBe(testUrl);\n expect(DracoDecoder.DefaultConfiguration.fallbackUrl).toBe(DracoCompression.Configuration.decoder.fallbackUrl);\n expect(DracoDecoder.DefaultConfiguration).toBe(DracoCompression.Configuration.decoder);\n DracoDecoder.DefaultConfiguration = originalConfig;\n });\n\n it(\"updates via DracoCompression.Configuration.decoder.fallbackUrl\", () => {\n DracoCompression.Configuration.decoder.fallbackUrl = testUrl;\n });\n\n it(\"updates via DracoCompression.Configuration.decoder\", () => {\n DracoCompression.Configuration.decoder = {\n fallbackUrl: testUrl,\n };\n });\n\n it(\"updates via DracoCompression.Configuration\", () => {\n DracoCompression.Configuration = {\n decoder: {\n fallbackUrl: testUrl,\n },\n };\n });\n });\n});\n"]}
|
|
@@ -55,7 +55,58 @@ declare enum PLYValue {
|
|
|
55
55
|
ROT_1 = 31,
|
|
56
56
|
ROT_2 = 32,
|
|
57
57
|
ROT_3 = 33,
|
|
58
|
-
|
|
58
|
+
MIN_COLOR_R = 34,
|
|
59
|
+
MIN_COLOR_G = 35,
|
|
60
|
+
MIN_COLOR_B = 36,
|
|
61
|
+
MAX_COLOR_R = 37,
|
|
62
|
+
MAX_COLOR_G = 38,
|
|
63
|
+
MAX_COLOR_B = 39,
|
|
64
|
+
SH_0 = 40,
|
|
65
|
+
SH_1 = 41,
|
|
66
|
+
SH_2 = 42,
|
|
67
|
+
SH_3 = 43,
|
|
68
|
+
SH_4 = 44,
|
|
69
|
+
SH_5 = 45,
|
|
70
|
+
SH_6 = 46,
|
|
71
|
+
SH_7 = 47,
|
|
72
|
+
SH_8 = 48,
|
|
73
|
+
SH_9 = 49,
|
|
74
|
+
SH_10 = 50,
|
|
75
|
+
SH_11 = 51,
|
|
76
|
+
SH_12 = 52,
|
|
77
|
+
SH_13 = 53,
|
|
78
|
+
SH_14 = 54,
|
|
79
|
+
SH_15 = 55,
|
|
80
|
+
SH_16 = 56,
|
|
81
|
+
SH_17 = 57,
|
|
82
|
+
SH_18 = 58,
|
|
83
|
+
SH_19 = 59,
|
|
84
|
+
SH_20 = 60,
|
|
85
|
+
SH_21 = 61,
|
|
86
|
+
SH_22 = 62,
|
|
87
|
+
SH_23 = 63,
|
|
88
|
+
SH_24 = 64,
|
|
89
|
+
SH_25 = 65,
|
|
90
|
+
SH_26 = 66,
|
|
91
|
+
SH_27 = 67,
|
|
92
|
+
SH_28 = 68,
|
|
93
|
+
SH_29 = 69,
|
|
94
|
+
SH_30 = 70,
|
|
95
|
+
SH_31 = 71,
|
|
96
|
+
SH_32 = 72,
|
|
97
|
+
SH_33 = 73,
|
|
98
|
+
SH_34 = 74,
|
|
99
|
+
SH_35 = 75,
|
|
100
|
+
SH_36 = 76,
|
|
101
|
+
SH_37 = 77,
|
|
102
|
+
SH_38 = 78,
|
|
103
|
+
SH_39 = 79,
|
|
104
|
+
SH_40 = 80,
|
|
105
|
+
SH_41 = 81,
|
|
106
|
+
SH_42 = 82,
|
|
107
|
+
SH_43 = 83,
|
|
108
|
+
SH_44 = 84,
|
|
109
|
+
UNDEFINED = 85
|
|
59
110
|
}
|
|
60
111
|
/**
|
|
61
112
|
* Property field found in PLY header
|
|
@@ -110,6 +161,18 @@ export interface PLYHeader {
|
|
|
110
161
|
* buffer for the data view
|
|
111
162
|
*/
|
|
112
163
|
buffer: ArrayBuffer;
|
|
164
|
+
/**
|
|
165
|
+
* degree of SH coefficients
|
|
166
|
+
*/
|
|
167
|
+
shDegree: number;
|
|
168
|
+
/**
|
|
169
|
+
* number of coefficient per splat
|
|
170
|
+
*/
|
|
171
|
+
shCoefficientCount: number;
|
|
172
|
+
/**
|
|
173
|
+
* buffer for SH coefficients
|
|
174
|
+
*/
|
|
175
|
+
shBuffer: ArrayBuffer | null;
|
|
113
176
|
}
|
|
114
177
|
/**
|
|
115
178
|
* Class used to render a gaussian splatting mesh
|
|
@@ -228,12 +291,26 @@ export declare class GaussianSplattingMesh extends Mesh {
|
|
|
228
291
|
static ParseHeader(data: ArrayBuffer): PLYHeader | null;
|
|
229
292
|
private static _GetCompressedChunks;
|
|
230
293
|
private static _GetSplat;
|
|
294
|
+
/**
|
|
295
|
+
* Converts a .ply data with SH coefficients splat
|
|
296
|
+
* if data array buffer is not ply, returns the original buffer
|
|
297
|
+
* @param data the .ply data to load
|
|
298
|
+
* @param useCoroutine use coroutine and yield
|
|
299
|
+
* @returns the loaded splat buffer and optional array of sh coefficients
|
|
300
|
+
*/
|
|
301
|
+
static ConvertPLYWithSHToSplat(data: ArrayBuffer, useCoroutine?: boolean): Generator<undefined, {
|
|
302
|
+
buffer: ArrayBuffer;
|
|
303
|
+
sh?: undefined;
|
|
304
|
+
} | {
|
|
305
|
+
buffer: ArrayBuffer;
|
|
306
|
+
sh: Uint8Array<ArrayBuffer>[] | null;
|
|
307
|
+
}, unknown>;
|
|
231
308
|
/**
|
|
232
309
|
* Converts a .ply data array buffer to splat
|
|
233
310
|
* if data array buffer is not ply, returns the original buffer
|
|
234
311
|
* @param data the .ply data to load
|
|
235
312
|
* @param useCoroutine use coroutine and yield
|
|
236
|
-
* @returns the loaded splat buffer
|
|
313
|
+
* @returns the loaded splat buffer without SH coefficient, whether ply contains or not SH.
|
|
237
314
|
*/
|
|
238
315
|
static ConvertPLYToSplat(data: ArrayBuffer, useCoroutine?: boolean): Generator<undefined, ArrayBuffer, unknown>;
|
|
239
316
|
/**
|
|
@@ -243,6 +320,19 @@ export declare class GaussianSplattingMesh extends Mesh {
|
|
|
243
320
|
* @returns the loaded splat buffer
|
|
244
321
|
*/
|
|
245
322
|
static ConvertPLYToSplatAsync(data: ArrayBuffer): Promise<ArrayBuffer>;
|
|
323
|
+
/**
|
|
324
|
+
* Converts a .ply with SH data array buffer to splat
|
|
325
|
+
* if data array buffer is not ply, returns the original buffer
|
|
326
|
+
* @param data the .ply data to load
|
|
327
|
+
* @returns the loaded splat buffer with SH
|
|
328
|
+
*/
|
|
329
|
+
static ConvertPLYWithSHToSplatAsync(data: ArrayBuffer): Promise<{
|
|
330
|
+
buffer: ArrayBuffer;
|
|
331
|
+
sh?: undefined;
|
|
332
|
+
} | {
|
|
333
|
+
buffer: ArrayBuffer;
|
|
334
|
+
sh: Uint8Array<ArrayBuffer>[] | null;
|
|
335
|
+
}>;
|
|
246
336
|
/**
|
|
247
337
|
* Loads a .splat Gaussian Splatting array buffer asynchronously
|
|
248
338
|
* @param data arraybuffer containing splat file
|