@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"greasedLineBaseMesh.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/GreasedLine/greasedLineBaseMesh.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,yBAAyB,EAAE,MAAM,uDAAuD,CAAC;AAClG,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAE9C,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,yBAAyB,EAAE,MAAM,uDAAuD,CAAC;AAGlG,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAE/D;;;GAGG;AACH,MAAM,CAAN,IAAkB,2BAGjB;AAHD,WAAkB,2BAA2B;IACzC,yGAAsB,CAAA;IACtB,uGAAqB,CAAA;AACzB,CAAC,EAHiB,2BAA2B,KAA3B,2BAA2B,QAG5C;AAED;;;;GAIG;AACH,MAAM,CAAN,IAAkB,0BAIjB;AAJD,WAAkB,0BAA0B;IACxC,iHAA2B,CAAA;IAC3B,yJAA+C,CAAA;IAC/C,iHAA2B,CAAA;AAC/B,CAAC,EAJiB,0BAA0B,KAA1B,0BAA0B,QAI3C;AAED;;;;;;;GAOG;AACH,M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AQ,CAAC,SAAS,CAAC,CAAC;QACtD,OAAO,UAAU,CAAC;IACtB,CAAC;IAES,oBAAoB,CAAC,OAAiB;QAC5C,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;QAEvC,MAAM,YAAY,GAAG,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;QACrE,IAAI,CAAC,iBAAiB,CAAC,YAAY,CAAC,kBAAkB,CAAC,aAAa,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAC7E,IAAI,CAAC,cAAc,GAAG,YAAY,CAAC;IACvC,CAAC;CACJ","sourcesContent":["import type { Scene } from \"../../scene\";\r\nimport type { IGreasedLineMaterial } from \"../../Materials/GreasedLine/greasedLineMaterialInterfaces\";\r\nimport { GreasedLinePluginMaterial } from \"../../Materials/GreasedLine/greasedLinePluginMaterial\";\r\nimport { Mesh } from \"../mesh\";\r\nimport { Buffer } from \"../../Buffers/buffer\";\r\nimport type { Vector3 } from \"../../Maths/math.vector\";\r\nimport { VertexData } from \"../mesh.vertexData\";\r\nimport { DeepCopier } from \"../../Misc/deepCopier\";\r\nimport { GreasedLineSimpleMaterial } from \"../../Materials/GreasedLine/greasedLineSimpleMaterial\";\r\nimport type { AbstractEngine } from \"../../Engines/abstractEngine\";\r\nimport type { FloatArray, IndicesArray } from \"../../types\";\r\nimport { GreasedLineTools } from \"../../Misc/greasedLineTools\";\r\n\r\n/**\r\n * In POINTS_MODE_POINTS every array of points will become the center (backbone) of the ribbon. The ribbon will be expanded by `width / 2` to `+direction` and `-direction` as well.\r\n * In POINTS_MODE_PATHS every array of points specifies an edge. These will be used to build one ribbon.\r\n */\r\nexport const enum GreasedLineRibbonPointsMode {\r\n POINTS_MODE_POINTS = 0,\r\n POINTS_MODE_PATHS = 1,\r\n}\r\n\r\n/**\r\n * FACES_MODE_SINGLE_SIDED single sided with back face culling. Default value.\r\n * FACES_MODE_SINGLE_SIDED_NO_BACKFACE_CULLING single sided without back face culling. Sets backFaceCulling = false on the material so it affects all line ribbons added to the line ribbon instance.\r\n * FACES_MODE_DOUBLE_SIDED extra back faces are created. This doubles the amount of faces of the mesh.\r\n */\r\nexport const enum GreasedLineRibbonFacesMode {\r\n FACES_MODE_SINGLE_SIDED = 0,\r\n FACES_MODE_SINGLE_SIDED_NO_BACKFACE_CULLING = 1,\r\n FACES_MODE_DOUBLE_SIDED = 2,\r\n}\r\n\r\n/**\r\n * Only with POINTS_MODE_PATHS.\r\n * AUTO_DIRECTIONS_FROM_FIRST_SEGMENT sets the direction (slope) of the ribbon from the direction of the first line segment. Recommended.\r\n * AUTO_DIRECTIONS_FROM_ALL_SEGMENTS in this mode the direction (slope) will be calculated for each line segment according to the direction vector between each point of the line segments. Slow method.\r\n * AUTO_DIRECTIONS_ENHANCED in this mode the direction (slope) will be calculated for each line segment according to the direction vector between each point of the line segments using a more sophisitcaed algorithm. Slowest method.\r\n * AUTO_DIRECTIONS_FACE_TO in this mode the direction (slope) will be calculated for each line segment according to the direction vector between each point of the line segments and a direction (face-to) vector specified in direction. The resulting line will face to the direction of this face-to vector.\r\n * AUTO_DIRECTIONS_NONE you have to set the direction (slope) manually. Recommended.\r\n */\r\nexport const enum GreasedLineRibbonAutoDirectionMode {\r\n AUTO_DIRECTIONS_FROM_FIRST_SEGMENT = 0,\r\n AUTO_DIRECTIONS_FROM_ALL_SEGMENTS = 1,\r\n AUTO_DIRECTIONS_ENHANCED = 2,\r\n AUTO_DIRECTIONS_FACE_TO = 3,\r\n AUTO_DIRECTIONS_NONE = 99,\r\n}\r\n\r\nexport type GreasedLineRibbonOptions = {\r\n /**\r\n * Defines how the points are processed.\r\n * In GreasedLineRibbonPointsMode.POINTS_MODE_POINTS every array of points will become the center of the ribbon. The ribbon will be expanded by width/2 to +direction and -direction as well.\r\n * In GreasedLineRibbonPointsMode.POINTS_MODE_PATHS every array of points is one path. These will be used to buuid one ribbon.\r\n */\r\n pointsMode?: GreasedLineRibbonPointsMode;\r\n /**\r\n * Normalized directions of the slopes of the non camera facing lines.\r\n */\r\n directions?: Vector3[] | Vector3;\r\n /**\r\n * Defines the calculation mode of the directions which the line will be thickened to.\r\n */\r\n directionsAutoMode?: GreasedLineRibbonAutoDirectionMode;\r\n /**\r\n * Width of the ribbon.\r\n */\r\n width?: number;\r\n /**\r\n * Controls how the faces are created.\r\n * GreasedLineRibbonFacesMode.FACES_MODE_SINGLE_SIDED = single sided with back face culling. Default value.\r\n * GreasedLineRibbonFacesMode.FACES_MODE_SINGLE_SIDED_NO_BACKFACE_CULLING = single sided without back face culling\r\n * GreasedLineRibbonFacesMode.FACES_MODE_DOUBLE_SIDED = extra back faces are created. This doubles the amount of faces of the mesh.\r\n */\r\n facesMode?: GreasedLineRibbonFacesMode;\r\n /**\r\n * If true, the path will be closed.\r\n */\r\n closePath?: boolean;\r\n /**\r\n * If true, normals will be computed when creating the vertex buffers.\r\n * This results to smooth shading of the mesh.\r\n */\r\n smoothShading?: boolean;\r\n};\r\n\r\nexport type GreasedLinePoints = Vector3[] | Vector3[][] | Float32Array | Float32Array[] | number[][] | number[];\r\n\r\n/**\r\n * Options for converting the points to the internal number[][] format used by GreasedLine\r\n */\r\nexport interface GreasedLinePointsOptions {\r\n /**\r\n * If defined and a Float32Array is used for the points parameter,\r\n * it will create multiple disconnected lines.\r\n * This parameter defines how many entries from the array to use for one line.\r\n * One entry = 3 float values.\r\n */\r\n floatArrayStride?: number;\r\n}\r\n\r\n/**\r\n * Options for creating a GreasedLineMesh\r\n */\r\nexport interface GreasedLineMeshOptions {\r\n /**\r\n * Points of the line.\r\n */\r\n points: GreasedLinePoints;\r\n /**\r\n * Each line segment (from point to point) can have it's width multiplier. Final width = widths[segmentIdx] * width.\r\n * Defaults to empty array.\r\n */\r\n widths?: number[];\r\n /**\r\n * If instance is specified, lines are added to the specified instance.\r\n * Defaults to undefined.\r\n */\r\n instance?: GreasedLineBaseMesh;\r\n /**\r\n * You can manually set the color pointers so you can control which segment/part\r\n * will use which color from the colors material option\r\n */\r\n colorPointers?: number[];\r\n /**\r\n * UVs for the mesh\r\n */\r\n uvs?: FloatArray;\r\n /**\r\n * If true, offsets and widths are updatable.\r\n * Defaults to false.\r\n */\r\n updatable?: boolean;\r\n /**\r\n * Use when @see instance is specified.\r\n * If true, the line will be rendered only after calling instance.updateLazy(). If false, line will be rerendered after every call to @see CreateGreasedLine\r\n * Defaults to false.\r\n */\r\n lazy?: boolean;\r\n /**\r\n * The options for the ribbon which will be used as a line.\r\n * If this option is set the line switches automatically to a non camera facing mode.\r\n */\r\n ribbonOptions?: GreasedLineRibbonOptions;\r\n /**\r\n * Options for converting the points.\r\n */\r\n pointsOptions?: GreasedLinePointsOptions;\r\n}\r\n\r\n/**\r\n * GreasedLineBaseMesh\r\n */\r\nexport abstract class GreasedLineBaseMesh extends Mesh {\r\n protected _vertexPositions: FloatArray;\r\n protected _indices: IndicesArray;\r\n protected _uvs: FloatArray;\r\n protected _points: number[][];\r\n protected _offsets: number[];\r\n protected _colorPointers: number[];\r\n protected _widths: number[];\r\n\r\n protected _offsetsBuffer?: Buffer;\r\n protected _widthsBuffer?: Buffer;\r\n protected _colorPointersBuffer?: Buffer;\r\n\r\n protected _lazy = false;\r\n protected _updatable = false;\r\n\r\n protected _engine: AbstractEngine;\r\n\r\n constructor(\r\n public override readonly name: string,\r\n scene: Scene,\r\n protected _options: GreasedLineMeshOptions\r\n ) {\r\n super(name, scene, null, null, false, false);\r\n\r\n this._engine = scene.getEngine();\r\n\r\n this._lazy = _options.lazy ?? false;\r\n this._updatable = _options.updatable ?? false;\r\n\r\n this._vertexPositions = [];\r\n this._indices = [];\r\n this._uvs = [];\r\n this._points = [];\r\n this._colorPointers = _options.colorPointers ?? [];\r\n this._widths = _options.widths ?? new Array(_options.points.length).fill(1);\r\n }\r\n\r\n /**\r\n * \"GreasedLineMesh\"\r\n * @returns \"GreasedLineMesh\"\r\n */\r\n public override getClassName(): string {\r\n return \"GreasedLineMesh\";\r\n }\r\n\r\n protected abstract _setPoints(points: number[][], options?: GreasedLineMeshOptions): void;\r\n protected abstract _updateColorPointers(): void;\r\n protected abstract _updateWidths(): void;\r\n\r\n protected _updateWidthsWithValue(defaulValue: number) {\r\n let pointCount = 0;\r\n for (const points of this._points) {\r\n pointCount += points.length;\r\n }\r\n const countDiff = (pointCount / 3) * 2 - this._widths.length;\r\n for (let i = 0; i < countDiff; i++) {\r\n this._widths.push(defaulValue);\r\n }\r\n }\r\n\r\n /**\r\n * Updated a lazy line. Rerenders the line and updates boundinfo as well.\r\n */\r\n public updateLazy() {\r\n this._setPoints(this._points);\r\n if (!this._options.colorPointers) {\r\n this._updateColorPointers();\r\n }\r\n this._createVertexBuffers(this._options.ribbonOptions?.smoothShading);\r\n this._createOffsetsBuffer(this._offsets || []);\r\n !this.doNotSyncBoundingInfo && this.refreshBoundingInfo();\r\n\r\n this.greasedLineMaterial?.updateLazy();\r\n }\r\n\r\n /**\r\n * Adds new points to the line. It doesn't rerenders the line if in lazy mode.\r\n * @param points points table\r\n * @param options optional options\r\n */\r\n public addPoints(points: number[][], options?: GreasedLineMeshOptions) {\r\n for (const p of points) {\r\n this._points.push(p);\r\n }\r\n\r\n if (!this._lazy) {\r\n this.setPoints(this._points, options);\r\n }\r\n }\r\n\r\n /**\r\n * Dispose the line and it's resources\r\n * @param doNotRecurse Set to true to not recurse into each children (recurse into each children by default)\r\n * @param disposeMaterialAndTextures Set to true to also dispose referenced materials and textures (false by default)\r\n */\r\n public override dispose(doNotRecurse?: boolean, disposeMaterialAndTextures = false) {\r\n super.dispose(doNotRecurse, disposeMaterialAndTextures);\r\n }\r\n\r\n /**\r\n * @returns true if the mesh was created in lazy mode\r\n */\r\n public isLazy(): boolean {\r\n return this._lazy;\r\n }\r\n\r\n /**\r\n * Returns the UVs\r\n */\r\n get uvs() {\r\n return this._uvs;\r\n }\r\n\r\n /**\r\n * Sets the UVs\r\n * @param uvs the UVs\r\n */\r\n set uvs(uvs: FloatArray) {\r\n this._uvs = uvs instanceof Float32Array ? uvs : new Float32Array(uvs);\r\n this._createVertexBuffers();\r\n }\r\n\r\n /**\r\n * Returns the points offsets\r\n * Return the points offsets\r\n */\r\n get offsets() {\r\n return this._offsets;\r\n }\r\n\r\n /**\r\n * Sets point offests\r\n * @param offsets offset table [x,y,z, x,y,z, ....]\r\n */\r\n set offsets(offsets: number[]) {\r\n this._offsets = offsets;\r\n if (!this._offsetsBuffer) {\r\n this._createOffsetsBuffer(offsets);\r\n } else {\r\n this._offsetsBuffer.update(offsets);\r\n }\r\n }\r\n\r\n /**\r\n * Gets widths at each line point like [widthLower, widthUpper, widthLower, widthUpper, ...]\r\n */\r\n get widths() {\r\n return this._widths;\r\n }\r\n\r\n /**\r\n * Sets widths at each line point\r\n * @param widths width table [widthLower, widthUpper, widthLower, widthUpper ...]\r\n */\r\n set widths(widths: number[]) {\r\n this._widths = widths;\r\n if (!this._lazy) {\r\n this._widthsBuffer && this._widthsBuffer.update(widths);\r\n }\r\n }\r\n\r\n /**\r\n * Gets the color pointer. Each vertex need a color pointer. These color pointers points to the colors in the color table @see colors\r\n */\r\n get colorPointers() {\r\n return this._colorPointers;\r\n }\r\n\r\n /**\r\n * Sets the color pointer\r\n * @param colorPointers array of color pointer in the colors array. One pointer for every vertex is needed.\r\n */\r\n set colorPointers(colorPointers: number[]) {\r\n this._colorPointers = colorPointers;\r\n if (!this._lazy) {\r\n this._colorPointersBuffer && this._colorPointersBuffer.update(colorPointers);\r\n }\r\n }\r\n\r\n /**\r\n * Gets the pluginMaterial associated with line\r\n */\r\n get greasedLineMaterial(): IGreasedLineMaterial | undefined {\r\n if (this.material && this.material instanceof GreasedLineSimpleMaterial) {\r\n return this.material;\r\n }\r\n const materialPlugin = this.material?.pluginManager?.getPlugin(GreasedLinePluginMaterial.GREASED_LINE_MATERIAL_NAME);\r\n if (materialPlugin) {\r\n return <GreasedLinePluginMaterial>materialPlugin;\r\n }\r\n return;\r\n }\r\n\r\n /**\r\n * Return copy the points.\r\n */\r\n get points() {\r\n const pointsCopy: number[][] = [];\r\n DeepCopier.DeepCopy(this._points, pointsCopy);\r\n return pointsCopy;\r\n }\r\n\r\n /**\r\n * Sets line points and rerenders the line.\r\n * @param points points table\r\n * @param options optional options\r\n */\r\n public setPoints(points: GreasedLinePoints, options?: GreasedLineMeshOptions) {\r\n this._points = GreasedLineTools.ConvertPoints(points, options?.pointsOptions ?? this._options.pointsOptions);\r\n this._updateWidths();\r\n if (!options?.colorPointers) {\r\n this._updateColorPointers();\r\n }\r\n this._setPoints(this._points, options);\r\n }\r\n\r\n protected _initGreasedLine() {\r\n this._vertexPositions = [];\r\n this._indices = [];\r\n this._uvs = [];\r\n }\r\n\r\n protected _createLineOptions() {\r\n const lineOptions: GreasedLineMeshOptions = {\r\n points: this._points,\r\n colorPointers: this._colorPointers,\r\n lazy: this._lazy,\r\n updatable: this._updatable,\r\n uvs: this._uvs,\r\n widths: this._widths,\r\n ribbonOptions: this._options.ribbonOptions,\r\n };\r\n return lineOptions;\r\n }\r\n\r\n /**\r\n * Serializes this GreasedLineMesh\r\n * @param serializationObject object to write serialization to\r\n */\r\n public override serialize(serializationObject: any): void {\r\n super.serialize(serializationObject);\r\n serializationObject.type = this.getClassName();\r\n\r\n serializationObject.lineOptions = this._createLineOptions();\r\n }\r\n\r\n protected _createVertexBuffers(computeNormals = false) {\r\n const vertexData = new VertexData();\r\n vertexData.positions = this._vertexPositions;\r\n vertexData.indices = this._indices;\r\n vertexData.uvs = this._uvs;\r\n if (computeNormals) {\r\n vertexData.normals = [];\r\n VertexData.ComputeNormals(this._vertexPositions, this._indices, vertexData.normals);\r\n }\r\n vertexData.applyToMesh(this, this._options.updatable);\r\n return vertexData;\r\n }\r\n\r\n protected _createOffsetsBuffer(offsets: number[]) {\r\n const engine = this._scene.getEngine();\r\n\r\n const offsetBuffer = new Buffer(engine, offsets, this._updatable, 3);\r\n this.setVerticesBuffer(offsetBuffer.createVertexBuffer(\"grl_offsets\", 0, 3));\r\n this._offsetsBuffer = offsetBuffer;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"greasedLineBaseMesh.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/GreasedLine/greasedLineBaseMesh.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,yBAAyB,EAAE,MAAM,uDAAuD,CAAC;AAClG,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAE9C,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,yBAAyB,EAAE,yCAAyC,EAAE,MAAM,uDAAuD,CAAC;AAG7I,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAE/D;;;GAGG;AACH,MAAM,CAAN,IAAkB,2BAGjB;AAHD,WAAkB,2BAA2B;IACzC,yGAAsB,CAAA;IACtB,uGAAqB,CAAA;AACzB,CAAC,EAHiB,2BAA2B,KAA3B,2BAA2B,QAG5C;AAED;;;;GAIG;AACH,MAAM,CAAN,IAAkB,0BAIjB;AAJD,WAAkB,0BAA0B;IACxC,iHAA2B,CAAA;IAC3B,yJAA+C,CAAA;IAC/C,iHAA2B,CAAA;AAC/B,CAAC,EAJiB,0BAA0B,KAA1B,0BAA0B,QAI3C;AAED;;;;;;;GAOG;AACH,MAAM,CAAN,IAAkB,kCAMjB;AAND,WAAkB,kCAAkC;IAChD,uJAAsC,CAAA;IACtC,qJAAqC,CAAA;IACrC,mIAA4B,CAAA;IAC5B,iIAA2B,CAAA;IAC3B,4HAAyB,CAAA;AAC7B,CAAC,EANiB,kCAAkC,KAAlC,kCAAkC,QAMnD;AAuGD;;GAEG;AACH,MAAM,OAAgB,mBAAoB,SAAQ,IAAI;IAkBlD,YAC6B,IAAY,EACrC,KAAY,EACF,QAAgC;QA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E,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;QACrE,IAAI,CAAC,iBAAiB,CAAC,YAAY,CAAC,kBAAkB,CAAC,aAAa,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAC7E,IAAI,CAAC,cAAc,GAAG,YAAY,CAAC;IACvC,CAAC;CACJ","sourcesContent":["import type { Scene } from \"../../scene\";\r\nimport type { IGreasedLineMaterial } from \"../../Materials/GreasedLine/greasedLineMaterialInterfaces\";\r\nimport { GreasedLinePluginMaterial } from \"../../Materials/GreasedLine/greasedLinePluginMaterial\";\r\nimport { Mesh } from \"../mesh\";\r\nimport { Buffer } from \"../../Buffers/buffer\";\r\nimport type { Vector3 } from \"../../Maths/math.vector\";\r\nimport { VertexData } from \"../mesh.vertexData\";\r\nimport { DeepCopier } from \"../../Misc/deepCopier\";\r\nimport { GreasedLineSimpleMaterial, GreasedLineUseOffsetsSimpleMaterialDefine } from \"../../Materials/GreasedLine/greasedLineSimpleMaterial\";\r\nimport type { AbstractEngine } from \"../../Engines/abstractEngine\";\r\nimport type { FloatArray, IndicesArray } from \"../../types\";\r\nimport { GreasedLineTools } from \"../../Misc/greasedLineTools\";\r\n\r\n/**\r\n * In POINTS_MODE_POINTS every array of points will become the center (backbone) of the ribbon. The ribbon will be expanded by `width / 2` to `+direction` and `-direction` as well.\r\n * In POINTS_MODE_PATHS every array of points specifies an edge. These will be used to build one ribbon.\r\n */\r\nexport const enum GreasedLineRibbonPointsMode {\r\n POINTS_MODE_POINTS = 0,\r\n POINTS_MODE_PATHS = 1,\r\n}\r\n\r\n/**\r\n * FACES_MODE_SINGLE_SIDED single sided with back face culling. Default value.\r\n * FACES_MODE_SINGLE_SIDED_NO_BACKFACE_CULLING single sided without back face culling. Sets backFaceCulling = false on the material so it affects all line ribbons added to the line ribbon instance.\r\n * FACES_MODE_DOUBLE_SIDED extra back faces are created. This doubles the amount of faces of the mesh.\r\n */\r\nexport const enum GreasedLineRibbonFacesMode {\r\n FACES_MODE_SINGLE_SIDED = 0,\r\n FACES_MODE_SINGLE_SIDED_NO_BACKFACE_CULLING = 1,\r\n FACES_MODE_DOUBLE_SIDED = 2,\r\n}\r\n\r\n/**\r\n * Only with POINTS_MODE_PATHS.\r\n * AUTO_DIRECTIONS_FROM_FIRST_SEGMENT sets the direction (slope) of the ribbon from the direction of the first line segment. Recommended.\r\n * AUTO_DIRECTIONS_FROM_ALL_SEGMENTS in this mode the direction (slope) will be calculated for each line segment according to the direction vector between each point of the line segments. Slow method.\r\n * AUTO_DIRECTIONS_ENHANCED in this mode the direction (slope) will be calculated for each line segment according to the direction vector between each point of the line segments using a more sophisitcaed algorithm. Slowest method.\r\n * AUTO_DIRECTIONS_FACE_TO in this mode the direction (slope) will be calculated for each line segment according to the direction vector between each point of the line segments and a direction (face-to) vector specified in direction. The resulting line will face to the direction of this face-to vector.\r\n * AUTO_DIRECTIONS_NONE you have to set the direction (slope) manually. Recommended.\r\n */\r\nexport const enum GreasedLineRibbonAutoDirectionMode {\r\n AUTO_DIRECTIONS_FROM_FIRST_SEGMENT = 0,\r\n AUTO_DIRECTIONS_FROM_ALL_SEGMENTS = 1,\r\n AUTO_DIRECTIONS_ENHANCED = 2,\r\n AUTO_DIRECTIONS_FACE_TO = 3,\r\n AUTO_DIRECTIONS_NONE = 99,\r\n}\r\n\r\nexport type GreasedLineRibbonOptions = {\r\n /**\r\n * Defines how the points are processed.\r\n * In GreasedLineRibbonPointsMode.POINTS_MODE_POINTS every array of points will become the center of the ribbon. The ribbon will be expanded by width/2 to +direction and -direction as well.\r\n * In GreasedLineRibbonPointsMode.POINTS_MODE_PATHS every array of points is one path. These will be used to buuid one ribbon.\r\n */\r\n pointsMode?: GreasedLineRibbonPointsMode;\r\n /**\r\n * Normalized directions of the slopes of the non camera facing lines.\r\n */\r\n directions?: Vector3[] | Vector3;\r\n /**\r\n * Defines the calculation mode of the directions which the line will be thickened to.\r\n */\r\n directionsAutoMode?: GreasedLineRibbonAutoDirectionMode;\r\n /**\r\n * Width of the ribbon.\r\n */\r\n width?: number;\r\n /**\r\n * Controls how the faces are created.\r\n * GreasedLineRibbonFacesMode.FACES_MODE_SINGLE_SIDED = single sided with back face culling. Default value.\r\n * GreasedLineRibbonFacesMode.FACES_MODE_SINGLE_SIDED_NO_BACKFACE_CULLING = single sided without back face culling\r\n * GreasedLineRibbonFacesMode.FACES_MODE_DOUBLE_SIDED = extra back faces are created. This doubles the amount of faces of the mesh.\r\n */\r\n facesMode?: GreasedLineRibbonFacesMode;\r\n /**\r\n * If true, the path will be closed.\r\n */\r\n closePath?: boolean;\r\n /**\r\n * If true, normals will be computed when creating the vertex buffers.\r\n * This results to smooth shading of the mesh.\r\n */\r\n smoothShading?: boolean;\r\n};\r\n\r\nexport type GreasedLinePoints = Vector3[] | Vector3[][] | Float32Array | Float32Array[] | number[][] | number[];\r\n\r\n/**\r\n * Options for converting the points to the internal number[][] format used by GreasedLine\r\n */\r\nexport interface GreasedLinePointsOptions {\r\n /**\r\n * If defined and a Float32Array is used for the points parameter,\r\n * it will create multiple disconnected lines.\r\n * This parameter defines how many entries from the array to use for one line.\r\n * One entry = 3 float values.\r\n */\r\n floatArrayStride?: number;\r\n}\r\n\r\n/**\r\n * Options for creating a GreasedLineMesh\r\n */\r\nexport interface GreasedLineMeshOptions {\r\n /**\r\n * Points of the line.\r\n */\r\n points: GreasedLinePoints;\r\n /**\r\n * Each line segment (from point to point) can have it's width multiplier. Final width = widths[segmentIdx] * width.\r\n * Defaults to empty array.\r\n */\r\n widths?: number[];\r\n /**\r\n * If instance is specified, lines are added to the specified instance.\r\n * Defaults to undefined.\r\n */\r\n instance?: GreasedLineBaseMesh;\r\n /**\r\n * You can manually set the color pointers so you can control which segment/part\r\n * will use which color from the colors material option\r\n */\r\n colorPointers?: number[];\r\n /**\r\n * UVs for the mesh\r\n */\r\n uvs?: FloatArray;\r\n /**\r\n * If true, offsets and widths are updatable.\r\n * Defaults to false.\r\n */\r\n updatable?: boolean;\r\n /**\r\n * Use when @see instance is specified.\r\n * If true, the line will be rendered only after calling instance.updateLazy(). If false, line will be rerendered after every call to @see CreateGreasedLine\r\n * Defaults to false.\r\n */\r\n lazy?: boolean;\r\n /**\r\n * The options for the ribbon which will be used as a line.\r\n * If this option is set the line switches automatically to a non camera facing mode.\r\n */\r\n ribbonOptions?: GreasedLineRibbonOptions;\r\n /**\r\n * Options for converting the points.\r\n */\r\n pointsOptions?: GreasedLinePointsOptions;\r\n}\r\n\r\n/**\r\n * GreasedLineBaseMesh\r\n */\r\nexport abstract class GreasedLineBaseMesh extends Mesh {\r\n protected _vertexPositions: FloatArray;\r\n protected _indices: IndicesArray;\r\n protected _uvs: FloatArray;\r\n protected _points: number[][];\r\n protected _offsets: number[];\r\n protected _colorPointers: number[];\r\n protected _widths: number[];\r\n\r\n protected _offsetsBuffer?: Buffer;\r\n protected _widthsBuffer?: Buffer;\r\n protected _colorPointersBuffer?: Buffer;\r\n\r\n protected _lazy = false;\r\n protected _updatable = false;\r\n\r\n protected _engine: AbstractEngine;\r\n\r\n constructor(\r\n public override readonly name: string,\r\n scene: Scene,\r\n protected _options: GreasedLineMeshOptions\r\n ) {\r\n super(name, scene, null, null, false, false);\r\n\r\n this._engine = scene.getEngine();\r\n\r\n this._lazy = _options.lazy ?? false;\r\n this._updatable = _options.updatable ?? false;\r\n\r\n this._vertexPositions = [];\r\n this._indices = [];\r\n this._uvs = [];\r\n this._points = [];\r\n this._colorPointers = _options.colorPointers ?? [];\r\n this._widths = _options.widths ?? new Array(_options.points.length).fill(1);\r\n }\r\n\r\n /**\r\n * \"GreasedLineMesh\"\r\n * @returns \"GreasedLineMesh\"\r\n */\r\n public override getClassName(): string {\r\n return \"GreasedLineMesh\";\r\n }\r\n\r\n protected abstract _setPoints(points: number[][], options?: GreasedLineMeshOptions): void;\r\n protected abstract _updateColorPointers(): void;\r\n protected abstract _updateWidths(): void;\r\n\r\n protected _updateWidthsWithValue(defaulValue: number) {\r\n let pointCount = 0;\r\n for (const points of this._points) {\r\n pointCount += points.length;\r\n }\r\n const countDiff = (pointCount / 3) * 2 - this._widths.length;\r\n for (let i = 0; i < countDiff; i++) {\r\n this._widths.push(defaulValue);\r\n }\r\n }\r\n\r\n /**\r\n * Updated a lazy line. Rerenders the line and updates boundinfo as well.\r\n */\r\n public updateLazy() {\r\n this._setPoints(this._points);\r\n if (!this._options.colorPointers) {\r\n this._updateColorPointers();\r\n }\r\n this._createVertexBuffers(this._options.ribbonOptions?.smoothShading);\r\n !this.doNotSyncBoundingInfo && this.refreshBoundingInfo();\r\n\r\n this.greasedLineMaterial?.updateLazy();\r\n }\r\n\r\n /**\r\n * Adds new points to the line. It doesn't rerenders the line if in lazy mode.\r\n * @param points points table\r\n * @param options optional options\r\n */\r\n public addPoints(points: number[][], options?: GreasedLineMeshOptions) {\r\n for (const p of points) {\r\n this._points.push(p);\r\n }\r\n\r\n if (!this._lazy) {\r\n this.setPoints(this._points, options);\r\n }\r\n }\r\n\r\n /**\r\n * Dispose the line and it's resources\r\n * @param doNotRecurse Set to true to not recurse into each children (recurse into each children by default)\r\n * @param disposeMaterialAndTextures Set to true to also dispose referenced materials and textures (false by default)\r\n */\r\n public override dispose(doNotRecurse?: boolean, disposeMaterialAndTextures = false) {\r\n super.dispose(doNotRecurse, disposeMaterialAndTextures);\r\n }\r\n\r\n /**\r\n * @returns true if the mesh was created in lazy mode\r\n */\r\n public isLazy(): boolean {\r\n return this._lazy;\r\n }\r\n\r\n /**\r\n * Returns the UVs\r\n */\r\n get uvs() {\r\n return this._uvs;\r\n }\r\n\r\n /**\r\n * Sets the UVs\r\n * @param uvs the UVs\r\n */\r\n set uvs(uvs: FloatArray) {\r\n this._uvs = uvs instanceof Float32Array ? uvs : new Float32Array(uvs);\r\n this._createVertexBuffers();\r\n }\r\n\r\n /**\r\n * Returns the points offsets\r\n * Return the points offsets\r\n */\r\n get offsets() {\r\n return this._offsets;\r\n }\r\n\r\n /**\r\n * Sets point offests\r\n * @param offsets offset table [x,y,z, x,y,z, ....]\r\n */\r\n set offsets(offsets: number[]) {\r\n if (this.material instanceof GreasedLineSimpleMaterial) {\r\n this.material.setDefine(GreasedLineUseOffsetsSimpleMaterialDefine, offsets?.length > 0);\r\n }\r\n this._offsets = offsets;\r\n if (!this._offsetsBuffer) {\r\n this._createOffsetsBuffer(offsets);\r\n } else {\r\n this._offsetsBuffer.update(offsets);\r\n }\r\n }\r\n\r\n /**\r\n * Gets widths at each line point like [widthLower, widthUpper, widthLower, widthUpper, ...]\r\n */\r\n get widths() {\r\n return this._widths;\r\n }\r\n\r\n /**\r\n * Sets widths at each line point\r\n * @param widths width table [widthLower, widthUpper, widthLower, widthUpper ...]\r\n */\r\n set widths(widths: number[]) {\r\n this._widths = widths;\r\n if (!this._lazy) {\r\n this._widthsBuffer && this._widthsBuffer.update(widths);\r\n }\r\n }\r\n\r\n /**\r\n * Gets the color pointer. Each vertex need a color pointer. These color pointers points to the colors in the color table @see colors\r\n */\r\n get colorPointers() {\r\n return this._colorPointers;\r\n }\r\n\r\n /**\r\n * Sets the color pointer\r\n * @param colorPointers array of color pointer in the colors array. One pointer for every vertex is needed.\r\n */\r\n set colorPointers(colorPointers: number[]) {\r\n this._colorPointers = colorPointers;\r\n if (!this._lazy) {\r\n this._colorPointersBuffer && this._colorPointersBuffer.update(colorPointers);\r\n }\r\n }\r\n\r\n /**\r\n * Gets the pluginMaterial associated with line\r\n */\r\n get greasedLineMaterial(): IGreasedLineMaterial | undefined {\r\n if (this.material && this.material instanceof GreasedLineSimpleMaterial) {\r\n return this.material;\r\n }\r\n const materialPlugin = this.material?.pluginManager?.getPlugin(GreasedLinePluginMaterial.GREASED_LINE_MATERIAL_NAME);\r\n if (materialPlugin) {\r\n return <GreasedLinePluginMaterial>materialPlugin;\r\n }\r\n return;\r\n }\r\n\r\n /**\r\n * Return copy the points.\r\n */\r\n get points() {\r\n const pointsCopy: number[][] = [];\r\n DeepCopier.DeepCopy(this._points, pointsCopy);\r\n return pointsCopy;\r\n }\r\n\r\n /**\r\n * Sets line points and rerenders the line.\r\n * @param points points table\r\n * @param options optional options\r\n */\r\n public setPoints(points: GreasedLinePoints, options?: GreasedLineMeshOptions) {\r\n this._points = GreasedLineTools.ConvertPoints(points, options?.pointsOptions ?? this._options.pointsOptions);\r\n this._updateWidths();\r\n if (!options?.colorPointers) {\r\n this._updateColorPointers();\r\n }\r\n this._setPoints(this._points, options);\r\n }\r\n\r\n protected _initGreasedLine() {\r\n this._vertexPositions = [];\r\n this._indices = [];\r\n this._uvs = [];\r\n }\r\n\r\n protected _createLineOptions() {\r\n const lineOptions: GreasedLineMeshOptions = {\r\n points: this._points,\r\n colorPointers: this._colorPointers,\r\n lazy: this._lazy,\r\n updatable: this._updatable,\r\n uvs: this._uvs,\r\n widths: this._widths,\r\n ribbonOptions: this._options.ribbonOptions,\r\n };\r\n return lineOptions;\r\n }\r\n\r\n /**\r\n * Serializes this GreasedLineMesh\r\n * @param serializationObject object to write serialization to\r\n */\r\n public override serialize(serializationObject: any): void {\r\n super.serialize(serializationObject);\r\n serializationObject.type = this.getClassName();\r\n\r\n serializationObject.lineOptions = this._createLineOptions();\r\n }\r\n\r\n protected _createVertexBuffers(computeNormals = false) {\r\n const vertexData = new VertexData();\r\n vertexData.positions = this._vertexPositions;\r\n vertexData.indices = this._indices;\r\n vertexData.uvs = this._uvs;\r\n if (computeNormals) {\r\n vertexData.normals = [];\r\n VertexData.ComputeNormals(this._vertexPositions, this._indices, vertexData.normals);\r\n }\r\n vertexData.applyToMesh(this, this._options.updatable);\r\n return vertexData;\r\n }\r\n\r\n protected _createOffsetsBuffer(offsets: number[]) {\r\n const engine = this._scene.getEngine();\r\n\r\n const offsetBuffer = new Buffer(engine, offsets, this._updatable, 3);\r\n this.setVerticesBuffer(offsetBuffer.createVertexBuffer(\"grl_offsets\", 0, 3));\r\n this._offsetsBuffer = offsetBuffer;\r\n }\r\n}\r\n"]}
|
|
@@ -166,7 +166,7 @@ export class GreasedLineRibbonMesh extends GreasedLineBaseMesh {
|
|
|
166
166
|
}
|
|
167
167
|
}
|
|
168
168
|
const v = [1, 0, numOfPaths];
|
|
169
|
-
const doubleSided = options.ribbonOptions?.facesMode === 2 /* GreasedLineRibbonFacesMode.FACES_MODE_DOUBLE_SIDED
|
|
169
|
+
const doubleSided = options.ribbonOptions?.facesMode === 2 /* GreasedLineRibbonFacesMode.FACES_MODE_DOUBLE_SIDED */;
|
|
170
170
|
const closePath = options.ribbonOptions?.pointsMode === 1 /* GreasedLineRibbonPointsMode.POINTS_MODE_PATHS */ && options.ribbonOptions.closePath;
|
|
171
171
|
if (numOfPaths > 2) {
|
|
172
172
|
for (let i = 0; i < path.length - 1; i++) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"greasedLineRibbonMesh.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/GreasedLine/greasedLineRibbonMesh.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAC1E,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAG9C,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAE/D,OAAO,EAAE,mBAAmB,EAA+F,MAAM,uBAAuB,CAAC;AAGzJ,IAAI,CAAC,4BAA4B,GAAG,CAAC,UAAe,EAAE,KAAY,EAAQ,EAAE;IACxE,OAAO,qBAAqB,CAAC,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;AAC1D,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,OAAO,qBAAsB,SAAQ,mBAAmB;IAkC1D;;;;;;OAMG;IACH,YAC6B,IAAY,EACrC,KAAY,EACZ,QAAgC,EAChC,YAAuE;QAEvE,KAAK,CAAC,IAAI,EAAE,KAAK,E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,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAC5E,IAAI,CAAC,aAAa,GAAG,YAAY,CAAC;QAElC,OAAO,UAAU,CAAC;IACtB,CAAC;;AAziBD;;GAEG;AACW,mCAAa,GAAG,GAAG,CAAC;AAEnB,2DAAqC,GAAG,UAAU,CAAC,YAAY,CAAC,OAAO,CAAC,0BAA0B,EAAE,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;AACjH,0DAAoC,GAAG,UAAU,CAAC,YAAY,CAAC,OAAO,CAAC,yBAAyB,EAAE,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;AAC/G,6CAAuB,GAAG,UAAU,CAAC,YAAY,CAAC,OAAO,CAAC,YAAY,EAAE,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;AAEpG;;GAEG;AACW,kCAAY,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAC,2DAA2D;AAC3H;;GAEG;AACW,kCAAY,GAAG,OAAO,CAAC,UAAU,CAAC;AAChD;;GAEG;AACW,kCAAY,GAAG,OAAO,CAAC,YAAY,CAAC","sourcesContent":["import type { Scene } from \"../../scene\";\r\nimport { Quaternion, TmpVectors, Vector3 } from \"../../Maths/math.vector\";\r\nimport { Mesh } from \"../mesh\";\r\nimport { Buffer } from \"../../Buffers/buffer\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { Node } from \"../../node\";\r\nimport { DeepCopier } from \"../../Misc/deepCopier\";\r\nimport { GreasedLineTools } from \"../../Misc/greasedLineTools\";\r\nimport type { GreasedLineMeshOptions, GreasedLineRibbonOptions } from \"./greasedLineBaseMesh\";\r\nimport { GreasedLineBaseMesh, GreasedLineRibbonAutoDirectionMode, GreasedLineRibbonFacesMode, GreasedLineRibbonPointsMode } from \"./greasedLineBaseMesh\";\r\nimport type { VertexData } from \"../mesh.vertexData\";\r\n\r\nMesh._GreasedLineRibbonMeshParser = (parsedMesh: any, scene: Scene): Mesh => {\r\n return GreasedLineRibbonMesh.Parse(parsedMesh, scene);\r\n};\r\n\r\n/**\r\n * GreasedLineRibbonMesh\r\n * Use the GreasedLineBuilder.CreateGreasedLine function to create an instance of this class.\r\n */\r\nexport class GreasedLineRibbonMesh extends GreasedLineBaseMesh {\r\n /**\r\n * Default line width\r\n */\r\n public static DEFAULT_WIDTH = 0.1;\r\n\r\n private static _RightHandedForwardReadOnlyQuaternion = Quaternion.RotationAxis(Vector3.RightHandedForwardReadOnly, Math.PI / 2);\r\n private static _LeftHandedForwardReadOnlyQuaternion = Quaternion.RotationAxis(Vector3.LeftHandedForwardReadOnly, Math.PI / 2);\r\n private static _LeftReadOnlyQuaternion = Quaternion.RotationAxis(Vector3.LeftReadOnly, Math.PI / 2);\r\n\r\n /**\r\n * Direction which the line segment will be thickened if drawn on the XY plane\r\n */\r\n public static DIRECTION_XY = Vector3.LeftHandedForwardReadOnly; // doesn't matter in which handed system the scene operates\r\n /**\r\n * Direction which the line segment will be thickened if drawn on the XZ plane\r\n */\r\n public static DIRECTION_XZ = Vector3.UpReadOnly;\r\n /**\r\n * Direction which the line segment will be thickened if drawn on the YZ plane\r\n */\r\n public static DIRECTION_YZ = Vector3.LeftReadOnly;\r\n\r\n private _paths: Vector3[][];\r\n private _pathsOptions: { options: GreasedLineMeshOptions; pathCount: number }[];\r\n private _vSegmentLengths: number[][];\r\n private _uSegmentLengths: number[][];\r\n private _vTotalLengths: number[];\r\n private _uTotalLengths: number[];\r\n\r\n private _counters: number[];\r\n private _slopes: number[];\r\n private _ribbonWidths: number[];\r\n\r\n /**\r\n * GreasedLineRibbonMesh\r\n * @param name name of the mesh\r\n * @param scene the scene\r\n * @param _options mesh options\r\n * @param _pathOptions used internaly when parsing a serialized GreasedLineRibbonMesh\r\n */\r\n constructor(\r\n public override readonly name: string,\r\n scene: Scene,\r\n _options: GreasedLineMeshOptions,\r\n _pathOptions?: { options: GreasedLineMeshOptions; pathCount: number }[]\r\n ) {\r\n super(name, scene, _options);\r\n\r\n if (!_options.ribbonOptions) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"'GreasedLineMeshOptions.ribbonOptions' is not set.\";\r\n }\r\n\r\n this._paths = [];\r\n this._counters = [];\r\n this._slopes = [];\r\n this._widths = _options.widths ?? [];\r\n this._ribbonWidths = [];\r\n this._pathsOptions = _pathOptions ?? [];\r\n\r\n if (_options.points) {\r\n this.addPoints(GreasedLineTools.ConvertPoints(_options.points), _options, !!_pathOptions);\r\n }\r\n }\r\n\r\n /**\r\n * Adds new points to the line. It doesn't rerenders the line if in lazy mode.\r\n * @param points points table\r\n * @param options mesh options\r\n * @param hasPathOptions defaults to false\r\n */\r\n public override addPoints(points: number[][], options: GreasedLineMeshOptions, hasPathOptions = false) {\r\n if (!options.ribbonOptions) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"addPoints() on GreasedLineRibbonMesh instance requires 'GreasedLineMeshOptions.ribbonOptions'.\";\r\n }\r\n\r\n if (!hasPathOptions) {\r\n this._pathsOptions.push({ options, pathCount: points.length });\r\n }\r\n\r\n super.addPoints(points, options);\r\n }\r\n\r\n /**\r\n * \"GreasedLineRibbonMesh\"\r\n * @returns \"GreasedLineRibbonMesh\"\r\n */\r\n public override getClassName(): string {\r\n return \"GreasedLineRibbonMesh\";\r\n }\r\n\r\n /**\r\n * Return true if the line was created from two edge paths or one points path.\r\n * In this case the line is always flat.\r\n */\r\n public get isFlatLine() {\r\n return this._paths.length < 3;\r\n }\r\n\r\n /**\r\n * Returns the slopes of the line at each point relative to the center of the line\r\n */\r\n get slopes() {\r\n return this._slopes;\r\n }\r\n\r\n /**\r\n * Set the slopes of the line at each point relative to the center of the line\r\n */\r\n set slopes(slopes: number[]) {\r\n this._slopes = slopes;\r\n }\r\n\r\n protected _updateColorPointers() {\r\n if (this._options.colorPointers) {\r\n return;\r\n }\r\n\r\n let colorPointer = 0;\r\n this._colorPointers = [];\r\n for (let i = 0; i < this._pathsOptions.length; i++) {\r\n const { options: pathOptions, pathCount } = this._pathsOptions[i];\r\n const points = this._points[i];\r\n\r\n if (pathOptions.ribbonOptions!.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_POINTS) {\r\n for (let k = 0; k < pathCount; k++) {\r\n for (let j = 0; j < points.length; j += 3) {\r\n this._colorPointers.push(colorPointer);\r\n this._colorPointers.push(colorPointer++);\r\n }\r\n }\r\n } else {\r\n for (let j = 0; j < points.length; j += 3) {\r\n for (let k = 0; k < pathCount; k++) {\r\n this._colorPointers.push(colorPointer);\r\n }\r\n colorPointer++;\r\n }\r\n }\r\n }\r\n }\r\n\r\n protected _updateWidths(): void {\r\n super._updateWidthsWithValue(1);\r\n }\r\n\r\n protected _setPoints(points: number[][], _options: GreasedLineMeshOptions) {\r\n if (!this._options.ribbonOptions) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"No 'GreasedLineMeshOptions.ribbonOptions' provided.\";\r\n }\r\n this._points = points;\r\n this._options.points = points;\r\n\r\n this._initGreasedLine();\r\n\r\n let indiceOffset = 0;\r\n let directionPlanes: Vector3[];\r\n for (let i = 0, c = 0; i < this._pathsOptions.length; i++) {\r\n const { options: pathOptions, pathCount } = this._pathsOptions[i];\r\n const subPoints = points.slice(c, c + pathCount);\r\n c += pathCount;\r\n if (pathOptions.ribbonOptions?.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_PATHS) {\r\n indiceOffset = this._preprocess(GreasedLineTools.ToVector3Array(subPoints) as Vector3[][], indiceOffset, pathOptions);\r\n } else {\r\n if (pathOptions.ribbonOptions?.directionsAutoMode === GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_NONE) {\r\n if (!pathOptions.ribbonOptions!.directions) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"In GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_NONE 'GreasedLineMeshOptions.ribbonOptions.directions' must be defined.\";\r\n }\r\n directionPlanes = GreasedLineRibbonMesh._GetDirectionPlanesFromDirectionsOption(subPoints.length, pathOptions.ribbonOptions!.directions);\r\n }\r\n subPoints.forEach((p, idx) => {\r\n const pathArray = GreasedLineRibbonMesh._ConvertToRibbonPath(\r\n p,\r\n pathOptions.ribbonOptions!,\r\n this._scene.useRightHandedSystem,\r\n directionPlanes ? directionPlanes[idx] : directionPlanes\r\n );\r\n indiceOffset = this._preprocess(pathArray, indiceOffset, pathOptions);\r\n });\r\n }\r\n }\r\n\r\n if (!this._lazy) {\r\n this._createVertexBuffers();\r\n !this.doNotSyncBoundingInfo && this.refreshBoundingInfo();\r\n }\r\n }\r\n\r\n private static _GetDirectionPlanesFromDirectionsOption(count: number, directions: Vector3 | Vector3[]) {\r\n if (Array.isArray(directions)) {\r\n return directions;\r\n }\r\n\r\n return new Array(count).fill(directions) as Vector3[];\r\n }\r\n\r\n private static _CreateRibbonVertexData(pathArray: Vector3[][], options: GreasedLineMeshOptions) {\r\n const numOfPaths = pathArray.length;\r\n if (numOfPaths < 2) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"Minimum of two paths are required to create a GreasedLineRibbonMesh.\";\r\n }\r\n\r\n const positions = [];\r\n const indices = [];\r\n\r\n const path = pathArray[0];\r\n for (let i = 0; i < path.length; i++) {\r\n for (let pi = 0; pi < pathArray.length; pi++) {\r\n const v = pathArray[pi][i];\r\n positions.push(v.x, v.y, v.z);\r\n }\r\n }\r\n\r\n const v: number[] = [1, 0, numOfPaths];\r\n const doubleSided = options.ribbonOptions?.facesMode === GreasedLineRibbonFacesMode.FACES_MODE_DOUBLE_SIDED ?? false;\r\n\r\n const closePath = options.ribbonOptions?.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_PATHS && options.ribbonOptions.closePath;\r\n if (numOfPaths > 2) {\r\n for (let i = 0; i < path.length - 1; i++) {\r\n v[0] = 1 + numOfPaths * i;\r\n v[1] = numOfPaths * i;\r\n v[2] = (i + 1) * numOfPaths;\r\n for (let pi = 0; pi < (numOfPaths - 1) * 2; pi++) {\r\n if (pi % 2 !== 0) {\r\n v[2] += 1;\r\n }\r\n if (pi % 2 === 0 && pi > 0) {\r\n v[0] += 1;\r\n v[1] += 1;\r\n }\r\n indices.push(v[1] + (pi % 2 !== 0 ? numOfPaths : 0), v[0], v[2]);\r\n if (doubleSided) {\r\n indices.push(v[0], v[1] + (pi % 2 !== 0 ? numOfPaths : 0), v[2]);\r\n }\r\n }\r\n }\r\n } else {\r\n for (let i = 0; i < positions.length / 3 - 3; i += 2) {\r\n indices.push(i, i + 1, i + 2);\r\n indices.push(i + 2, i + 1, i + 3);\r\n if (doubleSided) {\r\n indices.push(i + 1, i, i + 2);\r\n indices.push(i + 1, i + 2, i + 3);\r\n }\r\n }\r\n }\r\n if (closePath) {\r\n let lastIndice = numOfPaths * (path.length - 1);\r\n for (let pi = 0; pi < numOfPaths - 1; pi++) {\r\n indices.push(lastIndice, pi + 1, pi);\r\n indices.push(lastIndice + 1, pi + 1, lastIndice);\r\n if (doubleSided) {\r\n indices.push(pi, pi + 1, lastIndice);\r\n indices.push(lastIndice, pi + 1, lastIndice + 1);\r\n }\r\n lastIndice++;\r\n }\r\n }\r\n\r\n return {\r\n positions,\r\n indices,\r\n };\r\n }\r\n\r\n private _preprocess(pathArray: Vector3[][], indiceOffset: number, options: GreasedLineMeshOptions) {\r\n this._paths = pathArray;\r\n\r\n const ribbonVertexData = GreasedLineRibbonMesh._CreateRibbonVertexData(pathArray, options);\r\n\r\n const positions = ribbonVertexData.positions;\r\n\r\n if (!this._options.widths) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"No 'GreasedLineMeshOptions.widths' table is specified.\";\r\n }\r\n\r\n const vertexPositions = Array.isArray(this._vertexPositions) ? this._vertexPositions : Array.from(this._vertexPositions);\r\n this._vertexPositions = vertexPositions;\r\n const uvs = Array.isArray(this._uvs) ? this._uvs : Array.from(this._uvs);\r\n this._uvs = uvs;\r\n const indices = Array.isArray(this._indices) ? this._indices : Array.from(this._indices);\r\n this._indices = indices;\r\n\r\n for (const p of positions) {\r\n vertexPositions.push(p);\r\n }\r\n\r\n let pathArrayCopy = pathArray;\r\n if (options.ribbonOptions?.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_PATHS && options.ribbonOptions.closePath) {\r\n pathArrayCopy = [];\r\n for (let i = 0; i < pathArray.length; i++) {\r\n const pathCopy = pathArray[i].slice();\r\n pathCopy.push(pathArray[i][0].clone());\r\n pathArrayCopy.push(pathCopy);\r\n }\r\n }\r\n\r\n this._calculateSegmentLengths(pathArrayCopy);\r\n\r\n const pathArrayLength = pathArrayCopy.length;\r\n const previousCounters = new Array(pathArrayLength).fill(0);\r\n for (let i = 0; i < pathArrayCopy[0].length; i++) {\r\n let v = 0;\r\n for (let pi = 0; pi < pathArrayLength; pi++) {\r\n const counter = previousCounters[pi] + this._vSegmentLengths[pi][i] / this._vTotalLengths[pi];\r\n this._counters.push(counter);\r\n uvs.push(counter, v);\r\n\r\n previousCounters[pi] = counter;\r\n v += this._uSegmentLengths[i][pi] / this._uTotalLengths[i];\r\n }\r\n }\r\n\r\n for (let i = 0, c = 0; i < pathArrayCopy[0].length; i++) {\r\n const widthLower = this._uSegmentLengths[i][0] / 2;\r\n const widthUpper = this._uSegmentLengths[i][pathArrayLength - 1] / 2;\r\n this._ribbonWidths.push(((this._widths[c++] ?? 1) - 1) * widthLower);\r\n for (let pi = 0; pi < pathArrayLength - 2; pi++) {\r\n this._ribbonWidths.push(0);\r\n }\r\n this._ribbonWidths.push(((this._widths[c++] ?? 1) - 1) * widthUpper);\r\n }\r\n\r\n const slopes =\r\n options.ribbonOptions?.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_PATHS\r\n ? new Array(pathArrayCopy[0].length * pathArrayCopy.length * 6).fill(0)\r\n : GreasedLineRibbonMesh._CalculateSlopes(pathArrayCopy);\r\n for (const s of slopes) {\r\n this._slopes.push(s);\r\n }\r\n\r\n if (ribbonVertexData.indices) {\r\n for (let i = 0; i < ribbonVertexData.indices.length; i++) {\r\n indices.push(ribbonVertexData.indices[i] + indiceOffset);\r\n }\r\n }\r\n indiceOffset += positions.length / 3;\r\n\r\n return indiceOffset;\r\n }\r\n\r\n private static _ConvertToRibbonPath(points: number[], ribbonInfo: GreasedLineRibbonOptions, rightHandedSystem: boolean, directionPlane?: Vector3) {\r\n if (ribbonInfo.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_POINTS && !ribbonInfo.width) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"'GreasedLineMeshOptions.ribbonOptiosn.width' must be specified in GreasedLineRibbonPointsMode.POINTS_MODE_POINTS.\";\r\n }\r\n const path1 = [];\r\n const path2 = [];\r\n if (ribbonInfo.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_POINTS) {\r\n const width = ribbonInfo.width! / 2;\r\n const pointVectors = GreasedLineTools.ToVector3Array(points) as Vector3[];\r\n let direction: Nullable<Vector3> = null;\r\n let fatDirection: Nullable<Vector3> = null;\r\n\r\n if (ribbonInfo.directionsAutoMode === GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_FROM_FIRST_SEGMENT) {\r\n // set the direction plane from the first line segment for the whole line\r\n directionPlane = GreasedLineRibbonMesh._GetDirectionFromPoints(pointVectors[0], pointVectors[1], null);\r\n }\r\n\r\n if (ribbonInfo.directionsAutoMode === GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_FACE_TO && !(ribbonInfo.directions instanceof Vector3)) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"In GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_FACE_TO 'GreasedLineMeshOptions.ribbonOptions.directions' must be a Vector3.\";\r\n }\r\n\r\n TmpVectors.Vector3[1] = ribbonInfo.directions instanceof Vector3 ? ribbonInfo.directions : GreasedLineRibbonMesh.DIRECTION_XZ;\r\n for (let i = 0; i < pointVectors.length - (directionPlane ? 0 : 1); i++) {\r\n const p1 = pointVectors[i];\r\n const p2 = pointVectors[i + 1];\r\n\r\n if (directionPlane) {\r\n direction = <Vector3>directionPlane;\r\n } else if (ribbonInfo.directionsAutoMode === GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_FACE_TO) {\r\n p2.subtractToRef(p1, TmpVectors.Vector3[0]);\r\n direction = Vector3.CrossToRef(TmpVectors.Vector3[0], TmpVectors.Vector3[1], TmpVectors.Vector3[2]).normalize();\r\n } else if (ribbonInfo.directionsAutoMode === GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_FROM_ALL_SEGMENTS) {\r\n direction = GreasedLineRibbonMesh._GetDirectionFromPoints(p1, p2, direction);\r\n } else {\r\n // GreasedLineRibbonAutoDirectionMode.DIRECTION_ENHANCED\r\n const directionTemp = p2.subtract(p1);\r\n directionTemp.applyRotationQuaternionInPlace(\r\n directionTemp.x > directionTemp.y && directionTemp.x > directionTemp.z\r\n ? rightHandedSystem\r\n ? GreasedLineRibbonMesh._RightHandedForwardReadOnlyQuaternion\r\n : GreasedLineRibbonMesh._LeftHandedForwardReadOnlyQuaternion\r\n : GreasedLineRibbonMesh._LeftReadOnlyQuaternion\r\n );\r\n direction = directionTemp.normalize();\r\n }\r\n\r\n fatDirection = direction.multiplyByFloats(width, width, width);\r\n path1.push(p1.add(fatDirection));\r\n path2.push(p1.subtract(fatDirection));\r\n }\r\n if (!directionPlane) {\r\n path1.push(pointVectors[pointVectors.length - 1].add(fatDirection!));\r\n path2.push(pointVectors[pointVectors.length - 1].subtract(fatDirection!));\r\n }\r\n }\r\n return [path1, path2];\r\n }\r\n\r\n private static _GetDirectionFromPoints(p1: Vector3, p2: Vector3, previousDirection: Nullable<Vector3>) {\r\n // handle straight lines\r\n if (p1.x === p2.x && (!previousDirection || previousDirection?.x === 1)) {\r\n return GreasedLineRibbonMesh.DIRECTION_YZ;\r\n }\r\n\r\n if (p1.y === p2.y) {\r\n return GreasedLineRibbonMesh.DIRECTION_XZ;\r\n }\r\n\r\n if (p1.z === p2.z) {\r\n return GreasedLineRibbonMesh.DIRECTION_XY;\r\n }\r\n\r\n return GreasedLineRibbonMesh.DIRECTION_XZ;\r\n }\r\n\r\n /**\r\n * Clones the GreasedLineRibbonMesh.\r\n * @param name new line name\r\n * @param newParent new parent node\r\n * @returns cloned line\r\n */\r\n public override clone(name: string = `${this.name}-cloned`, newParent?: Nullable<Node>) {\r\n const lineOptions = this._createLineOptions();\r\n const deepCopiedLineOptions: any = {};\r\n const pathOptionsCloned: any = [];\r\n DeepCopier.DeepCopy(this._pathsOptions, pathOptionsCloned, undefined, undefined, true);\r\n DeepCopier.DeepCopy(lineOptions, deepCopiedLineOptions, [\"instance\"], undefined, true);\r\n\r\n const cloned = new GreasedLineRibbonMesh(name, this._scene, <GreasedLineMeshOptions>deepCopiedLineOptions, pathOptionsCloned);\r\n if (newParent) {\r\n cloned.parent = newParent;\r\n }\r\n\r\n cloned.material = this.material;\r\n\r\n return cloned;\r\n }\r\n\r\n /**\r\n * Serializes this GreasedLineRibbonMesh\r\n * @param serializationObject object to write serialization to\r\n */\r\n public override serialize(serializationObject: any): void {\r\n super.serialize(serializationObject);\r\n serializationObject.type = this.getClassName();\r\n\r\n serializationObject.lineOptions = this._createLineOptions();\r\n serializationObject.pathsOptions = this._pathsOptions;\r\n }\r\n\r\n /**\r\n * Parses a serialized GreasedLineRibbonMesh\r\n * @param parsedMesh the serialized GreasedLineRibbonMesh\r\n * @param scene the scene to create the GreasedLineRibbonMesh in\r\n * @returns the created GreasedLineRibbonMesh\r\n */\r\n public static override Parse(parsedMesh: any, scene: Scene): Mesh {\r\n const lineOptions = <GreasedLineMeshOptions>parsedMesh.lineOptions;\r\n const name = <string>parsedMesh.name;\r\n const pathOptions = parsedMesh.pathOptions;\r\n const result = new GreasedLineRibbonMesh(name, scene, lineOptions, pathOptions);\r\n return result;\r\n }\r\n\r\n protected override _initGreasedLine() {\r\n super._initGreasedLine();\r\n\r\n this._paths = [];\r\n this._counters = [];\r\n this._slopes = [];\r\n this._ribbonWidths = [];\r\n }\r\n\r\n private _calculateSegmentLengths(pathArray: Vector3[][]) {\r\n const pathArrayLength = pathArray.length;\r\n this._vSegmentLengths = new Array(pathArrayLength);\r\n this._vTotalLengths = new Array(pathArrayLength);\r\n let length = 0;\r\n for (let pi = 0; pi < pathArrayLength; pi++) {\r\n const points = pathArray[pi];\r\n this._vSegmentLengths[pi] = [0]; // first point has 0 distance\r\n length = 0;\r\n for (let i = 0; i < points.length - 1; i++) {\r\n const l = Math.abs(points[i].subtract(points[i + 1]).lengthSquared()); // it's ok to have lengthSquared() here\r\n length += l;\r\n this._vSegmentLengths[pi].push(l);\r\n }\r\n this._vTotalLengths[pi] = length;\r\n }\r\n\r\n const positionsLength = pathArray[0].length;\r\n this._uSegmentLengths = new Array(positionsLength).fill([]);\r\n this._uTotalLengths = new Array(positionsLength).fill([]);\r\n const uLength = new Vector3();\r\n for (let i = 0; i < positionsLength; i++) {\r\n length = 0;\r\n for (let pi = 1; pi < pathArrayLength; pi++) {\r\n pathArray[pi][i].subtractToRef(pathArray[pi - 1][i], uLength);\r\n const l = uLength.length(); // must be length()\r\n length += l;\r\n this._uSegmentLengths[i].push(l);\r\n }\r\n this._uTotalLengths[i] = length;\r\n }\r\n }\r\n\r\n private static _CalculateSlopes(paths: Vector3[][]) {\r\n const points1 = paths[0];\r\n const points2 = paths.length === 2 ? paths[1] : paths[paths.length - 1];\r\n const slopes: number[] = [];\r\n\r\n const slope = new Vector3();\r\n for (let i = 0; i < points1.length; i++) {\r\n for (let pi = 0; pi < paths.length; pi++) {\r\n if (pi === 0 || pi === paths.length - 1) {\r\n points1[i].subtract(points2[i]).normalizeToRef(slope);\r\n slopes.push(slope.x, slope.y, slope.z);\r\n slopes.push(-slope.x, -slope.y, -slope.z);\r\n } else {\r\n slopes.push(0, 0, 0, 0, 0, 0);\r\n }\r\n }\r\n }\r\n\r\n return slopes;\r\n }\r\n\r\n protected override _createVertexBuffers(): VertexData {\r\n this._uvs = this._options.uvs ?? this._uvs;\r\n const vertexData = super._createVertexBuffers(this._options.ribbonOptions?.smoothShading);\r\n\r\n const countersBuffer = new Buffer(this._engine, this._counters, this._updatable, 1);\r\n this.setVerticesBuffer(countersBuffer.createVertexBuffer(\"grl_counters\", 0, 1));\r\n\r\n const colorPointersBuffer = new Buffer(this._engine, this._colorPointers, this._updatable, 1);\r\n this.setVerticesBuffer(colorPointersBuffer.createVertexBuffer(\"grl_colorPointers\", 0, 1));\r\n\r\n const slopesBuffer = new Buffer(this._engine, this._slopes, this._updatable, 3);\r\n this.setVerticesBuffer(slopesBuffer.createVertexBuffer(\"grl_slopes\", 0, 3));\r\n\r\n const widthsBuffer = new Buffer(this._engine, this._ribbonWidths, this._updatable, 1);\r\n this.setVerticesBuffer(widthsBuffer.createVertexBuffer(\"grl_widths\", 0, 1));\r\n this._widthsBuffer = widthsBuffer;\r\n\r\n return vertexData;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"greasedLineRibbonMesh.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/GreasedLine/greasedLineRibbonMesh.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAC1E,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAG9C,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAE/D,OAAO,EAAE,mBAAmB,EAA+F,MAAM,uBAAuB,CAAC;AAGzJ,IAAI,CAAC,4BAA4B,GAAG,CAAC,UAAe,EAAE,KAAY,EAAQ,EAAE;IACxE,OAAO,qBAAqB,CAAC,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;AAC1D,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,OAAO,qBAAsB,SAAQ,mBAAmB;IAkC1D;;;;;;OAMG;IACH,YAC6B,IAAY,EACrC,KAAY,EACZ,QAAgC,EAChC,YAAuE;QAEvE,KAAK,CAA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YAAY,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAC5E,IAAI,CAAC,aAAa,GAAG,YAAY,CAAC;QAElC,OAAO,UAAU,CAAC;IACtB,CAAC;;AAziBD;;GAEG;AACW,mCAAa,GAAG,GAAG,CAAC;AAEnB,2DAAqC,GAAG,UAAU,CAAC,YAAY,CAAC,OAAO,CAAC,0BAA0B,EAAE,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;AACjH,0DAAoC,GAAG,UAAU,CAAC,YAAY,CAAC,OAAO,CAAC,yBAAyB,EAAE,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;AAC/G,6CAAuB,GAAG,UAAU,CAAC,YAAY,CAAC,OAAO,CAAC,YAAY,EAAE,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;AAEpG;;GAEG;AACW,kCAAY,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAC,2DAA2D;AAC3H;;GAEG;AACW,kCAAY,GAAG,OAAO,CAAC,UAAU,CAAC;AAChD;;GAEG;AACW,kCAAY,GAAG,OAAO,CAAC,YAAY,CAAC","sourcesContent":["import type { Scene } from \"../../scene\";\r\nimport { Quaternion, TmpVectors, Vector3 } from \"../../Maths/math.vector\";\r\nimport { Mesh } from \"../mesh\";\r\nimport { Buffer } from \"../../Buffers/buffer\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { Node } from \"../../node\";\r\nimport { DeepCopier } from \"../../Misc/deepCopier\";\r\nimport { GreasedLineTools } from \"../../Misc/greasedLineTools\";\r\nimport type { GreasedLineMeshOptions, GreasedLineRibbonOptions } from \"./greasedLineBaseMesh\";\r\nimport { GreasedLineBaseMesh, GreasedLineRibbonAutoDirectionMode, GreasedLineRibbonFacesMode, GreasedLineRibbonPointsMode } from \"./greasedLineBaseMesh\";\r\nimport type { VertexData } from \"../mesh.vertexData\";\r\n\r\nMesh._GreasedLineRibbonMeshParser = (parsedMesh: any, scene: Scene): Mesh => {\r\n return GreasedLineRibbonMesh.Parse(parsedMesh, scene);\r\n};\r\n\r\n/**\r\n * GreasedLineRibbonMesh\r\n * Use the GreasedLineBuilder.CreateGreasedLine function to create an instance of this class.\r\n */\r\nexport class GreasedLineRibbonMesh extends GreasedLineBaseMesh {\r\n /**\r\n * Default line width\r\n */\r\n public static DEFAULT_WIDTH = 0.1;\r\n\r\n private static _RightHandedForwardReadOnlyQuaternion = Quaternion.RotationAxis(Vector3.RightHandedForwardReadOnly, Math.PI / 2);\r\n private static _LeftHandedForwardReadOnlyQuaternion = Quaternion.RotationAxis(Vector3.LeftHandedForwardReadOnly, Math.PI / 2);\r\n private static _LeftReadOnlyQuaternion = Quaternion.RotationAxis(Vector3.LeftReadOnly, Math.PI / 2);\r\n\r\n /**\r\n * Direction which the line segment will be thickened if drawn on the XY plane\r\n */\r\n public static DIRECTION_XY = Vector3.LeftHandedForwardReadOnly; // doesn't matter in which handed system the scene operates\r\n /**\r\n * Direction which the line segment will be thickened if drawn on the XZ plane\r\n */\r\n public static DIRECTION_XZ = Vector3.UpReadOnly;\r\n /**\r\n * Direction which the line segment will be thickened if drawn on the YZ plane\r\n */\r\n public static DIRECTION_YZ = Vector3.LeftReadOnly;\r\n\r\n private _paths: Vector3[][];\r\n private _pathsOptions: { options: GreasedLineMeshOptions; pathCount: number }[];\r\n private _vSegmentLengths: number[][];\r\n private _uSegmentLengths: number[][];\r\n private _vTotalLengths: number[];\r\n private _uTotalLengths: number[];\r\n\r\n private _counters: number[];\r\n private _slopes: number[];\r\n private _ribbonWidths: number[];\r\n\r\n /**\r\n * GreasedLineRibbonMesh\r\n * @param name name of the mesh\r\n * @param scene the scene\r\n * @param _options mesh options\r\n * @param _pathOptions used internaly when parsing a serialized GreasedLineRibbonMesh\r\n */\r\n constructor(\r\n public override readonly name: string,\r\n scene: Scene,\r\n _options: GreasedLineMeshOptions,\r\n _pathOptions?: { options: GreasedLineMeshOptions; pathCount: number }[]\r\n ) {\r\n super(name, scene, _options);\r\n\r\n if (!_options.ribbonOptions) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"'GreasedLineMeshOptions.ribbonOptions' is not set.\";\r\n }\r\n\r\n this._paths = [];\r\n this._counters = [];\r\n this._slopes = [];\r\n this._widths = _options.widths ?? [];\r\n this._ribbonWidths = [];\r\n this._pathsOptions = _pathOptions ?? [];\r\n\r\n if (_options.points) {\r\n this.addPoints(GreasedLineTools.ConvertPoints(_options.points), _options, !!_pathOptions);\r\n }\r\n }\r\n\r\n /**\r\n * Adds new points to the line. It doesn't rerenders the line if in lazy mode.\r\n * @param points points table\r\n * @param options mesh options\r\n * @param hasPathOptions defaults to false\r\n */\r\n public override addPoints(points: number[][], options: GreasedLineMeshOptions, hasPathOptions = false) {\r\n if (!options.ribbonOptions) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"addPoints() on GreasedLineRibbonMesh instance requires 'GreasedLineMeshOptions.ribbonOptions'.\";\r\n }\r\n\r\n if (!hasPathOptions) {\r\n this._pathsOptions.push({ options, pathCount: points.length });\r\n }\r\n\r\n super.addPoints(points, options);\r\n }\r\n\r\n /**\r\n * \"GreasedLineRibbonMesh\"\r\n * @returns \"GreasedLineRibbonMesh\"\r\n */\r\n public override getClassName(): string {\r\n return \"GreasedLineRibbonMesh\";\r\n }\r\n\r\n /**\r\n * Return true if the line was created from two edge paths or one points path.\r\n * In this case the line is always flat.\r\n */\r\n public get isFlatLine() {\r\n return this._paths.length < 3;\r\n }\r\n\r\n /**\r\n * Returns the slopes of the line at each point relative to the center of the line\r\n */\r\n get slopes() {\r\n return this._slopes;\r\n }\r\n\r\n /**\r\n * Set the slopes of the line at each point relative to the center of the line\r\n */\r\n set slopes(slopes: number[]) {\r\n this._slopes = slopes;\r\n }\r\n\r\n protected _updateColorPointers() {\r\n if (this._options.colorPointers) {\r\n return;\r\n }\r\n\r\n let colorPointer = 0;\r\n this._colorPointers = [];\r\n for (let i = 0; i < this._pathsOptions.length; i++) {\r\n const { options: pathOptions, pathCount } = this._pathsOptions[i];\r\n const points = this._points[i];\r\n\r\n if (pathOptions.ribbonOptions!.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_POINTS) {\r\n for (let k = 0; k < pathCount; k++) {\r\n for (let j = 0; j < points.length; j += 3) {\r\n this._colorPointers.push(colorPointer);\r\n this._colorPointers.push(colorPointer++);\r\n }\r\n }\r\n } else {\r\n for (let j = 0; j < points.length; j += 3) {\r\n for (let k = 0; k < pathCount; k++) {\r\n this._colorPointers.push(colorPointer);\r\n }\r\n colorPointer++;\r\n }\r\n }\r\n }\r\n }\r\n\r\n protected _updateWidths(): void {\r\n super._updateWidthsWithValue(1);\r\n }\r\n\r\n protected _setPoints(points: number[][], _options: GreasedLineMeshOptions) {\r\n if (!this._options.ribbonOptions) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"No 'GreasedLineMeshOptions.ribbonOptions' provided.\";\r\n }\r\n this._points = points;\r\n this._options.points = points;\r\n\r\n this._initGreasedLine();\r\n\r\n let indiceOffset = 0;\r\n let directionPlanes: Vector3[];\r\n for (let i = 0, c = 0; i < this._pathsOptions.length; i++) {\r\n const { options: pathOptions, pathCount } = this._pathsOptions[i];\r\n const subPoints = points.slice(c, c + pathCount);\r\n c += pathCount;\r\n if (pathOptions.ribbonOptions?.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_PATHS) {\r\n indiceOffset = this._preprocess(GreasedLineTools.ToVector3Array(subPoints) as Vector3[][], indiceOffset, pathOptions);\r\n } else {\r\n if (pathOptions.ribbonOptions?.directionsAutoMode === GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_NONE) {\r\n if (!pathOptions.ribbonOptions!.directions) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"In GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_NONE 'GreasedLineMeshOptions.ribbonOptions.directions' must be defined.\";\r\n }\r\n directionPlanes = GreasedLineRibbonMesh._GetDirectionPlanesFromDirectionsOption(subPoints.length, pathOptions.ribbonOptions!.directions);\r\n }\r\n subPoints.forEach((p, idx) => {\r\n const pathArray = GreasedLineRibbonMesh._ConvertToRibbonPath(\r\n p,\r\n pathOptions.ribbonOptions!,\r\n this._scene.useRightHandedSystem,\r\n directionPlanes ? directionPlanes[idx] : directionPlanes\r\n );\r\n indiceOffset = this._preprocess(pathArray, indiceOffset, pathOptions);\r\n });\r\n }\r\n }\r\n\r\n if (!this._lazy) {\r\n this._createVertexBuffers();\r\n !this.doNotSyncBoundingInfo && this.refreshBoundingInfo();\r\n }\r\n }\r\n\r\n private static _GetDirectionPlanesFromDirectionsOption(count: number, directions: Vector3 | Vector3[]) {\r\n if (Array.isArray(directions)) {\r\n return directions;\r\n }\r\n\r\n return new Array(count).fill(directions) as Vector3[];\r\n }\r\n\r\n private static _CreateRibbonVertexData(pathArray: Vector3[][], options: GreasedLineMeshOptions) {\r\n const numOfPaths = pathArray.length;\r\n if (numOfPaths < 2) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"Minimum of two paths are required to create a GreasedLineRibbonMesh.\";\r\n }\r\n\r\n const positions = [];\r\n const indices = [];\r\n\r\n const path = pathArray[0];\r\n for (let i = 0; i < path.length; i++) {\r\n for (let pi = 0; pi < pathArray.length; pi++) {\r\n const v = pathArray[pi][i];\r\n positions.push(v.x, v.y, v.z);\r\n }\r\n }\r\n\r\n const v: number[] = [1, 0, numOfPaths];\r\n const doubleSided = options.ribbonOptions?.facesMode === GreasedLineRibbonFacesMode.FACES_MODE_DOUBLE_SIDED;\r\n\r\n const closePath = options.ribbonOptions?.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_PATHS && options.ribbonOptions.closePath;\r\n if (numOfPaths > 2) {\r\n for (let i = 0; i < path.length - 1; i++) {\r\n v[0] = 1 + numOfPaths * i;\r\n v[1] = numOfPaths * i;\r\n v[2] = (i + 1) * numOfPaths;\r\n for (let pi = 0; pi < (numOfPaths - 1) * 2; pi++) {\r\n if (pi % 2 !== 0) {\r\n v[2] += 1;\r\n }\r\n if (pi % 2 === 0 && pi > 0) {\r\n v[0] += 1;\r\n v[1] += 1;\r\n }\r\n indices.push(v[1] + (pi % 2 !== 0 ? numOfPaths : 0), v[0], v[2]);\r\n if (doubleSided) {\r\n indices.push(v[0], v[1] + (pi % 2 !== 0 ? numOfPaths : 0), v[2]);\r\n }\r\n }\r\n }\r\n } else {\r\n for (let i = 0; i < positions.length / 3 - 3; i += 2) {\r\n indices.push(i, i + 1, i + 2);\r\n indices.push(i + 2, i + 1, i + 3);\r\n if (doubleSided) {\r\n indices.push(i + 1, i, i + 2);\r\n indices.push(i + 1, i + 2, i + 3);\r\n }\r\n }\r\n }\r\n if (closePath) {\r\n let lastIndice = numOfPaths * (path.length - 1);\r\n for (let pi = 0; pi < numOfPaths - 1; pi++) {\r\n indices.push(lastIndice, pi + 1, pi);\r\n indices.push(lastIndice + 1, pi + 1, lastIndice);\r\n if (doubleSided) {\r\n indices.push(pi, pi + 1, lastIndice);\r\n indices.push(lastIndice, pi + 1, lastIndice + 1);\r\n }\r\n lastIndice++;\r\n }\r\n }\r\n\r\n return {\r\n positions,\r\n indices,\r\n };\r\n }\r\n\r\n private _preprocess(pathArray: Vector3[][], indiceOffset: number, options: GreasedLineMeshOptions) {\r\n this._paths = pathArray;\r\n\r\n const ribbonVertexData = GreasedLineRibbonMesh._CreateRibbonVertexData(pathArray, options);\r\n\r\n const positions = ribbonVertexData.positions;\r\n\r\n if (!this._options.widths) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"No 'GreasedLineMeshOptions.widths' table is specified.\";\r\n }\r\n\r\n const vertexPositions = Array.isArray(this._vertexPositions) ? this._vertexPositions : Array.from(this._vertexPositions);\r\n this._vertexPositions = vertexPositions;\r\n const uvs = Array.isArray(this._uvs) ? this._uvs : Array.from(this._uvs);\r\n this._uvs = uvs;\r\n const indices = Array.isArray(this._indices) ? this._indices : Array.from(this._indices);\r\n this._indices = indices;\r\n\r\n for (const p of positions) {\r\n vertexPositions.push(p);\r\n }\r\n\r\n let pathArrayCopy = pathArray;\r\n if (options.ribbonOptions?.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_PATHS && options.ribbonOptions.closePath) {\r\n pathArrayCopy = [];\r\n for (let i = 0; i < pathArray.length; i++) {\r\n const pathCopy = pathArray[i].slice();\r\n pathCopy.push(pathArray[i][0].clone());\r\n pathArrayCopy.push(pathCopy);\r\n }\r\n }\r\n\r\n this._calculateSegmentLengths(pathArrayCopy);\r\n\r\n const pathArrayLength = pathArrayCopy.length;\r\n const previousCounters = new Array(pathArrayLength).fill(0);\r\n for (let i = 0; i < pathArrayCopy[0].length; i++) {\r\n let v = 0;\r\n for (let pi = 0; pi < pathArrayLength; pi++) {\r\n const counter = previousCounters[pi] + this._vSegmentLengths[pi][i] / this._vTotalLengths[pi];\r\n this._counters.push(counter);\r\n uvs.push(counter, v);\r\n\r\n previousCounters[pi] = counter;\r\n v += this._uSegmentLengths[i][pi] / this._uTotalLengths[i];\r\n }\r\n }\r\n\r\n for (let i = 0, c = 0; i < pathArrayCopy[0].length; i++) {\r\n const widthLower = this._uSegmentLengths[i][0] / 2;\r\n const widthUpper = this._uSegmentLengths[i][pathArrayLength - 1] / 2;\r\n this._ribbonWidths.push(((this._widths[c++] ?? 1) - 1) * widthLower);\r\n for (let pi = 0; pi < pathArrayLength - 2; pi++) {\r\n this._ribbonWidths.push(0);\r\n }\r\n this._ribbonWidths.push(((this._widths[c++] ?? 1) - 1) * widthUpper);\r\n }\r\n\r\n const slopes =\r\n options.ribbonOptions?.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_PATHS\r\n ? new Array(pathArrayCopy[0].length * pathArrayCopy.length * 6).fill(0)\r\n : GreasedLineRibbonMesh._CalculateSlopes(pathArrayCopy);\r\n for (const s of slopes) {\r\n this._slopes.push(s);\r\n }\r\n\r\n if (ribbonVertexData.indices) {\r\n for (let i = 0; i < ribbonVertexData.indices.length; i++) {\r\n indices.push(ribbonVertexData.indices[i] + indiceOffset);\r\n }\r\n }\r\n indiceOffset += positions.length / 3;\r\n\r\n return indiceOffset;\r\n }\r\n\r\n private static _ConvertToRibbonPath(points: number[], ribbonInfo: GreasedLineRibbonOptions, rightHandedSystem: boolean, directionPlane?: Vector3) {\r\n if (ribbonInfo.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_POINTS && !ribbonInfo.width) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"'GreasedLineMeshOptions.ribbonOptiosn.width' must be specified in GreasedLineRibbonPointsMode.POINTS_MODE_POINTS.\";\r\n }\r\n const path1 = [];\r\n const path2 = [];\r\n if (ribbonInfo.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_POINTS) {\r\n const width = ribbonInfo.width! / 2;\r\n const pointVectors = GreasedLineTools.ToVector3Array(points) as Vector3[];\r\n let direction: Nullable<Vector3> = null;\r\n let fatDirection: Nullable<Vector3> = null;\r\n\r\n if (ribbonInfo.directionsAutoMode === GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_FROM_FIRST_SEGMENT) {\r\n // set the direction plane from the first line segment for the whole line\r\n directionPlane = GreasedLineRibbonMesh._GetDirectionFromPoints(pointVectors[0], pointVectors[1], null);\r\n }\r\n\r\n if (ribbonInfo.directionsAutoMode === GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_FACE_TO && !(ribbonInfo.directions instanceof Vector3)) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"In GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_FACE_TO 'GreasedLineMeshOptions.ribbonOptions.directions' must be a Vector3.\";\r\n }\r\n\r\n TmpVectors.Vector3[1] = ribbonInfo.directions instanceof Vector3 ? ribbonInfo.directions : GreasedLineRibbonMesh.DIRECTION_XZ;\r\n for (let i = 0; i < pointVectors.length - (directionPlane ? 0 : 1); i++) {\r\n const p1 = pointVectors[i];\r\n const p2 = pointVectors[i + 1];\r\n\r\n if (directionPlane) {\r\n direction = <Vector3>directionPlane;\r\n } else if (ribbonInfo.directionsAutoMode === GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_FACE_TO) {\r\n p2.subtractToRef(p1, TmpVectors.Vector3[0]);\r\n direction = Vector3.CrossToRef(TmpVectors.Vector3[0], TmpVectors.Vector3[1], TmpVectors.Vector3[2]).normalize();\r\n } else if (ribbonInfo.directionsAutoMode === GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_FROM_ALL_SEGMENTS) {\r\n direction = GreasedLineRibbonMesh._GetDirectionFromPoints(p1, p2, direction);\r\n } else {\r\n // GreasedLineRibbonAutoDirectionMode.DIRECTION_ENHANCED\r\n const directionTemp = p2.subtract(p1);\r\n directionTemp.applyRotationQuaternionInPlace(\r\n directionTemp.x > directionTemp.y && directionTemp.x > directionTemp.z\r\n ? rightHandedSystem\r\n ? GreasedLineRibbonMesh._RightHandedForwardReadOnlyQuaternion\r\n : GreasedLineRibbonMesh._LeftHandedForwardReadOnlyQuaternion\r\n : GreasedLineRibbonMesh._LeftReadOnlyQuaternion\r\n );\r\n direction = directionTemp.normalize();\r\n }\r\n\r\n fatDirection = direction.multiplyByFloats(width, width, width);\r\n path1.push(p1.add(fatDirection));\r\n path2.push(p1.subtract(fatDirection));\r\n }\r\n if (!directionPlane) {\r\n path1.push(pointVectors[pointVectors.length - 1].add(fatDirection!));\r\n path2.push(pointVectors[pointVectors.length - 1].subtract(fatDirection!));\r\n }\r\n }\r\n return [path1, path2];\r\n }\r\n\r\n private static _GetDirectionFromPoints(p1: Vector3, p2: Vector3, previousDirection: Nullable<Vector3>) {\r\n // handle straight lines\r\n if (p1.x === p2.x && (!previousDirection || previousDirection?.x === 1)) {\r\n return GreasedLineRibbonMesh.DIRECTION_YZ;\r\n }\r\n\r\n if (p1.y === p2.y) {\r\n return GreasedLineRibbonMesh.DIRECTION_XZ;\r\n }\r\n\r\n if (p1.z === p2.z) {\r\n return GreasedLineRibbonMesh.DIRECTION_XY;\r\n }\r\n\r\n return GreasedLineRibbonMesh.DIRECTION_XZ;\r\n }\r\n\r\n /**\r\n * Clones the GreasedLineRibbonMesh.\r\n * @param name new line name\r\n * @param newParent new parent node\r\n * @returns cloned line\r\n */\r\n public override clone(name: string = `${this.name}-cloned`, newParent?: Nullable<Node>) {\r\n const lineOptions = this._createLineOptions();\r\n const deepCopiedLineOptions: any = {};\r\n const pathOptionsCloned: any = [];\r\n DeepCopier.DeepCopy(this._pathsOptions, pathOptionsCloned, undefined, undefined, true);\r\n DeepCopier.DeepCopy(lineOptions, deepCopiedLineOptions, [\"instance\"], undefined, true);\r\n\r\n const cloned = new GreasedLineRibbonMesh(name, this._scene, <GreasedLineMeshOptions>deepCopiedLineOptions, pathOptionsCloned);\r\n if (newParent) {\r\n cloned.parent = newParent;\r\n }\r\n\r\n cloned.material = this.material;\r\n\r\n return cloned;\r\n }\r\n\r\n /**\r\n * Serializes this GreasedLineRibbonMesh\r\n * @param serializationObject object to write serialization to\r\n */\r\n public override serialize(serializationObject: any): void {\r\n super.serialize(serializationObject);\r\n serializationObject.type = this.getClassName();\r\n\r\n serializationObject.lineOptions = this._createLineOptions();\r\n serializationObject.pathsOptions = this._pathsOptions;\r\n }\r\n\r\n /**\r\n * Parses a serialized GreasedLineRibbonMesh\r\n * @param parsedMesh the serialized GreasedLineRibbonMesh\r\n * @param scene the scene to create the GreasedLineRibbonMesh in\r\n * @returns the created GreasedLineRibbonMesh\r\n */\r\n public static override Parse(parsedMesh: any, scene: Scene): Mesh {\r\n const lineOptions = <GreasedLineMeshOptions>parsedMesh.lineOptions;\r\n const name = <string>parsedMesh.name;\r\n const pathOptions = parsedMesh.pathOptions;\r\n const result = new GreasedLineRibbonMesh(name, scene, lineOptions, pathOptions);\r\n return result;\r\n }\r\n\r\n protected override _initGreasedLine() {\r\n super._initGreasedLine();\r\n\r\n this._paths = [];\r\n this._counters = [];\r\n this._slopes = [];\r\n this._ribbonWidths = [];\r\n }\r\n\r\n private _calculateSegmentLengths(pathArray: Vector3[][]) {\r\n const pathArrayLength = pathArray.length;\r\n this._vSegmentLengths = new Array(pathArrayLength);\r\n this._vTotalLengths = new Array(pathArrayLength);\r\n let length = 0;\r\n for (let pi = 0; pi < pathArrayLength; pi++) {\r\n const points = pathArray[pi];\r\n this._vSegmentLengths[pi] = [0]; // first point has 0 distance\r\n length = 0;\r\n for (let i = 0; i < points.length - 1; i++) {\r\n const l = Math.abs(points[i].subtract(points[i + 1]).lengthSquared()); // it's ok to have lengthSquared() here\r\n length += l;\r\n this._vSegmentLengths[pi].push(l);\r\n }\r\n this._vTotalLengths[pi] = length;\r\n }\r\n\r\n const positionsLength = pathArray[0].length;\r\n this._uSegmentLengths = new Array(positionsLength).fill([]);\r\n this._uTotalLengths = new Array(positionsLength).fill([]);\r\n const uLength = new Vector3();\r\n for (let i = 0; i < positionsLength; i++) {\r\n length = 0;\r\n for (let pi = 1; pi < pathArrayLength; pi++) {\r\n pathArray[pi][i].subtractToRef(pathArray[pi - 1][i], uLength);\r\n const l = uLength.length(); // must be length()\r\n length += l;\r\n this._uSegmentLengths[i].push(l);\r\n }\r\n this._uTotalLengths[i] = length;\r\n }\r\n }\r\n\r\n private static _CalculateSlopes(paths: Vector3[][]) {\r\n const points1 = paths[0];\r\n const points2 = paths.length === 2 ? paths[1] : paths[paths.length - 1];\r\n const slopes: number[] = [];\r\n\r\n const slope = new Vector3();\r\n for (let i = 0; i < points1.length; i++) {\r\n for (let pi = 0; pi < paths.length; pi++) {\r\n if (pi === 0 || pi === paths.length - 1) {\r\n points1[i].subtract(points2[i]).normalizeToRef(slope);\r\n slopes.push(slope.x, slope.y, slope.z);\r\n slopes.push(-slope.x, -slope.y, -slope.z);\r\n } else {\r\n slopes.push(0, 0, 0, 0, 0, 0);\r\n }\r\n }\r\n }\r\n\r\n return slopes;\r\n }\r\n\r\n protected override _createVertexBuffers(): VertexData {\r\n this._uvs = this._options.uvs ?? this._uvs;\r\n const vertexData = super._createVertexBuffers(this._options.ribbonOptions?.smoothShading);\r\n\r\n const countersBuffer = new Buffer(this._engine, this._counters, this._updatable, 1);\r\n this.setVerticesBuffer(countersBuffer.createVertexBuffer(\"grl_counters\", 0, 1));\r\n\r\n const colorPointersBuffer = new Buffer(this._engine, this._colorPointers, this._updatable, 1);\r\n this.setVerticesBuffer(colorPointersBuffer.createVertexBuffer(\"grl_colorPointers\", 0, 1));\r\n\r\n const slopesBuffer = new Buffer(this._engine, this._slopes, this._updatable, 3);\r\n this.setVerticesBuffer(slopesBuffer.createVertexBuffer(\"grl_slopes\", 0, 3));\r\n\r\n const widthsBuffer = new Buffer(this._engine, this._ribbonWidths, this._updatable, 1);\r\n this.setVerticesBuffer(widthsBuffer.createVertexBuffer(\"grl_widths\", 0, 1));\r\n this._widthsBuffer = widthsBuffer;\r\n\r\n return vertexData;\r\n }\r\n}\r\n"]}
|
package/Meshes/csg.js
CHANGED
|
@@ -470,6 +470,10 @@ export class CSG {
|
|
|
470
470
|
throw "BABYLON.CSG: Mesh has no normals";
|
|
471
471
|
}
|
|
472
472
|
const subMeshes = mesh.subMeshes;
|
|
473
|
+
if (!subMeshes) {
|
|
474
|
+
// eslint-disable-next-line no-throw-literal
|
|
475
|
+
throw "BABYLON.CSG: Mesh has no submeshes";
|
|
476
|
+
}
|
|
473
477
|
for (let sm = 0, sml = subMeshes.length; sm < sml; sm++) {
|
|
474
478
|
for (let i = subMeshes[sm].indexStart, il = subMeshes[sm].indexCount + subMeshes[sm].indexStart; i < il; i += 3) {
|
|
475
479
|
vertices = [];
|