@babylonjs/core 6.23.1 → 6.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Buffers/buffer.align.d.ts +25 -0
- package/Buffers/buffer.align.js +120 -0
- package/Buffers/buffer.align.js.map +1 -0
- package/Buffers/buffer.d.ts +15 -3
- package/Buffers/buffer.js +27 -7
- package/Buffers/buffer.js.map +1 -1
- package/Buffers/index.d.ts +1 -0
- package/Buffers/index.js +1 -0
- package/Buffers/index.js.map +1 -1
- package/Cameras/Inputs/BaseCameraPointersInput.js +0 -3
- package/Cameras/Inputs/BaseCameraPointersInput.js.map +1 -1
- package/Cameras/Inputs/flyCameraMouseInput.js +1 -4
- package/Cameras/Inputs/flyCameraMouseInput.js.map +1 -1
- package/Cameras/Inputs/freeCameraMouseInput.js +0 -6
- package/Cameras/Inputs/freeCameraMouseInput.js.map +1 -1
- package/Cameras/RigModes/index.d.ts +0 -1
- package/Cameras/RigModes/index.js +0 -1
- package/Cameras/RigModes/index.js.map +1 -1
- package/Cameras/RigModes/vrRigMode.js +1 -1
- package/Cameras/RigModes/vrRigMode.js.map +1 -1
- package/Cameras/VR/index.d.ts +0 -1
- package/Cameras/VR/index.js +0 -1
- package/Cameras/VR/index.js.map +1 -1
- package/Cameras/VR/vrExperienceHelper.d.ts +7 -66
- package/Cameras/VR/vrExperienceHelper.js +17 -702
- package/Cameras/VR/vrExperienceHelper.js.map +1 -1
- package/Cameras/camera.d.ts +15 -20
- package/Cameras/camera.js +41 -36
- package/Cameras/camera.js.map +1 -1
- package/Cameras/targetCamera.js +1 -1
- package/Cameras/targetCamera.js.map +1 -1
- package/Engines/Extensions/index.d.ts +0 -1
- package/Engines/Extensions/index.js +0 -1
- package/Engines/Extensions/index.js.map +1 -1
- package/Engines/WebGL/webGLRenderTargetWrapper.d.ts +4 -0
- package/Engines/WebGL/webGLRenderTargetWrapper.js +4 -0
- package/Engines/WebGL/webGLRenderTargetWrapper.js.map +1 -1
- package/Engines/WebGPU/webgpuCacheRenderPipeline.js +8 -7
- package/Engines/WebGPU/webgpuCacheRenderPipeline.js.map +1 -1
- package/Engines/WebGPU/webgpuCacheSampler.js +1 -1
- package/Engines/WebGPU/webgpuCacheSampler.js.map +1 -1
- package/Engines/constants.d.ts +0 -4
- package/Engines/constants.js +0 -4
- package/Engines/constants.js.map +1 -1
- package/Engines/engine.d.ts +38 -258
- package/Engines/engine.js +0 -65
- package/Engines/engine.js.map +1 -1
- package/Engines/engineFactory.js +9 -14
- package/Engines/engineFactory.js.map +1 -1
- package/Engines/engineFeatures.d.ts +2 -0
- package/Engines/engineFeatures.js.map +1 -1
- package/Engines/nativeEngine.js +1 -0
- package/Engines/nativeEngine.js.map +1 -1
- package/Engines/nullEngine.js +1 -0
- package/Engines/nullEngine.js.map +1 -1
- package/Engines/thinEngine.d.ts +22 -5
- package/Engines/thinEngine.js +55 -22
- package/Engines/thinEngine.js.map +1 -1
- package/Engines/webgpuEngine.d.ts +1 -0
- package/Engines/webgpuEngine.js +4 -2
- package/Engines/webgpuEngine.js.map +1 -1
- package/FlowGraph/Blocks/Data/Logic/flowGraphBitwiseBlocks.d.ts +9 -8
- package/FlowGraph/Blocks/Data/Logic/flowGraphBitwiseBlocks.js +34 -16
- package/FlowGraph/Blocks/Data/Logic/flowGraphBitwiseBlocks.js.map +1 -1
- package/FlowGraph/Blocks/Data/Logic/flowGraphLogicBlocks.d.ts +4 -3
- package/FlowGraph/Blocks/Data/Logic/flowGraphLogicBlocks.js +14 -6
- package/FlowGraph/Blocks/Data/Logic/flowGraphLogicBlocks.js.map +1 -1
- package/FlowGraph/Blocks/Data/Math/flowGraphMatrixBlocks.d.ts +19 -14
- package/FlowGraph/Blocks/Data/Math/flowGraphMatrixBlocks.js +64 -27
- package/FlowGraph/Blocks/Data/Math/flowGraphMatrixBlocks.js.map +1 -1
- package/FlowGraph/Blocks/Data/Math/flowGraphNumberMathBlocks.d.ts +39 -41
- package/FlowGraph/Blocks/Data/Math/flowGraphNumberMathBlocks.js +152 -74
- package/FlowGraph/Blocks/Data/Math/flowGraphNumberMathBlocks.js.map +1 -1
- package/FlowGraph/Blocks/Data/Math/flowGraphVector2MathBlocks.d.ts +12 -12
- package/FlowGraph/Blocks/Data/Math/flowGraphVector2MathBlocks.js +42 -21
- package/FlowGraph/Blocks/Data/Math/flowGraphVector2MathBlocks.js.map +1 -1
- package/FlowGraph/Blocks/Data/Math/flowGraphVector3MathBlocks.d.ts +17 -14
- package/FlowGraph/Blocks/Data/Math/flowGraphVector3MathBlocks.js +62 -26
- package/FlowGraph/Blocks/Data/Math/flowGraphVector3MathBlocks.js.map +1 -1
- package/FlowGraph/Blocks/Data/Math/flowGraphVector4MathBlocks.d.ts +13 -10
- package/FlowGraph/Blocks/Data/Math/flowGraphVector4MathBlocks.js +46 -18
- package/FlowGraph/Blocks/Data/Math/flowGraphVector4MathBlocks.js.map +1 -1
- package/FlowGraph/Blocks/Data/flowGraphBinaryOperationBlock.d.ts +4 -1
- package/FlowGraph/Blocks/Data/flowGraphBinaryOperationBlock.js +6 -2
- package/FlowGraph/Blocks/Data/flowGraphBinaryOperationBlock.js.map +1 -1
- package/FlowGraph/Blocks/Data/flowGraphConditionalDataBlock.d.ts +3 -1
- package/FlowGraph/Blocks/Data/flowGraphConditionalDataBlock.js +7 -2
- package/FlowGraph/Blocks/Data/flowGraphConditionalDataBlock.js.map +1 -1
- package/FlowGraph/Blocks/Data/flowGraphConstantBlock.d.ts +5 -3
- package/FlowGraph/Blocks/Data/flowGraphConstantBlock.js +10 -5
- package/FlowGraph/Blocks/Data/flowGraphConstantBlock.js.map +1 -1
- package/FlowGraph/Blocks/Data/flowGraphConstantOperationBlock.d.ts +4 -1
- package/FlowGraph/Blocks/Data/flowGraphConstantOperationBlock.js +6 -2
- package/FlowGraph/Blocks/Data/flowGraphConstantOperationBlock.js.map +1 -1
- package/FlowGraph/Blocks/Data/flowGraphCoordinateTransformBlock.d.ts +3 -1
- package/FlowGraph/Blocks/Data/flowGraphCoordinateTransformBlock.js +7 -2
- package/FlowGraph/Blocks/Data/flowGraphCoordinateTransformBlock.js.map +1 -1
- package/FlowGraph/Blocks/Data/flowGraphGetVariableBlock.d.ts +3 -1
- package/FlowGraph/Blocks/Data/flowGraphGetVariableBlock.js +7 -2
- package/FlowGraph/Blocks/Data/flowGraphGetVariableBlock.js.map +1 -1
- package/FlowGraph/Blocks/Data/flowGraphUnaryOperationBlock.d.ts +4 -1
- package/FlowGraph/Blocks/Data/flowGraphUnaryOperationBlock.js +6 -2
- package/FlowGraph/Blocks/Data/flowGraphUnaryOperationBlock.js.map +1 -1
- package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.d.ts +6 -2
- package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.js +12 -3
- package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.js.map +1 -1
- package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.d.ts +5 -3
- package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.js +11 -6
- package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.js.map +1 -1
- package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.d.ts +1 -0
- package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.js +7 -2
- package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.js.map +1 -1
- package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.d.ts +1 -0
- package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.js +7 -2
- package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/Animation/flowGraphPauseAnimationBlock.d.ts +3 -1
- package/FlowGraph/Blocks/Execution/Animation/flowGraphPauseAnimationBlock.js +7 -2
- package/FlowGraph/Blocks/Execution/Animation/flowGraphPauseAnimationBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.d.ts +3 -1
- package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.js +8 -3
- package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.d.ts +3 -1
- package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.js +7 -2
- package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/Audio/flowGraphPlayAudioBlock.d.ts +3 -1
- package/FlowGraph/Blocks/Execution/Audio/flowGraphPlayAudioBlock.js +7 -2
- package/FlowGraph/Blocks/Execution/Audio/flowGraphPlayAudioBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/Audio/flowGraphStopAudioBlock.d.ts +3 -1
- package/FlowGraph/Blocks/Execution/Audio/flowGraphStopAudioBlock.js +7 -2
- package/FlowGraph/Blocks/Execution/Audio/flowGraphStopAudioBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphBranchBlock.d.ts +3 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphBranchBlock.js +7 -2
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphBranchBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCounterBlock.d.ts +3 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCounterBlock.js +7 -2
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCounterBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDebounceBlock.d.ts +3 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDebounceBlock.js +7 -2
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDebounceBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDoNBlock.d.ts +3 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDoNBlock.js +7 -2
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDoNBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphFlipFlopBlock.d.ts +3 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphFlipFlopBlock.js +7 -2
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphFlipFlopBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.d.ts +3 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.js +7 -2
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphMultiGateBlock.d.ts +6 -3
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphMultiGateBlock.js +22 -16
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphMultiGateBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSwitchBlock.d.ts +7 -4
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSwitchBlock.js +15 -10
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSwitchBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphThrottleBlock.d.ts +3 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphThrottleBlock.js +7 -2
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphThrottleBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphTimerBlock.d.ts +3 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphTimerBlock.js +8 -3
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphTimerBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWaitAllBlock.d.ts +7 -4
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWaitAllBlock.js +14 -7
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWaitAllBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWhileLoopBlock.d.ts +5 -3
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWhileLoopBlock.js +9 -4
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWhileLoopBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/flowGraphLogBlock.d.ts +3 -1
- package/FlowGraph/Blocks/Execution/flowGraphLogBlock.js +7 -2
- package/FlowGraph/Blocks/Execution/flowGraphLogBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/flowGraphSendCustomEventBlock.d.ts +3 -1
- package/FlowGraph/Blocks/Execution/flowGraphSendCustomEventBlock.js +8 -3
- package/FlowGraph/Blocks/Execution/flowGraphSendCustomEventBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.d.ts +3 -1
- package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.js +7 -2
- package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.d.ts +3 -1
- package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.js +7 -2
- package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.js.map +1 -1
- package/FlowGraph/flowGraph.d.ts +41 -3
- package/FlowGraph/flowGraph.js +135 -0
- package/FlowGraph/flowGraph.js.map +1 -1
- package/FlowGraph/flowGraphAsyncExecutionBlock.d.ts +2 -1
- package/FlowGraph/flowGraphAsyncExecutionBlock.js +2 -2
- package/FlowGraph/flowGraphAsyncExecutionBlock.js.map +1 -1
- package/FlowGraph/flowGraphBlock.d.ts +15 -3
- package/FlowGraph/flowGraphBlock.js +50 -7
- package/FlowGraph/flowGraphBlock.js.map +1 -1
- package/FlowGraph/flowGraphConnection.d.ts +34 -4
- package/FlowGraph/flowGraphConnection.js +49 -3
- package/FlowGraph/flowGraphConnection.js.map +1 -1
- package/FlowGraph/flowGraphContext.d.ts +25 -5
- package/FlowGraph/flowGraphContext.js +86 -4
- package/FlowGraph/flowGraphContext.js.map +1 -1
- package/FlowGraph/flowGraphCoordinator.d.ts +7 -1
- package/FlowGraph/flowGraphCoordinator.js +18 -2
- package/FlowGraph/flowGraphCoordinator.js.map +1 -1
- package/FlowGraph/flowGraphDataConnection.d.ts +4 -11
- package/FlowGraph/flowGraphDataConnection.js +16 -14
- package/FlowGraph/flowGraphDataConnection.js.map +1 -1
- package/FlowGraph/flowGraphExecutionBlock.d.ts +8 -3
- package/FlowGraph/flowGraphExecutionBlock.js +37 -6
- package/FlowGraph/flowGraphExecutionBlock.js.map +1 -1
- package/FlowGraph/flowGraphRichTypes.d.ts +5 -9
- package/FlowGraph/flowGraphRichTypes.js +29 -44
- package/FlowGraph/flowGraphRichTypes.js.map +1 -1
- package/FlowGraph/flowGraphSignalConnection.js +2 -0
- package/FlowGraph/flowGraphSignalConnection.js.map +1 -1
- package/FlowGraph/flowGraphVariableDefinitions.d.ts +22 -2
- package/FlowGraph/flowGraphVariableDefinitions.js +29 -0
- package/FlowGraph/flowGraphVariableDefinitions.js.map +1 -1
- package/FlowGraph/flowGraphWithOnDoneExecutionBlock.d.ts +2 -1
- package/FlowGraph/flowGraphWithOnDoneExecutionBlock.js +2 -2
- package/FlowGraph/flowGraphWithOnDoneExecutionBlock.js.map +1 -1
- package/Gamepads/gamepadManager.js +0 -5
- package/Gamepads/gamepadManager.js.map +1 -1
- package/Gamepads/index.d.ts +0 -1
- package/Gamepads/index.js +0 -2
- package/Gamepads/index.js.map +1 -1
- package/Gizmos/gizmo.js +1 -4
- package/Gizmos/gizmo.js.map +1 -1
- package/Materials/GreasedLine/greasedLineMaterialDefaults.d.ts +24 -0
- package/Materials/GreasedLine/greasedLineMaterialDefaults.js +19 -0
- package/Materials/GreasedLine/greasedLineMaterialDefaults.js.map +1 -0
- package/Materials/GreasedLine/greasedLineMaterialInterfaces.d.ts +243 -0
- package/Materials/GreasedLine/greasedLineMaterialInterfaces.js +55 -0
- package/Materials/GreasedLine/greasedLineMaterialInterfaces.js.map +1 -0
- package/Materials/GreasedLine/greasedLinePluginMaterial.d.ts +253 -0
- package/Materials/{greasedLinePluginMaterial.js → GreasedLine/greasedLinePluginMaterial.js} +148 -205
- package/Materials/GreasedLine/greasedLinePluginMaterial.js.map +1 -0
- package/Materials/{greasedLineSimpleMaterial.d.ts → GreasedLine/greasedLineSimpleMaterial.d.ts} +20 -48
- package/Materials/{greasedLineSimpleMaterial.js → GreasedLine/greasedLineSimpleMaterial.js} +74 -91
- package/Materials/GreasedLine/greasedLineSimpleMaterial.js.map +1 -0
- package/Materials/Node/Blocks/Input/prePassTextureBlock.d.ts +1 -1
- package/Materials/Node/Blocks/Input/prePassTextureBlock.js.map +1 -1
- package/Materials/Textures/texture.js +1 -0
- package/Materials/Textures/texture.js.map +1 -1
- package/Materials/index.d.ts +4 -1
- package/Materials/index.js +4 -1
- package/Materials/index.js.map +1 -1
- package/Maths/math.vector.d.ts +32 -22
- package/Maths/math.vector.js +54 -43
- package/Maths/math.vector.js.map +1 -1
- package/Meshes/Builders/greasedLineBuilder.d.ts +7 -6
- package/Meshes/Builders/greasedLineBuilder.js +65 -31
- package/Meshes/Builders/greasedLineBuilder.js.map +1 -1
- package/Meshes/GreasedLine/greasedLineBaseMesh.d.ts +216 -0
- package/Meshes/GreasedLine/greasedLineBaseMesh.js +247 -0
- package/Meshes/GreasedLine/greasedLineBaseMesh.js.map +1 -0
- package/Meshes/GreasedLine/greasedLineMesh.d.ts +92 -0
- package/Meshes/{greasedLineMesh.js → GreasedLine/greasedLineMesh.js} +29 -223
- package/Meshes/GreasedLine/greasedLineMesh.js.map +1 -0
- package/Meshes/GreasedLine/greasedLineRibbonMesh.d.ts +107 -0
- package/Meshes/GreasedLine/greasedLineRibbonMesh.js +462 -0
- package/Meshes/GreasedLine/greasedLineRibbonMesh.js.map +1 -0
- package/Meshes/Node/Blocks/Sources/meshBlock.d.ts +9 -2
- package/Meshes/Node/Blocks/Sources/meshBlock.js +17 -5
- package/Meshes/Node/Blocks/Sources/meshBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Textures/geometryTextureBlock.d.ts +15 -0
- package/Meshes/Node/Blocks/Textures/geometryTextureBlock.js +50 -1
- package/Meshes/Node/Blocks/Textures/geometryTextureBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Textures/geometryTextureFetchBlock.js +5 -5
- package/Meshes/Node/Blocks/Textures/geometryTextureFetchBlock.js.map +1 -1
- package/Meshes/Node/nodeGeometry.d.ts +1 -2
- package/Meshes/Node/nodeGeometry.js +3 -4
- package/Meshes/Node/nodeGeometry.js.map +1 -1
- package/Meshes/Node/nodeGeometryBlock.d.ts +1 -2
- package/Meshes/Node/nodeGeometryBlock.js +1 -2
- package/Meshes/Node/nodeGeometryBlock.js.map +1 -1
- package/Meshes/geometry.js +6 -12
- package/Meshes/geometry.js.map +1 -1
- package/Meshes/index.d.ts +3 -1
- package/Meshes/index.js +3 -1
- package/Meshes/index.js.map +1 -1
- package/Meshes/mesh.d.ts +4 -0
- package/Meshes/mesh.js +7 -0
- package/Meshes/mesh.js.map +1 -1
- package/Misc/deepCopier.js +3 -0
- package/Misc/deepCopier.js.map +1 -1
- package/Misc/greasedLineTools.d.ts +52 -5
- package/Misc/greasedLineTools.js +180 -10
- package/Misc/greasedLineTools.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js +9 -2
- package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js.map +1 -1
- package/PostProcesses/motionBlurPostProcess.js +4 -1
- package/PostProcesses/motionBlurPostProcess.js.map +1 -1
- package/PostProcesses/postProcess.js +1 -6
- package/PostProcesses/postProcess.js.map +1 -1
- package/Rendering/geometryBufferRenderer.js +4 -0
- package/Rendering/geometryBufferRenderer.js.map +1 -1
- package/Shaders/greasedLine.fragment.js +2 -5
- package/Shaders/greasedLine.fragment.js.map +1 -1
- package/Shaders/greasedLine.vertex.js +15 -4
- package/Shaders/greasedLine.vertex.js.map +1 -1
- package/XR/webXRDefaultExperience.d.ts +1 -1
- package/XR/webXRDefaultExperience.js +1 -1
- package/XR/webXRDefaultExperience.js.map +1 -1
- package/package.json +1 -1
- package/scene.d.ts +17 -10
- package/scene.js +25 -30
- package/scene.js.map +1 -1
- package/Cameras/RigModes/webVRRigMode.d.ts +0 -5
- package/Cameras/RigModes/webVRRigMode.js +0 -34
- package/Cameras/RigModes/webVRRigMode.js.map +0 -1
- package/Cameras/VR/webVRCamera.d.ts +0 -316
- package/Cameras/VR/webVRCamera.js +0 -618
- package/Cameras/VR/webVRCamera.js.map +0 -1
- package/Engines/Extensions/engine.webVR.d.ts +0 -91
- package/Engines/Extensions/engine.webVR.js +0 -195
- package/Engines/Extensions/engine.webVR.js.map +0 -1
- package/FlowGraph/Blocks/Execution/flowGraphCustomFunctionBlock.d.ts +0 -23
- package/FlowGraph/Blocks/Execution/flowGraphCustomFunctionBlock.js +0 -18
- package/FlowGraph/Blocks/Execution/flowGraphCustomFunctionBlock.js.map +0 -1
- package/Gamepads/Controllers/daydreamController.d.ts +0 -38
- package/Gamepads/Controllers/daydreamController.js +0 -70
- package/Gamepads/Controllers/daydreamController.js.map +0 -1
- package/Gamepads/Controllers/gearVRController.d.ts +0 -39
- package/Gamepads/Controllers/gearVRController.js +0 -79
- package/Gamepads/Controllers/gearVRController.js.map +0 -1
- package/Gamepads/Controllers/genericController.d.ts +0 -34
- package/Gamepads/Controllers/genericController.js +0 -48
- package/Gamepads/Controllers/genericController.js.map +0 -1
- package/Gamepads/Controllers/index.d.ts +0 -8
- package/Gamepads/Controllers/index.js +0 -9
- package/Gamepads/Controllers/index.js.map +0 -1
- package/Gamepads/Controllers/oculusTouchController.d.ts +0 -78
- package/Gamepads/Controllers/oculusTouchController.js +0 -196
- package/Gamepads/Controllers/oculusTouchController.js.map +0 -1
- package/Gamepads/Controllers/poseEnabledController.d.ts +0 -219
- package/Gamepads/Controllers/poseEnabledController.js +0 -293
- package/Gamepads/Controllers/poseEnabledController.js.map +0 -1
- package/Gamepads/Controllers/viveController.d.ts +0 -52
- package/Gamepads/Controllers/viveController.js +0 -115
- package/Gamepads/Controllers/viveController.js.map +0 -1
- package/Gamepads/Controllers/webVRController.d.ts +0 -85
- package/Gamepads/Controllers/webVRController.js +0 -122
- package/Gamepads/Controllers/webVRController.js.map +0 -1
- package/Gamepads/Controllers/windowsMotionController.d.ts +0 -212
- package/Gamepads/Controllers/windowsMotionController.js +0 -519
- package/Gamepads/Controllers/windowsMotionController.js.map +0 -1
- package/Materials/greasedLinePluginMaterial.d.ts +0 -496
- package/Materials/greasedLinePluginMaterial.js.map +0 -1
- package/Materials/greasedLineSimpleMaterial.js.map +0 -1
- package/Meshes/greasedLineMesh.d.ts +0 -204
- package/Meshes/greasedLineMesh.js.map +0 -1
|
@@ -1,64 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
* Material types for GreasedLine
|
|
10
|
-
* {@link https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param/greased_line#materialtype}
|
|
11
|
-
*/
|
|
12
|
-
export var GreasedLineMeshMaterialType;
|
|
13
|
-
(function (GreasedLineMeshMaterialType) {
|
|
14
|
-
/**
|
|
15
|
-
* StandardMaterial
|
|
16
|
-
*/
|
|
17
|
-
GreasedLineMeshMaterialType[GreasedLineMeshMaterialType["MATERIAL_TYPE_STANDARD"] = 0] = "MATERIAL_TYPE_STANDARD";
|
|
18
|
-
/**
|
|
19
|
-
* PBR Material
|
|
20
|
-
*/
|
|
21
|
-
GreasedLineMeshMaterialType[GreasedLineMeshMaterialType["MATERIAL_TYPE_PBR"] = 1] = "MATERIAL_TYPE_PBR";
|
|
22
|
-
/**
|
|
23
|
-
* Simple and fast shader material not supporting lightning nor textures
|
|
24
|
-
*/
|
|
25
|
-
GreasedLineMeshMaterialType[GreasedLineMeshMaterialType["MATERIAL_TYPE_SIMPLE"] = 2] = "MATERIAL_TYPE_SIMPLE";
|
|
26
|
-
})(GreasedLineMeshMaterialType || (GreasedLineMeshMaterialType = {}));
|
|
27
|
-
/**
|
|
28
|
-
* Color blending mode of the @see GreasedLineMaterial and the base material
|
|
29
|
-
* {@link https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param/greased_line#colormode}
|
|
30
|
-
*/
|
|
31
|
-
export var GreasedLineMeshColorMode;
|
|
32
|
-
(function (GreasedLineMeshColorMode) {
|
|
33
|
-
/**
|
|
34
|
-
* Color blending mode SET
|
|
35
|
-
*/
|
|
36
|
-
GreasedLineMeshColorMode[GreasedLineMeshColorMode["COLOR_MODE_SET"] = 0] = "COLOR_MODE_SET";
|
|
37
|
-
/**
|
|
38
|
-
* Color blending mode ADD
|
|
39
|
-
*/
|
|
40
|
-
GreasedLineMeshColorMode[GreasedLineMeshColorMode["COLOR_MODE_ADD"] = 1] = "COLOR_MODE_ADD";
|
|
41
|
-
/**
|
|
42
|
-
* Color blending mode ADD
|
|
43
|
-
*/
|
|
44
|
-
GreasedLineMeshColorMode[GreasedLineMeshColorMode["COLOR_MODE_MULTIPLY"] = 2] = "COLOR_MODE_MULTIPLY";
|
|
45
|
-
})(GreasedLineMeshColorMode || (GreasedLineMeshColorMode = {}));
|
|
46
|
-
/**
|
|
47
|
-
* Color distribution type of the @see colors.
|
|
48
|
-
* {@link https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param/greased_line#colordistributiontype}
|
|
49
|
-
*
|
|
50
|
-
*/
|
|
51
|
-
export var GreasedLineMeshColorDistributionType;
|
|
52
|
-
(function (GreasedLineMeshColorDistributionType) {
|
|
53
|
-
/**
|
|
54
|
-
* Colors distributed between segments of the line
|
|
55
|
-
*/
|
|
56
|
-
GreasedLineMeshColorDistributionType[GreasedLineMeshColorDistributionType["COLOR_DISTRIBUTION_TYPE_SEGMENT"] = 0] = "COLOR_DISTRIBUTION_TYPE_SEGMENT";
|
|
57
|
-
/**
|
|
58
|
-
* Colors distributed along the line ingoring the segments
|
|
59
|
-
*/
|
|
60
|
-
GreasedLineMeshColorDistributionType[GreasedLineMeshColorDistributionType["COLOR_DISTRIBUTION_TYPE_LINE"] = 1] = "COLOR_DISTRIBUTION_TYPE_LINE";
|
|
61
|
-
})(GreasedLineMeshColorDistributionType || (GreasedLineMeshColorDistributionType = {}));
|
|
1
|
+
import { RawTexture } from "../Textures/rawTexture.js";
|
|
2
|
+
import { MaterialPluginBase } from "../materialPluginBase.js";
|
|
3
|
+
import { Vector2, TmpVectors } from "../../Maths/math.vector.js";
|
|
4
|
+
import { MaterialDefines } from "../materialDefines.js";
|
|
5
|
+
import { RegisterClass } from "../../Misc/typeStore.js";
|
|
6
|
+
import { GreasedLineMeshColorDistributionType, GreasedLineMeshColorMode } from "./greasedLineMaterialInterfaces.js";
|
|
7
|
+
import { GreasedLineMaterialDefaults } from "./greasedLineMaterialDefaults.js";
|
|
8
|
+
import { GreasedLineTools } from "../../Misc/greasedLineTools.js";
|
|
62
9
|
/**
|
|
63
10
|
* @internal
|
|
64
11
|
*/
|
|
@@ -84,51 +31,72 @@ export class MaterialGreasedLineDefines extends MaterialDefines {
|
|
|
84
31
|
* True if scene is in right handed coordinate system.
|
|
85
32
|
*/
|
|
86
33
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
87
|
-
this.
|
|
34
|
+
this.GREASED_LINE_RIGHT_HANDED_COORDINATE_SYSTEM = false;
|
|
35
|
+
/**
|
|
36
|
+
* True if the line is in camera facing mode
|
|
37
|
+
*/
|
|
38
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
39
|
+
this.GREASED_LINE_CAMERA_FACING = true;
|
|
88
40
|
}
|
|
89
41
|
}
|
|
90
42
|
/**
|
|
91
|
-
* GreasedLinePluginMaterial for GreasedLineMesh
|
|
43
|
+
* GreasedLinePluginMaterial for GreasedLineMesh/GreasedLineRibbonMesh.
|
|
44
|
+
* Use the GreasedLineBuilder.CreateGreasedLineMaterial function to create and instance of this class.
|
|
92
45
|
*/
|
|
93
46
|
export class GreasedLinePluginMaterial extends MaterialPluginBase {
|
|
47
|
+
/**
|
|
48
|
+
* Creates a new instance of the GreasedLinePluginMaterial
|
|
49
|
+
* @param material base material for the plugin
|
|
50
|
+
* @param scene the scene
|
|
51
|
+
* @param options plugin options
|
|
52
|
+
*/
|
|
94
53
|
constructor(material, scene, options) {
|
|
95
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
54
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
96
55
|
options = options || {
|
|
97
|
-
color:
|
|
56
|
+
color: GreasedLineMaterialDefaults.DEFAULT_COLOR,
|
|
98
57
|
};
|
|
99
58
|
const defines = new MaterialGreasedLineDefines();
|
|
100
|
-
defines.GREASED_LINE_HAS_COLOR = !!options.color;
|
|
59
|
+
defines.GREASED_LINE_HAS_COLOR = !!options.color && !options.useColors;
|
|
101
60
|
defines.GREASED_LINE_SIZE_ATTENUATION = (_a = options.sizeAttenuation) !== null && _a !== void 0 ? _a : false;
|
|
102
61
|
defines.GREASED_LINE_COLOR_DISTRIBUTION_TYPE_LINE = options.colorDistributionType === GreasedLineMeshColorDistributionType.COLOR_DISTRIBUTION_TYPE_LINE;
|
|
103
|
-
defines.
|
|
62
|
+
defines.GREASED_LINE_RIGHT_HANDED_COORDINATE_SYSTEM = (scene !== null && scene !== void 0 ? scene : material.getScene()).useRightHandedSystem;
|
|
63
|
+
defines.GREASED_LINE_CAMERA_FACING = (_b = options.cameraFacing) !== null && _b !== void 0 ? _b : true;
|
|
104
64
|
super(material, GreasedLinePluginMaterial.GREASED_LINE_MATERIAL_NAME, 200, defines);
|
|
65
|
+
/**
|
|
66
|
+
* You can provide a colorsTexture to use instead of one generated from the 'colors' option
|
|
67
|
+
*/
|
|
68
|
+
this.colorsTexture = null;
|
|
105
69
|
this._scene = scene !== null && scene !== void 0 ? scene : material.getScene();
|
|
106
70
|
this._engine = this._scene.getEngine();
|
|
107
|
-
this.
|
|
108
|
-
this.
|
|
109
|
-
this.
|
|
110
|
-
this.
|
|
111
|
-
this.
|
|
112
|
-
this.
|
|
113
|
-
this.
|
|
114
|
-
this.
|
|
115
|
-
this.
|
|
116
|
-
this.
|
|
117
|
-
this.
|
|
118
|
-
this.
|
|
119
|
-
this.
|
|
120
|
-
this.
|
|
121
|
-
|
|
122
|
-
|
|
71
|
+
this._cameraFacing = (_c = options.cameraFacing) !== null && _c !== void 0 ? _c : true;
|
|
72
|
+
this.visibility = (_d = options.visibility) !== null && _d !== void 0 ? _d : 1;
|
|
73
|
+
this.useDash = (_e = options.useDash) !== null && _e !== void 0 ? _e : false;
|
|
74
|
+
this.dashRatio = (_f = options.dashRatio) !== null && _f !== void 0 ? _f : 0.5;
|
|
75
|
+
this.dashOffset = (_g = options.dashOffset) !== null && _g !== void 0 ? _g : 0;
|
|
76
|
+
this.width = options.width ? options.width : options.sizeAttenuation ? GreasedLineMaterialDefaults.DEFAULT_WIDTH_ATTENUATED : GreasedLineMaterialDefaults.DEFAULT_WIDTH;
|
|
77
|
+
this._sizeAttenuation = (_h = options.sizeAttenuation) !== null && _h !== void 0 ? _h : false;
|
|
78
|
+
this.colorMode = (_j = options.colorMode) !== null && _j !== void 0 ? _j : GreasedLineMeshColorMode.COLOR_MODE_SET;
|
|
79
|
+
this._color = (_k = options.color) !== null && _k !== void 0 ? _k : null;
|
|
80
|
+
this.useColors = (_l = options.useColors) !== null && _l !== void 0 ? _l : false;
|
|
81
|
+
this._colorsDistributionType = (_m = options.colorDistributionType) !== null && _m !== void 0 ? _m : GreasedLineMeshColorDistributionType.COLOR_DISTRIBUTION_TYPE_SEGMENT;
|
|
82
|
+
this.colorsSampling = (_o = options.colorsSampling) !== null && _o !== void 0 ? _o : RawTexture.NEAREST_NEAREST;
|
|
83
|
+
this._colors = (_p = options.colors) !== null && _p !== void 0 ? _p : null;
|
|
84
|
+
this.dashCount = (_q = options.dashCount) !== null && _q !== void 0 ? _q : 1; // calculate the _dashArray value, call the setter
|
|
85
|
+
this.resolution = (_r = options.resolution) !== null && _r !== void 0 ? _r : new Vector2(this._engine.getRenderWidth(), this._engine.getRenderHeight()); // calculate aspect call the setter
|
|
86
|
+
if (options.colorsTexture) {
|
|
87
|
+
this.colorsTexture = options.colorsTexture; // colorsTexture from options takes precedence
|
|
123
88
|
}
|
|
124
89
|
else {
|
|
125
|
-
|
|
126
|
-
|
|
90
|
+
if (this._colors) {
|
|
91
|
+
this.colorsTexture = GreasedLineTools.CreateColorsTexture(`${material.name}-colors-texture`, this._colors, this.colorsSampling, this._scene);
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
this._color = (_s = this._color) !== null && _s !== void 0 ? _s : GreasedLineMaterialDefaults.DEFAULT_COLOR;
|
|
95
|
+
GreasedLineTools.PrepareEmptyColorsTexture(this._scene);
|
|
96
|
+
}
|
|
127
97
|
}
|
|
128
98
|
this._engine.onDisposeObservable.add(() => {
|
|
129
|
-
|
|
130
|
-
(_a = GreasedLinePluginMaterial._EmptyColorsTexture) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
131
|
-
GreasedLinePluginMaterial._EmptyColorsTexture = null;
|
|
99
|
+
GreasedLineTools.DisposeEmptyColorsTexture();
|
|
132
100
|
});
|
|
133
101
|
this._enable(true); // always enabled
|
|
134
102
|
}
|
|
@@ -138,10 +106,16 @@ export class GreasedLinePluginMaterial extends MaterialPluginBase {
|
|
|
138
106
|
*/
|
|
139
107
|
getAttributes(attributes) {
|
|
140
108
|
attributes.push("grl_offsets");
|
|
141
|
-
attributes.push("grl_previousAndSide");
|
|
142
|
-
attributes.push("grl_nextAndCounters");
|
|
143
109
|
attributes.push("grl_widths");
|
|
144
110
|
attributes.push("grl_colorPointers");
|
|
111
|
+
attributes.push("grl_counters");
|
|
112
|
+
if (this._cameraFacing) {
|
|
113
|
+
attributes.push("grl_previousAndSide");
|
|
114
|
+
attributes.push("grl_nextAndCounters");
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
attributes.push("grl_slopes");
|
|
118
|
+
}
|
|
145
119
|
}
|
|
146
120
|
/**
|
|
147
121
|
* Get the shader samplers
|
|
@@ -155,8 +129,8 @@ export class GreasedLinePluginMaterial extends MaterialPluginBase {
|
|
|
155
129
|
* @param activeTextures
|
|
156
130
|
*/
|
|
157
131
|
getActiveTextures(activeTextures) {
|
|
158
|
-
if (this.
|
|
159
|
-
activeTextures.push(this.
|
|
132
|
+
if (this.colorsTexture) {
|
|
133
|
+
activeTextures.push(this.colorsTexture);
|
|
160
134
|
}
|
|
161
135
|
}
|
|
162
136
|
/**
|
|
@@ -165,18 +139,21 @@ export class GreasedLinePluginMaterial extends MaterialPluginBase {
|
|
|
165
139
|
*/
|
|
166
140
|
getUniforms() {
|
|
167
141
|
const ubo = [
|
|
168
|
-
{ name: "grl_projection", size: 16, type: "mat4" },
|
|
169
142
|
{ name: "grl_singleColor", size: 3, type: "vec3" },
|
|
170
|
-
{ name: "grl_aspect_resolution_lineWidth", size: 4, type: "vec4" },
|
|
171
143
|
{ name: "grl_dashOptions", size: 4, type: "vec4" },
|
|
172
144
|
{ name: "grl_colorMode_visibility_colorsWidth_useColors", size: 4, type: "vec4" },
|
|
173
145
|
];
|
|
146
|
+
if (this._cameraFacing) {
|
|
147
|
+
ubo.push({ name: "grl_projection", size: 16, type: "mat4" }, { name: "grl_aspect_resolution_lineWidth", size: 4, type: "vec4" });
|
|
148
|
+
}
|
|
174
149
|
return {
|
|
175
150
|
ubo,
|
|
176
|
-
vertex:
|
|
151
|
+
vertex: this._cameraFacing
|
|
152
|
+
? `
|
|
177
153
|
uniform vec4 grl_aspect_resolution_lineWidth;
|
|
178
154
|
uniform mat4 grl_projection;
|
|
179
|
-
|
|
155
|
+
`
|
|
156
|
+
: "",
|
|
180
157
|
fragment: `
|
|
181
158
|
uniform vec4 grl_dashOptions;
|
|
182
159
|
uniform vec4 grl_colorMode_visibility_colorsWidth_useColors;
|
|
@@ -195,22 +172,24 @@ export class GreasedLinePluginMaterial extends MaterialPluginBase {
|
|
|
195
172
|
*/
|
|
196
173
|
bindForSubMesh(uniformBuffer) {
|
|
197
174
|
var _a;
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
175
|
+
if (this._cameraFacing) {
|
|
176
|
+
const activeCamera = this._scene.activeCamera;
|
|
177
|
+
if (activeCamera) {
|
|
178
|
+
const projection = activeCamera.getProjectionMatrix();
|
|
179
|
+
uniformBuffer.updateMatrix("grl_projection", projection);
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
throw Error("GreasedLinePluginMaterial requires an active camera.");
|
|
183
|
+
}
|
|
184
|
+
const resolutionLineWidth = TmpVectors.Vector4[0];
|
|
185
|
+
resolutionLineWidth.x = this._aspect;
|
|
186
|
+
resolutionLineWidth.y = this._resolution.x;
|
|
187
|
+
resolutionLineWidth.z = this._resolution.y;
|
|
188
|
+
resolutionLineWidth.w = this.width;
|
|
189
|
+
uniformBuffer.updateVector4("grl_aspect_resolution_lineWidth", resolutionLineWidth);
|
|
202
190
|
}
|
|
203
|
-
else {
|
|
204
|
-
throw Error("GreasedLinePluginMaterial requires an active camera.");
|
|
205
|
-
}
|
|
206
|
-
const resolutionLineWidth = TmpVectors.Vector4[0];
|
|
207
|
-
resolutionLineWidth.x = this._aspect;
|
|
208
|
-
resolutionLineWidth.y = this._resolution.x;
|
|
209
|
-
resolutionLineWidth.z = this._resolution.y;
|
|
210
|
-
resolutionLineWidth.w = this.width;
|
|
211
|
-
uniformBuffer.updateVector4("grl_aspect_resolution_lineWidth", resolutionLineWidth);
|
|
212
191
|
const dashOptions = TmpVectors.Vector4[0];
|
|
213
|
-
dashOptions.x =
|
|
192
|
+
dashOptions.x = GreasedLineTools.BooleanToNumber(this.useDash);
|
|
214
193
|
dashOptions.y = this._dashArray;
|
|
215
194
|
dashOptions.z = this.dashOffset;
|
|
216
195
|
dashOptions.w = this.dashRatio;
|
|
@@ -218,13 +197,13 @@ export class GreasedLinePluginMaterial extends MaterialPluginBase {
|
|
|
218
197
|
const colorModeVisibilityColorsWidthUseColors = TmpVectors.Vector4[1];
|
|
219
198
|
colorModeVisibilityColorsWidthUseColors.x = this.colorMode;
|
|
220
199
|
colorModeVisibilityColorsWidthUseColors.y = this.visibility;
|
|
221
|
-
colorModeVisibilityColorsWidthUseColors.z = this.
|
|
222
|
-
colorModeVisibilityColorsWidthUseColors.w =
|
|
200
|
+
colorModeVisibilityColorsWidthUseColors.z = this.colorsTexture ? this.colorsTexture.getSize().width : 0;
|
|
201
|
+
colorModeVisibilityColorsWidthUseColors.w = GreasedLineTools.BooleanToNumber(this.useColors);
|
|
223
202
|
uniformBuffer.updateVector4("grl_colorMode_visibility_colorsWidth_useColors", colorModeVisibilityColorsWidthUseColors);
|
|
224
203
|
if (this._color) {
|
|
225
204
|
uniformBuffer.updateColor3("grl_singleColor", this._color);
|
|
226
205
|
}
|
|
227
|
-
uniformBuffer.setTexture("grl_colors", (_a = this.
|
|
206
|
+
uniformBuffer.setTexture("grl_colors", (_a = this.colorsTexture) !== null && _a !== void 0 ? _a : GreasedLineMaterialDefaults.EmptyColorsTexture);
|
|
228
207
|
}
|
|
229
208
|
/**
|
|
230
209
|
* Prepare the defines
|
|
@@ -233,11 +212,11 @@ export class GreasedLinePluginMaterial extends MaterialPluginBase {
|
|
|
233
212
|
* @param _mesh
|
|
234
213
|
*/
|
|
235
214
|
prepareDefines(defines, _scene, _mesh) {
|
|
236
|
-
|
|
237
|
-
defines.
|
|
238
|
-
defines.GREASED_LINE_SIZE_ATTENUATION = (_a = this._sizeAttenuation) !== null && _a !== void 0 ? _a : false;
|
|
215
|
+
defines.GREASED_LINE_HAS_COLOR = !!this.color && !this.useColors;
|
|
216
|
+
defines.GREASED_LINE_SIZE_ATTENUATION = this._sizeAttenuation;
|
|
239
217
|
defines.GREASED_LINE_COLOR_DISTRIBUTION_TYPE_LINE = this._colorsDistributionType === GreasedLineMeshColorDistributionType.COLOR_DISTRIBUTION_TYPE_LINE;
|
|
240
|
-
defines.
|
|
218
|
+
defines.GREASED_LINE_RIGHT_HANDED_COORDINATE_SYSTEM = _scene.useRightHandedSystem;
|
|
219
|
+
defines.GREASED_LINE_CAMERA_FACING = this._cameraFacing;
|
|
241
220
|
}
|
|
242
221
|
/**
|
|
243
222
|
* Get the class name
|
|
@@ -253,36 +232,48 @@ export class GreasedLinePluginMaterial extends MaterialPluginBase {
|
|
|
253
232
|
*/
|
|
254
233
|
getCustomCode(shaderType) {
|
|
255
234
|
if (shaderType === "vertex") {
|
|
256
|
-
|
|
235
|
+
const obj = {
|
|
257
236
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
258
237
|
CUSTOM_VERTEX_DEFINITIONS: `
|
|
238
|
+
attribute float grl_widths;
|
|
239
|
+
attribute vec3 grl_offsets;
|
|
240
|
+
attribute float grl_colorPointers;
|
|
241
|
+
|
|
242
|
+
varying float grlCounters;
|
|
243
|
+
varying float grlColorPointer;
|
|
244
|
+
|
|
245
|
+
#ifdef GREASED_LINE_CAMERA_FACING
|
|
259
246
|
attribute vec4 grl_previousAndSide;
|
|
260
247
|
attribute vec4 grl_nextAndCounters;
|
|
261
|
-
attribute float grl_widths;
|
|
262
|
-
attribute vec3 grl_offsets;
|
|
263
|
-
attribute float grl_colorPointers;
|
|
264
|
-
|
|
265
|
-
varying float grlCounters;
|
|
266
|
-
varying float grlColorPointer;
|
|
267
248
|
|
|
268
249
|
vec2 grlFix( vec4 i, float aspect ) {
|
|
269
250
|
vec2 res = i.xy / i.w;
|
|
270
251
|
res.x *= aspect;
|
|
271
252
|
return res;
|
|
272
253
|
}
|
|
254
|
+
#else
|
|
255
|
+
attribute vec3 grl_slopes;
|
|
256
|
+
attribute float grl_counters;
|
|
257
|
+
#endif
|
|
273
258
|
`,
|
|
274
259
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
275
260
|
CUSTOM_VERTEX_UPDATE_POSITION: `
|
|
261
|
+
#ifdef GREASED_LINE_CAMERA_FACING
|
|
276
262
|
vec3 grlPositionOffset = grl_offsets;
|
|
277
263
|
positionUpdated += grlPositionOffset;
|
|
264
|
+
#else
|
|
265
|
+
positionUpdated = (positionUpdated + grl_offsets) + (grl_slopes * grl_widths);
|
|
266
|
+
#endif
|
|
278
267
|
`,
|
|
279
268
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
280
269
|
CUSTOM_VERTEX_MAIN_END: `
|
|
270
|
+
grlColorPointer = grl_colorPointers;
|
|
271
|
+
|
|
272
|
+
#ifdef GREASED_LINE_CAMERA_FACING
|
|
281
273
|
|
|
282
274
|
float grlAspect = grl_aspect_resolution_lineWidth.x;
|
|
283
275
|
float grlBaseWidth = grl_aspect_resolution_lineWidth.w;
|
|
284
276
|
|
|
285
|
-
grlColorPointer = grl_colorPointers;
|
|
286
277
|
|
|
287
278
|
vec3 grlPrevious = grl_previousAndSide.xyz;
|
|
288
279
|
float grlSide = grl_previousAndSide.w;
|
|
@@ -311,25 +302,30 @@ export class GreasedLinePluginMaterial extends MaterialPluginBase {
|
|
|
311
302
|
grlDir = normalize( grlDir1 + grlDir2 );
|
|
312
303
|
}
|
|
313
304
|
vec4 grlNormal = vec4( -grlDir.y, grlDir.x, 0., 1. );
|
|
314
|
-
#ifdef
|
|
305
|
+
#ifdef GREASED_LINE_RIGHT_HANDED_COORDINATE_SYSTEM
|
|
315
306
|
grlNormal.xy *= -.5 * grlWidth;
|
|
316
307
|
#else
|
|
317
308
|
grlNormal.xy *= .5 * grlWidth;
|
|
318
309
|
#endif
|
|
310
|
+
|
|
319
311
|
grlNormal *= grl_projection;
|
|
312
|
+
|
|
320
313
|
#ifdef GREASED_LINE_SIZE_ATTENUATION
|
|
321
314
|
grlNormal.xy *= grlFinalPosition.w;
|
|
322
315
|
grlNormal.xy /= ( vec4( grl_aspect_resolution_lineWidth.yz, 0., 1. ) * grl_projection ).xy;
|
|
323
316
|
#endif
|
|
317
|
+
|
|
324
318
|
grlFinalPosition.xy += grlNormal.xy * grlSide;
|
|
325
319
|
gl_Position = grlFinalPosition;
|
|
326
320
|
|
|
327
321
|
vPositionW = vec3(grlFinalPosition);
|
|
328
|
-
|
|
322
|
+
#else
|
|
323
|
+
grlCounters = grl_counters;
|
|
324
|
+
#endif
|
|
329
325
|
`,
|
|
330
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
331
|
-
"!gl_Position\\=viewProjection\\*worldPos;": "//", // remove
|
|
332
326
|
};
|
|
327
|
+
this._cameraFacing && (obj["!gl_Position\\=viewProjection\\*worldPos;"] = "//"); // not needed for camera facing GRL
|
|
328
|
+
return obj;
|
|
333
329
|
}
|
|
334
330
|
if (shaderType === "fragment") {
|
|
335
331
|
return {
|
|
@@ -383,50 +379,18 @@ export class GreasedLinePluginMaterial extends MaterialPluginBase {
|
|
|
383
379
|
}
|
|
384
380
|
}
|
|
385
381
|
#endif
|
|
382
|
+
|
|
386
383
|
`,
|
|
387
384
|
};
|
|
388
385
|
}
|
|
389
386
|
return null;
|
|
390
387
|
}
|
|
391
|
-
/**
|
|
392
|
-
* Converts boolean to number.
|
|
393
|
-
* @param bool
|
|
394
|
-
* @returns 1 if true, 0 if false.
|
|
395
|
-
*/
|
|
396
|
-
static _BooleanToNumber(bool) {
|
|
397
|
-
return bool ? 1 : 0;
|
|
398
|
-
}
|
|
399
|
-
/**
|
|
400
|
-
* Converts an array of Color3 to Uint8Array
|
|
401
|
-
* @param colors Arrray of Color3
|
|
402
|
-
* @returns Uin8Array of colors [r, g, b, a, r, g, b, a, ...]
|
|
403
|
-
*/
|
|
404
|
-
static _Color3toRGBAUint8(colors) {
|
|
405
|
-
const colorTable = new Uint8Array(colors.length * 4);
|
|
406
|
-
for (let i = 0, j = 0; i < colors.length; i++) {
|
|
407
|
-
colorTable[j++] = colors[i].r * 255;
|
|
408
|
-
colorTable[j++] = colors[i].g * 255;
|
|
409
|
-
colorTable[j++] = colors[i].b * 255;
|
|
410
|
-
colorTable[j++] = 255;
|
|
411
|
-
}
|
|
412
|
-
return colorTable;
|
|
413
|
-
}
|
|
414
|
-
/**
|
|
415
|
-
* Creates a RawTexture from an RGBA color array and sets it on the plugin material instance.
|
|
416
|
-
* @param name name of the texture
|
|
417
|
-
* @param colors Uint8Array of colors
|
|
418
|
-
*/
|
|
419
|
-
_createColorsTexture(name, colors) {
|
|
420
|
-
const colorsArray = GreasedLinePluginMaterial._Color3toRGBAUint8(colors);
|
|
421
|
-
this._colorsTexture = new RawTexture(colorsArray, colors.length, 1, Engine.TEXTUREFORMAT_RGBA, this._scene, false, true, this.colorsSampling);
|
|
422
|
-
this._colorsTexture.name = name;
|
|
423
|
-
}
|
|
424
388
|
/**
|
|
425
389
|
* Disposes the plugin material.
|
|
426
390
|
*/
|
|
427
391
|
dispose() {
|
|
428
392
|
var _a;
|
|
429
|
-
(_a = this.
|
|
393
|
+
(_a = this.colorsTexture) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
430
394
|
super.dispose();
|
|
431
395
|
}
|
|
432
396
|
/**
|
|
@@ -453,19 +417,19 @@ export class GreasedLinePluginMaterial extends MaterialPluginBase {
|
|
|
453
417
|
const origColorsCount = (_b = (_a = this._colors) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
|
|
454
418
|
this._colors = colors;
|
|
455
419
|
if (colors === null || colors.length === 0) {
|
|
456
|
-
(_c = this.
|
|
420
|
+
(_c = this.colorsTexture) === null || _c === void 0 ? void 0 : _c.dispose();
|
|
457
421
|
return;
|
|
458
422
|
}
|
|
459
423
|
if (lazy && !forceNewTexture) {
|
|
460
424
|
return;
|
|
461
425
|
}
|
|
462
|
-
if (this.
|
|
463
|
-
const colorArray =
|
|
464
|
-
this.
|
|
426
|
+
if (this.colorsTexture && origColorsCount === colors.length && !forceNewTexture) {
|
|
427
|
+
const colorArray = GreasedLineTools.Color3toRGBAUint8(colors);
|
|
428
|
+
this.colorsTexture.update(colorArray);
|
|
465
429
|
}
|
|
466
430
|
else {
|
|
467
|
-
(_d = this.
|
|
468
|
-
this.
|
|
431
|
+
(_d = this.colorsTexture) === null || _d === void 0 ? void 0 : _d.dispose();
|
|
432
|
+
this.colorsTexture = GreasedLineTools.CreateColorsTexture(`${this._material.name}-colors-texture`, colors, this.colorsSampling, this._scene);
|
|
469
433
|
}
|
|
470
434
|
}
|
|
471
435
|
/**
|
|
@@ -491,14 +455,16 @@ export class GreasedLinePluginMaterial extends MaterialPluginBase {
|
|
|
491
455
|
this._dashArray = 1 / value;
|
|
492
456
|
}
|
|
493
457
|
/**
|
|
494
|
-
*
|
|
458
|
+
* If set to true the line will be rendered always with the same width regardless how far it is located from the camera.
|
|
459
|
+
* Not supported for non camera facing lines.
|
|
495
460
|
*/
|
|
496
461
|
get sizeAttenuation() {
|
|
497
462
|
return this._sizeAttenuation;
|
|
498
463
|
}
|
|
499
464
|
/**
|
|
500
|
-
* Turn on/off attenuation of the width option and widths array.
|
|
501
|
-
*
|
|
465
|
+
* Turn on/off size attenuation of the width option and widths array.
|
|
466
|
+
* Not supported for non camera facing lines.
|
|
467
|
+
* @param value If set to true the line will be rendered always with the same width regardless how far it is located from the camera.
|
|
502
468
|
*/
|
|
503
469
|
set sizeAttenuation(value) {
|
|
504
470
|
this._sizeAttenuation = value;
|
|
@@ -594,15 +560,10 @@ export class GreasedLinePluginMaterial extends MaterialPluginBase {
|
|
|
594
560
|
var _a;
|
|
595
561
|
super.parse(source, scene, rootUrl);
|
|
596
562
|
const greasedLineMaterialOptions = source.greasedLineMaterialOptions;
|
|
597
|
-
(_a = this.
|
|
598
|
-
if (greasedLineMaterialOptions.colors) {
|
|
599
|
-
this._createColorsTexture(`${this._material.name}-colors-texture`, greasedLineMaterialOptions.colors);
|
|
600
|
-
}
|
|
601
|
-
else {
|
|
602
|
-
GreasedLinePluginMaterial._PrepareEmptyColorsTexture(scene);
|
|
603
|
-
}
|
|
563
|
+
(_a = this.colorsTexture) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
604
564
|
greasedLineMaterialOptions.color && this.setColor(greasedLineMaterialOptions.color, true);
|
|
605
565
|
greasedLineMaterialOptions.colorDistributionType && (this.colorsDistributionType = greasedLineMaterialOptions.colorDistributionType);
|
|
566
|
+
greasedLineMaterialOptions.colors && (this.colors = greasedLineMaterialOptions.colors);
|
|
606
567
|
greasedLineMaterialOptions.colorsSampling && (this.colorsSampling = greasedLineMaterialOptions.colorsSampling);
|
|
607
568
|
greasedLineMaterialOptions.colorMode && (this.colorMode = greasedLineMaterialOptions.colorMode);
|
|
608
569
|
greasedLineMaterialOptions.useColors && (this.useColors = greasedLineMaterialOptions.useColors);
|
|
@@ -614,6 +575,12 @@ export class GreasedLinePluginMaterial extends MaterialPluginBase {
|
|
|
614
575
|
greasedLineMaterialOptions.width && (this.width = greasedLineMaterialOptions.width);
|
|
615
576
|
greasedLineMaterialOptions.sizeAttenuation && (this.sizeAttenuation = greasedLineMaterialOptions.sizeAttenuation);
|
|
616
577
|
greasedLineMaterialOptions.resolution && (this.resolution = greasedLineMaterialOptions.resolution);
|
|
578
|
+
if (this.colors) {
|
|
579
|
+
this.colorsTexture = GreasedLineTools.CreateColorsTexture(`${this._material.name}-colors-texture`, this.colors, this.colorsSampling, scene);
|
|
580
|
+
}
|
|
581
|
+
else {
|
|
582
|
+
GreasedLineTools.PrepareEmptyColorsTexture(scene);
|
|
583
|
+
}
|
|
617
584
|
this.markAllDefinesAsDirty();
|
|
618
585
|
}
|
|
619
586
|
/**
|
|
@@ -623,9 +590,9 @@ export class GreasedLinePluginMaterial extends MaterialPluginBase {
|
|
|
623
590
|
copyTo(plugin) {
|
|
624
591
|
var _a;
|
|
625
592
|
const dest = plugin;
|
|
626
|
-
(_a = dest.
|
|
593
|
+
(_a = dest.colorsTexture) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
627
594
|
if (this._colors) {
|
|
628
|
-
dest.
|
|
595
|
+
dest.colorsTexture = GreasedLineTools.CreateColorsTexture(`${dest._material.name}-colors-texture`, this._colors, dest.colorsSampling, this._scene);
|
|
629
596
|
}
|
|
630
597
|
dest.setColor(this.color, true);
|
|
631
598
|
dest.colorsDistributionType = this.colorsDistributionType;
|
|
@@ -642,34 +609,10 @@ export class GreasedLinePluginMaterial extends MaterialPluginBase {
|
|
|
642
609
|
dest.resolution = this.resolution;
|
|
643
610
|
dest.markAllDefinesAsDirty();
|
|
644
611
|
}
|
|
645
|
-
/**
|
|
646
|
-
* A minimum size texture for the colors sampler2D when there is no colors texture defined yet.
|
|
647
|
-
* For fast switching using the useColors property without the need to use defines.
|
|
648
|
-
* @param scene Scene
|
|
649
|
-
*/
|
|
650
|
-
static _PrepareEmptyColorsTexture(scene) {
|
|
651
|
-
if (!this._EmptyColorsTexture) {
|
|
652
|
-
const colorsArray = new Uint8Array(4);
|
|
653
|
-
GreasedLinePluginMaterial._EmptyColorsTexture = new RawTexture(colorsArray, 1, 1, Engine.TEXTUREFORMAT_RGBA, scene, false, false, RawTexture.NEAREST_NEAREST);
|
|
654
|
-
GreasedLinePluginMaterial._EmptyColorsTexture.name = "grlEmptyColorsTexture";
|
|
655
|
-
}
|
|
656
|
-
}
|
|
657
612
|
}
|
|
658
613
|
/**
|
|
659
614
|
* Plugin name
|
|
660
615
|
*/
|
|
661
616
|
GreasedLinePluginMaterial.GREASED_LINE_MATERIAL_NAME = "GreasedLinePluginMaterial";
|
|
662
|
-
/**
|
|
663
|
-
* Default line color for newly created lines
|
|
664
|
-
*/
|
|
665
|
-
GreasedLinePluginMaterial.DEFAULT_COLOR = Color3.White();
|
|
666
|
-
/**
|
|
667
|
-
* Default line width when sizeAttenuation is true
|
|
668
|
-
*/
|
|
669
|
-
GreasedLinePluginMaterial.DEFAULT_WIDTH_ATTENUATED = 1;
|
|
670
|
-
/**
|
|
671
|
-
* Defaule line width
|
|
672
|
-
*/
|
|
673
|
-
GreasedLinePluginMaterial.DEFAULT_WIDTH = 0.1;
|
|
674
617
|
RegisterClass(`BABYLON.${GreasedLinePluginMaterial.GREASED_LINE_MATERIAL_NAME}`, GreasedLinePluginMaterial);
|
|
675
618
|
//# sourceMappingURL=greasedLinePluginMaterial.js.map
|