@babylonjs/core 6.24.0 → 6.25.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/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/Debug/debugLayer.js +2 -2
- package/Debug/debugLayer.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/WebGPU/webgpuTintWASM.js +4 -10
- package/Engines/WebGPU/webgpuTintWASM.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 +9 -14
- 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 +13 -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 -13
- 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 -9
- 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/Node/nodeMaterial.js +2 -2
- package/Materials/Node/nodeMaterial.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/Materials/shadowDepthWrapper.d.ts +1 -0
- package/Materials/shadowDepthWrapper.js +17 -4
- package/Materials/shadowDepthWrapper.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/Compression/dracoCompression.js +7 -7
- package/Meshes/Compression/dracoCompression.js.map +1 -1
- package/Meshes/Compression/meshoptCompression.js +2 -2
- package/Meshes/Compression/meshoptCompression.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 +93 -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/Instances/instantiateRadialBlock.d.ts +1 -1
- package/Meshes/Node/Blocks/Instances/instantiateRadialBlock.js.map +1 -1
- 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 +5 -6
- 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/instancedMesh.js +9 -9
- package/Meshes/instancedMesh.js.map +1 -1
- package/Meshes/mesh.d.ts +4 -0
- package/Meshes/mesh.js +10 -1
- package/Meshes/mesh.js.map +1 -1
- package/Misc/basis.js +4 -4
- package/Misc/basis.js.map +1 -1
- package/Misc/deepCopier.js +3 -0
- package/Misc/deepCopier.js.map +1 -1
- package/Misc/fileTools.d.ts +2 -0
- package/Misc/fileTools.js +12 -3
- package/Misc/fileTools.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/Misc/khronosTextureContainer2.js +21 -24
- package/Misc/khronosTextureContainer2.js.map +1 -1
- package/Misc/tools.d.ts +42 -2
- package/Misc/tools.js +102 -2
- package/Misc/tools.js.map +1 -1
- package/Particles/solidParticleSystem.d.ts +1 -1
- package/Particles/solidParticleSystem.js +2 -2
- package/Particles/solidParticleSystem.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/ShadersInclude/bonesDeclaration.js +1 -1
- package/Shaders/ShadersInclude/bonesDeclaration.js.map +1 -1
- package/Shaders/ShadersInclude/morphTargetsVertexGlobalDeclaration.js +1 -2
- package/Shaders/ShadersInclude/morphTargetsVertexGlobalDeclaration.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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gamepadManager.js","sourceRoot":"","sources":["../../../../dev/core/src/Gamepads/gamepadManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAG5D,OAAO,EAAE,2BAA2B,EAAE,MAAM,+CAA+C,CAAC;AAC5F,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC;;GAEG;AACH,MAAM,OAAO,cAAc;IAsBvB;;;OAGG;IACH,YAAoB,MAAc;QAAd,WAAM,GAAN,MAAM,CAAQ;QAzB1B,qBAAgB,GAAmB,EAAE,CAAC;QACtC,yBAAoB,GAAY,KAAK,CAAC;QAE9C,gBAAgB;QACT,kBAAa,GAAY,KAAK,CAAC;QAStC;;WAEG;QACI,oCAA+B,GAAG,IAAI,UAAU,EAAW,CAAC;QAU/D,I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AAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACtE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACtC,MAAM,OAAO,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;YAC5B,IAAI,OAAO,EAAE;gBACT,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;oBACvC,MAAM,UAAU,GAAG,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;oBAChD,IAAI,CAAC,4BAA4B,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC;iBACjE;qBAAM;oBACH,iEAAiE;oBACjE,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,cAAc,GAAG,OAAO,CAAC;oBAElD,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE;wBACvC,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,YAAY,GAAG,IAAI,CAAC;wBAC7C,IAAI,CAAC,4BAA4B,CAAC,eAAe,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC;qBAC/E;iBACJ;aACJ;SACJ;IACL,CAAC;CACJ","sourcesContent":["import { Observable } from \"../Misc/observable\";\r\nimport { IsWindowObjectExist } from \"../Misc/domManagement\";\r\nimport type { Nullable } from \"../types\";\r\nimport type { Scene } from \"../scene\";\r\nimport { PoseEnabledControllerHelper } from \"../Gamepads/Controllers/poseEnabledController\";\r\nimport { Xbox360Pad } from \"./xboxGamepad\";\r\nimport { Gamepad, GenericPad } from \"./gamepad\";\r\nimport { Engine } from \"../Engines/engine\";\r\nimport { DualShockPad } from \"./dualShockGamepad\";\r\nimport { Tools } from \"../Misc/tools\";\r\n/**\r\n * Manager for handling gamepads\r\n */\r\nexport class GamepadManager {\r\n private _babylonGamepads: Array<Gamepad> = [];\r\n private _oneGamepadConnected: boolean = false;\r\n\r\n /** @internal */\r\n public _isMonitoring: boolean = false;\r\n private _gamepadEventSupported: boolean;\r\n private _gamepadSupport?: () => Array<any>;\r\n\r\n /**\r\n * observable to be triggered when the gamepad controller has been connected\r\n */\r\n public onGamepadConnectedObservable: Observable<Gamepad>;\r\n\r\n /**\r\n * observable to be triggered when the gamepad controller has been disconnected\r\n */\r\n public onGamepadDisconnectedObservable = new Observable<Gamepad>();\r\n\r\n private _onGamepadConnectedEvent: Nullable<(evt: any) => void>;\r\n private _onGamepadDisconnectedEvent: Nullable<(evt: any) => void>;\r\n\r\n /**\r\n * Initializes the gamepad manager\r\n * @param _scene BabylonJS scene\r\n */\r\n constructor(private _scene?: Scene) {\r\n if (!IsWindowObjectExist()) {\r\n this._gamepadEventSupported = false;\r\n } else {\r\n this._gamepadEventSupported = \"GamepadEvent\" in window;\r\n this._gamepadSupport = navigator && navigator.getGamepads;\r\n }\r\n\r\n this.onGamepadConnectedObservable = new Observable<Gamepad>((observer) => {\r\n // This will be used to raise the onGamepadConnected for all gamepads ALREADY connected\r\n for (const i in this._babylonGamepads) {\r\n const gamepad = this._babylonGamepads[i];\r\n if (gamepad && gamepad._isConnected) {\r\n this.onGamepadConnectedObservable.notifyObserver(observer, gamepad);\r\n }\r\n }\r\n });\r\n\r\n this._onGamepadConnectedEvent = (evt) => {\r\n const gamepad = evt.gamepad;\r\n\r\n if (gamepad.index in this._babylonGamepads) {\r\n if (this._babylonGamepads[gamepad.index].isConnected) {\r\n return;\r\n }\r\n }\r\n\r\n let newGamepad: Gamepad;\r\n\r\n if (this._babylonGamepads[gamepad.index]) {\r\n newGamepad = this._babylonGamepads[gamepad.index];\r\n newGamepad.browserGamepad = gamepad;\r\n newGamepad._isConnected = true;\r\n } else {\r\n newGamepad = this._addNewGamepad(gamepad);\r\n }\r\n this.onGamepadConnectedObservable.notifyObservers(newGamepad);\r\n this._startMonitoringGamepads();\r\n };\r\n\r\n this._onGamepadDisconnectedEvent = (evt) => {\r\n const gamepad = evt.gamepad;\r\n\r\n // Remove the gamepad from the list of gamepads to monitor.\r\n for (const i in this._babylonGamepads) {\r\n if (this._babylonGamepads[i].index === gamepad.index) {\r\n const disconnectedGamepad = this._babylonGamepads[i];\r\n disconnectedGamepad._isConnected = false;\r\n\r\n this.onGamepadDisconnectedObservable.notifyObservers(disconnectedGamepad);\r\n disconnectedGamepad.dispose && disconnectedGamepad.dispose();\r\n break;\r\n }\r\n }\r\n };\r\n\r\n if (this._gamepadSupport) {\r\n //first add already-connected gamepads\r\n this._updateGamepadObjects();\r\n if (this._babylonGamepads.length) {\r\n this._startMonitoringGamepads();\r\n }\r\n // Checking if the gamepad connected event is supported (like in Firefox)\r\n if (this._gamepadEventSupported) {\r\n const hostWindow = this._scene ? this._scene.getEngine().getHostWindow() : window;\r\n\r\n if (hostWindow) {\r\n hostWindow.addEventListener(\"gamepadconnected\", this._onGamepadConnectedEvent, false);\r\n hostWindow.addEventListener(\"gamepaddisconnected\", this._onGamepadDisconnectedEvent, false);\r\n }\r\n } else {\r\n this._startMonitoringGamepads();\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * The gamepads in the game pad manager\r\n */\r\n public get gamepads(): Gamepad[] {\r\n return this._babylonGamepads;\r\n }\r\n\r\n /**\r\n * Get the gamepad controllers based on type\r\n * @param type The type of gamepad controller\r\n * @returns Nullable gamepad\r\n */\r\n public getGamepadByType(type: number = Gamepad.XBOX): Nullable<Gamepad> {\r\n for (const gamepad of this._babylonGamepads) {\r\n if (gamepad && gamepad.type === type) {\r\n return gamepad;\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Disposes the gamepad manager\r\n */\r\n public dispose() {\r\n if (this._gamepadEventSupported) {\r\n if (this._onGamepadConnectedEvent) {\r\n window.removeEventListener(\"gamepadconnected\", this._onGamepadConnectedEvent);\r\n }\r\n\r\n if (this._onGamepadDisconnectedEvent) {\r\n window.removeEventListener(\"gamepaddisconnected\", this._onGamepadDisconnectedEvent);\r\n }\r\n this._onGamepadConnectedEvent = null;\r\n this._onGamepadDisconnectedEvent = null;\r\n }\r\n\r\n this._babylonGamepads.forEach((gamepad) => {\r\n gamepad.dispose();\r\n });\r\n\r\n this.onGamepadConnectedObservable.clear();\r\n this.onGamepadDisconnectedObservable.clear();\r\n\r\n this._oneGamepadConnected = false;\r\n this._stopMonitoringGamepads();\r\n this._babylonGamepads = [];\r\n }\r\n\r\n private _addNewGamepad(gamepad: any): Gamepad {\r\n if (!this._oneGamepadConnected) {\r\n this._oneGamepadConnected = true;\r\n }\r\n\r\n let newGamepad;\r\n const dualShock: boolean = (<string>gamepad.id).search(\"054c\") !== -1 && (<string>gamepad.id).search(\"0ce6\") === -1;\r\n const xboxOne: boolean = (<string>gamepad.id).search(\"Xbox One\") !== -1;\r\n if (\r\n xboxOne ||\r\n (<string>gamepad.id).search(\"Xbox 360\") !== -1 ||\r\n (<string>gamepad.id).search(\"xinput\") !== -1 ||\r\n ((<string>gamepad.id).search(\"045e\") !== -1 && (<string>gamepad.id).search(\"Surface Dock\") === -1)\r\n ) {\r\n // make sure the Surface Dock Extender is not detected as an xbox controller\r\n newGamepad = new Xbox360Pad(gamepad.id, gamepad.index, gamepad, xboxOne);\r\n } else if (dualShock) {\r\n newGamepad = new DualShockPad(gamepad.id, gamepad.index, gamepad);\r\n }\r\n // if pose is supported, use the (WebVR) pose enabled controller\r\n else if (gamepad.pose) {\r\n newGamepad = PoseEnabledControllerHelper.InitiateController(gamepad);\r\n } else {\r\n newGamepad = new GenericPad(gamepad.id, gamepad.index, gamepad);\r\n }\r\n this._babylonGamepads[newGamepad.index] = newGamepad;\r\n return newGamepad;\r\n }\r\n\r\n private _startMonitoringGamepads() {\r\n if (!this._isMonitoring) {\r\n this._isMonitoring = true;\r\n //back-comp\r\n this._checkGamepadsStatus();\r\n }\r\n }\r\n\r\n private _stopMonitoringGamepads() {\r\n this._isMonitoring = false;\r\n }\r\n\r\n private _loggedErrors: number[];\r\n\r\n /** @internal */\r\n public _checkGamepadsStatus() {\r\n // Hack to be compatible Chrome\r\n this._updateGamepadObjects();\r\n\r\n for (const i in this._babylonGamepads) {\r\n const gamepad = this._babylonGamepads[i];\r\n if (!gamepad || !gamepad.isConnected) {\r\n continue;\r\n }\r\n try {\r\n gamepad.update();\r\n } catch {\r\n if (this._loggedErrors.indexOf(gamepad.index) === -1) {\r\n Tools.Warn(`Error updating gamepad ${gamepad.id}`);\r\n this._loggedErrors.push(gamepad.index);\r\n }\r\n }\r\n }\r\n\r\n if (this._isMonitoring) {\r\n Engine.QueueNewFrame(() => {\r\n this._checkGamepadsStatus();\r\n });\r\n }\r\n }\r\n\r\n // This function is called only on Chrome, which does not properly support\r\n // connection/disconnection events and forces you to recopy again the gamepad object\r\n private _updateGamepadObjects() {\r\n const gamepads = navigator.getGamepads ? navigator.getGamepads() : [];\r\n for (let i = 0; i < gamepads.length; i++) {\r\n const gamepad = gamepads[i];\r\n if (gamepad) {\r\n if (!this._babylonGamepads[gamepad.index]) {\r\n const newGamepad = this._addNewGamepad(gamepad);\r\n this.onGamepadConnectedObservable.notifyObservers(newGamepad);\r\n } else {\r\n // Forced to copy again this object for Chrome for unknown reason\r\n this._babylonGamepads[i].browserGamepad = gamepad;\r\n\r\n if (!this._babylonGamepads[i].isConnected) {\r\n this._babylonGamepads[i]._isConnected = true;\r\n this.onGamepadConnectedObservable.notifyObservers(this._babylonGamepads[i]);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"gamepadManager.js","sourceRoot":"","sources":["../../../../dev/core/src/Gamepads/gamepadManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAG5D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,WAA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AAC,KAAK,CAAC,CAAC;iBAC1C;aACJ;SACJ;QAED,IAAI,IAAI,CAAC,aAAa,EAAE;YACpB,MAAM,CAAC,aAAa,CAAC,GAAG,EAAE;gBACtB,IAAI,CAAC,oBAAoB,EAAE,CAAC;YAChC,CAAC,CAAC,CAAC;SACN;IACL,CAAC;IAED,0EAA0E;IAC1E,oFAAoF;IAC5E,qBAAqB;QACzB,MAAM,QAAQ,GAAG,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACtE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACtC,MAAM,OAAO,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;YAC5B,IAAI,OAAO,EAAE;gBACT,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;oBACvC,MAAM,UAAU,GAAG,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;oBAChD,IAAI,CAAC,4BAA4B,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC;iBACjE;qBAAM;oBACH,iEAAiE;oBACjE,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,cAAc,GAAG,OAAO,CAAC;oBAElD,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE;wBACvC,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,YAAY,GAAG,IAAI,CAAC;wBAC7C,IAAI,CAAC,4BAA4B,CAAC,eAAe,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC;qBAC/E;iBACJ;aACJ;SACJ;IACL,CAAC;CACJ","sourcesContent":["import { Observable } from \"../Misc/observable\";\r\nimport { IsWindowObjectExist } from \"../Misc/domManagement\";\r\nimport type { Nullable } from \"../types\";\r\nimport type { Scene } from \"../scene\";\r\nimport { Xbox360Pad } from \"./xboxGamepad\";\r\nimport { Gamepad, GenericPad } from \"./gamepad\";\r\nimport { Engine } from \"../Engines/engine\";\r\nimport { DualShockPad } from \"./dualShockGamepad\";\r\nimport { Tools } from \"../Misc/tools\";\r\n/**\r\n * Manager for handling gamepads\r\n */\r\nexport class GamepadManager {\r\n private _babylonGamepads: Array<Gamepad> = [];\r\n private _oneGamepadConnected: boolean = false;\r\n\r\n /** @internal */\r\n public _isMonitoring: boolean = false;\r\n private _gamepadEventSupported: boolean;\r\n private _gamepadSupport?: () => Array<any>;\r\n\r\n /**\r\n * observable to be triggered when the gamepad controller has been connected\r\n */\r\n public onGamepadConnectedObservable: Observable<Gamepad>;\r\n\r\n /**\r\n * observable to be triggered when the gamepad controller has been disconnected\r\n */\r\n public onGamepadDisconnectedObservable = new Observable<Gamepad>();\r\n\r\n private _onGamepadConnectedEvent: Nullable<(evt: any) => void>;\r\n private _onGamepadDisconnectedEvent: Nullable<(evt: any) => void>;\r\n\r\n /**\r\n * Initializes the gamepad manager\r\n * @param _scene BabylonJS scene\r\n */\r\n constructor(private _scene?: Scene) {\r\n if (!IsWindowObjectExist()) {\r\n this._gamepadEventSupported = false;\r\n } else {\r\n this._gamepadEventSupported = \"GamepadEvent\" in window;\r\n this._gamepadSupport = navigator && navigator.getGamepads;\r\n }\r\n\r\n this.onGamepadConnectedObservable = new Observable<Gamepad>((observer) => {\r\n // This will be used to raise the onGamepadConnected for all gamepads ALREADY connected\r\n for (const i in this._babylonGamepads) {\r\n const gamepad = this._babylonGamepads[i];\r\n if (gamepad && gamepad._isConnected) {\r\n this.onGamepadConnectedObservable.notifyObserver(observer, gamepad);\r\n }\r\n }\r\n });\r\n\r\n this._onGamepadConnectedEvent = (evt) => {\r\n const gamepad = evt.gamepad;\r\n\r\n if (gamepad.index in this._babylonGamepads) {\r\n if (this._babylonGamepads[gamepad.index].isConnected) {\r\n return;\r\n }\r\n }\r\n\r\n let newGamepad: Gamepad;\r\n\r\n if (this._babylonGamepads[gamepad.index]) {\r\n newGamepad = this._babylonGamepads[gamepad.index];\r\n newGamepad.browserGamepad = gamepad;\r\n newGamepad._isConnected = true;\r\n } else {\r\n newGamepad = this._addNewGamepad(gamepad);\r\n }\r\n this.onGamepadConnectedObservable.notifyObservers(newGamepad);\r\n this._startMonitoringGamepads();\r\n };\r\n\r\n this._onGamepadDisconnectedEvent = (evt) => {\r\n const gamepad = evt.gamepad;\r\n\r\n // Remove the gamepad from the list of gamepads to monitor.\r\n for (const i in this._babylonGamepads) {\r\n if (this._babylonGamepads[i].index === gamepad.index) {\r\n const disconnectedGamepad = this._babylonGamepads[i];\r\n disconnectedGamepad._isConnected = false;\r\n\r\n this.onGamepadDisconnectedObservable.notifyObservers(disconnectedGamepad);\r\n disconnectedGamepad.dispose && disconnectedGamepad.dispose();\r\n break;\r\n }\r\n }\r\n };\r\n\r\n if (this._gamepadSupport) {\r\n //first add already-connected gamepads\r\n this._updateGamepadObjects();\r\n if (this._babylonGamepads.length) {\r\n this._startMonitoringGamepads();\r\n }\r\n // Checking if the gamepad connected event is supported (like in Firefox)\r\n if (this._gamepadEventSupported) {\r\n const hostWindow = this._scene ? this._scene.getEngine().getHostWindow() : window;\r\n\r\n if (hostWindow) {\r\n hostWindow.addEventListener(\"gamepadconnected\", this._onGamepadConnectedEvent, false);\r\n hostWindow.addEventListener(\"gamepaddisconnected\", this._onGamepadDisconnectedEvent, false);\r\n }\r\n } else {\r\n this._startMonitoringGamepads();\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * The gamepads in the game pad manager\r\n */\r\n public get gamepads(): Gamepad[] {\r\n return this._babylonGamepads;\r\n }\r\n\r\n /**\r\n * Get the gamepad controllers based on type\r\n * @param type The type of gamepad controller\r\n * @returns Nullable gamepad\r\n */\r\n public getGamepadByType(type: number = Gamepad.XBOX): Nullable<Gamepad> {\r\n for (const gamepad of this._babylonGamepads) {\r\n if (gamepad && gamepad.type === type) {\r\n return gamepad;\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Disposes the gamepad manager\r\n */\r\n public dispose() {\r\n if (this._gamepadEventSupported) {\r\n if (this._onGamepadConnectedEvent) {\r\n window.removeEventListener(\"gamepadconnected\", this._onGamepadConnectedEvent);\r\n }\r\n\r\n if (this._onGamepadDisconnectedEvent) {\r\n window.removeEventListener(\"gamepaddisconnected\", this._onGamepadDisconnectedEvent);\r\n }\r\n this._onGamepadConnectedEvent = null;\r\n this._onGamepadDisconnectedEvent = null;\r\n }\r\n\r\n this._babylonGamepads.forEach((gamepad) => {\r\n gamepad.dispose();\r\n });\r\n\r\n this.onGamepadConnectedObservable.clear();\r\n this.onGamepadDisconnectedObservable.clear();\r\n\r\n this._oneGamepadConnected = false;\r\n this._stopMonitoringGamepads();\r\n this._babylonGamepads = [];\r\n }\r\n\r\n private _addNewGamepad(gamepad: any): Gamepad {\r\n if (!this._oneGamepadConnected) {\r\n this._oneGamepadConnected = true;\r\n }\r\n\r\n let newGamepad;\r\n const dualShock: boolean = (<string>gamepad.id).search(\"054c\") !== -1 && (<string>gamepad.id).search(\"0ce6\") === -1;\r\n const xboxOne: boolean = (<string>gamepad.id).search(\"Xbox One\") !== -1;\r\n if (\r\n xboxOne ||\r\n (<string>gamepad.id).search(\"Xbox 360\") !== -1 ||\r\n (<string>gamepad.id).search(\"xinput\") !== -1 ||\r\n ((<string>gamepad.id).search(\"045e\") !== -1 && (<string>gamepad.id).search(\"Surface Dock\") === -1)\r\n ) {\r\n // make sure the Surface Dock Extender is not detected as an xbox controller\r\n newGamepad = new Xbox360Pad(gamepad.id, gamepad.index, gamepad, xboxOne);\r\n } else if (dualShock) {\r\n newGamepad = new DualShockPad(gamepad.id, gamepad.index, gamepad);\r\n } else {\r\n newGamepad = new GenericPad(gamepad.id, gamepad.index, gamepad);\r\n }\r\n this._babylonGamepads[newGamepad.index] = newGamepad;\r\n return newGamepad;\r\n }\r\n\r\n private _startMonitoringGamepads() {\r\n if (!this._isMonitoring) {\r\n this._isMonitoring = true;\r\n //back-comp\r\n this._checkGamepadsStatus();\r\n }\r\n }\r\n\r\n private _stopMonitoringGamepads() {\r\n this._isMonitoring = false;\r\n }\r\n\r\n private _loggedErrors: number[];\r\n\r\n /** @internal */\r\n public _checkGamepadsStatus() {\r\n // Hack to be compatible Chrome\r\n this._updateGamepadObjects();\r\n\r\n for (const i in this._babylonGamepads) {\r\n const gamepad = this._babylonGamepads[i];\r\n if (!gamepad || !gamepad.isConnected) {\r\n continue;\r\n }\r\n try {\r\n gamepad.update();\r\n } catch {\r\n if (this._loggedErrors.indexOf(gamepad.index) === -1) {\r\n Tools.Warn(`Error updating gamepad ${gamepad.id}`);\r\n this._loggedErrors.push(gamepad.index);\r\n }\r\n }\r\n }\r\n\r\n if (this._isMonitoring) {\r\n Engine.QueueNewFrame(() => {\r\n this._checkGamepadsStatus();\r\n });\r\n }\r\n }\r\n\r\n // This function is called only on Chrome, which does not properly support\r\n // connection/disconnection events and forces you to recopy again the gamepad object\r\n private _updateGamepadObjects() {\r\n const gamepads = navigator.getGamepads ? navigator.getGamepads() : [];\r\n for (let i = 0; i < gamepads.length; i++) {\r\n const gamepad = gamepads[i];\r\n if (gamepad) {\r\n if (!this._babylonGamepads[gamepad.index]) {\r\n const newGamepad = this._addNewGamepad(gamepad);\r\n this.onGamepadConnectedObservable.notifyObservers(newGamepad);\r\n } else {\r\n // Forced to copy again this object for Chrome for unknown reason\r\n this._babylonGamepads[i].browserGamepad = gamepad;\r\n\r\n if (!this._babylonGamepads[i].isConnected) {\r\n this._babylonGamepads[i]._isConnected = true;\r\n this.onGamepadConnectedObservable.notifyObservers(this._babylonGamepads[i]);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n}\r\n"]}
|
package/Gamepads/index.d.ts
CHANGED
package/Gamepads/index.js
CHANGED
package/Gamepads/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../dev/core/src/Gamepads/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../dev/core/src/Gamepads/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC","sourcesContent":["export * from \"./gamepad\";\r\nexport * from \"./gamepadManager\";\r\nexport * from \"./gamepadSceneComponent\";\r\nexport * from \"./xboxGamepad\";\r\nexport * from \"./dualShockGamepad\";\r\n"]}
|
package/Gizmos/gizmo.js
CHANGED
|
@@ -225,10 +225,7 @@ export class Gizmo {
|
|
|
225
225
|
// Scale
|
|
226
226
|
if (this.updateScale) {
|
|
227
227
|
const activeCamera = this.gizmoLayer.utilityLayerScene.activeCamera;
|
|
228
|
-
|
|
229
|
-
if (activeCamera.devicePosition) {
|
|
230
|
-
cameraPosition = activeCamera.devicePosition;
|
|
231
|
-
}
|
|
228
|
+
const cameraPosition = activeCamera.globalPosition;
|
|
232
229
|
this._rootMesh.position.subtractToRef(cameraPosition, TmpVectors.Vector3[0]);
|
|
233
230
|
let scale = this.scaleRatio;
|
|
234
231
|
if (activeCamera.mode == Camera.ORTHOGRAPHIC_CAMERA) {
|
package/Gizmos/gizmo.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gizmo.js","sourceRoot":"","sources":["../../../../dev/core/src/Gizmos/gizmo.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAE/E,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAI3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAIzE,OAAO,EAAE,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CAAC,KAAK,CAAC,eAAe,CAAC;4BACjF,IAAK,CAAe,CAAC,KAAK,EAAE;gCACvB,CAAe,CAAC,KAAK,GAAG,KAAK,CAAC,QAAQ,CAAC,YAAY,CAAC;6BACxD;wBACL,CAAC,CAAC,CAAC;oBACP,CAAC,CAAC,CAAC;iBACN;aACJ;QACL,CAAC,CAAC,CAAC;QAEH,OAAO,eAAgB,CAAC;IAC5B,CAAC;IAED;;OAEG;IACI,OAAO;QACV,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;QACzB,IAAI,IAAI,CAAC,qBAAqB,EAAE;YAC5B,IAAI,CAAC,UAAU,CAAC,iBAAiB,CAAC,wBAAwB,CAAC,MAAM,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;SACjG;IACL,CAAC;;AA7dD;;;GAGG;AACW,qBAAe,GAAG,KAAK,AAAR,CAAS","sourcesContent":["import type { Observer } from \"../Misc/observable\";\r\nimport type { Nullable } from \"../types\";\r\nimport type { WebVRFreeCamera } from \"../Cameras/VR/webVRCamera\";\r\nimport type { Scene, IDisposable } from \"../scene\";\r\nimport { Quaternion, Vector3, Matrix, TmpVectors } from \"../Maths/math.vector\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport { Mesh } from \"../Meshes/mesh\";\r\nimport { Camera } from \"../Cameras/camera\";\r\nimport type { TargetCamera } from \"../Cameras/targetCamera\";\r\nimport type { Node } from \"../node\";\r\nimport type { Bone } from \"../Bones/bone\";\r\nimport { UtilityLayerRenderer } from \"../Rendering/utilityLayerRenderer\";\r\nimport type { TransformNode } from \"../Meshes/transformNode\";\r\nimport type { StandardMaterial } from \"../Materials/standardMaterial\";\r\nimport type { PointerInfo } from \"../Events/pointerEvents\";\r\nimport { PointerEventTypes } from \"../Events/pointerEvents\";\r\nimport type { LinesMesh } from \"../Meshes/linesMesh\";\r\nimport type { PointerDragBehavior } from \"../Behaviors/Meshes/pointerDragBehavior\";\r\nimport type { ShadowLight } from \"../Lights/shadowLight\";\r\nimport { Light } from \"../Lights/light\";\r\n\r\n/**\r\n * Cache built by each axis. Used for managing state between all elements of gizmo for enhanced UI\r\n */\r\nexport interface GizmoAxisCache {\r\n /** Mesh used to render the Gizmo */\r\n gizmoMeshes: Mesh[];\r\n /** Mesh used to detect user interaction with Gizmo */\r\n colliderMeshes: Mesh[];\r\n /** Material used to indicate color of gizmo mesh */\r\n material: StandardMaterial;\r\n /** Material used to indicate hover state of the Gizmo */\r\n hoverMaterial: StandardMaterial;\r\n /** Material used to indicate disabled state of the Gizmo */\r\n disableMaterial: StandardMaterial;\r\n /** Used to indicate Active state of the Gizmo */\r\n active: boolean;\r\n /** DragBehavior */\r\n dragBehavior: PointerDragBehavior;\r\n}\r\n\r\n/**\r\n * Anchor options where the Gizmo can be positioned in relation to its anchored node\r\n */\r\nexport enum GizmoAnchorPoint {\r\n /** The origin of the attached node */\r\n Origin,\r\n /** The pivot point of the attached node*/\r\n Pivot,\r\n}\r\n\r\n/**\r\n * Coordinates mode: Local or World. Defines how axis is aligned: either on world axis or transform local axis\r\n */\r\nexport enum GizmoCoordinatesMode {\r\n World,\r\n Local,\r\n}\r\n\r\n/**\r\n * Interface for basic gizmo\r\n */\r\nexport interface IGizmo extends IDisposable {\r\n /** True when the mouse pointer is hovered a gizmo mesh */\r\n readonly isHovered: boolean;\r\n /** The root mesh of the gizmo */\r\n _rootMesh: Mesh;\r\n /** Ratio for the scale of the gizmo */\r\n scaleRatio: number;\r\n /**\r\n * Mesh that the gizmo will be attached to. (eg. on a drag gizmo the mesh that will be dragged)\r\n * * When set, interactions will be enabled\r\n */\r\n attachedMesh: Nullable<AbstractMesh>;\r\n /**\r\n * Node that the gizmo will be attached to. (eg. on a drag gizmo the mesh, bone or NodeTransform that will be dragged)\r\n * * When set, interactions will be enabled\r\n */\r\n attachedNode: Nullable<Node>;\r\n /**\r\n * If set the gizmo's rotation will be updated to match the attached mesh each frame (Default: true)\r\n */\r\n updateGizmoRotationToMatchAttachedMesh: boolean;\r\n /** The utility layer the gizmo will be added to */\r\n gizmoLayer: UtilityLayerRenderer;\r\n /**\r\n * If set the gizmo's position will be updated to match the attached mesh each frame (Default: true)\r\n */\r\n updateGizmoPositionToMatchAttachedMesh: boolean;\r\n /**\r\n * Defines where the gizmo will be positioned if `updateGizmoPositionToMatchAttachedMesh` is enabled.\r\n * (Default: GizmoAnchorPoint.Origin)\r\n */\r\n anchorPoint: GizmoAnchorPoint;\r\n\r\n /**\r\n * Set the coordinate mode to use. By default it's local.\r\n */\r\n coordinatesMode: GizmoCoordinatesMode;\r\n\r\n /**\r\n * When set, the gizmo will always appear the same size no matter where the camera is (default: true)\r\n */\r\n updateScale: boolean;\r\n /**\r\n * posture that the gizmo will be display\r\n * When set null, default value will be used (Quaternion(0, 0, 0, 1))\r\n */\r\n customRotationQuaternion: Nullable<Quaternion>;\r\n /** Disposes and replaces the current meshes in the gizmo with the specified mesh */\r\n setCustomMesh(mesh: Mesh): void;\r\n}\r\n/**\r\n * Renders gizmos on top of an existing scene which provide controls for position, rotation, etc.\r\n */\r\nexport class Gizmo implements IGizmo {\r\n /**\r\n * The root mesh of the gizmo\r\n */\r\n public _rootMesh: Mesh;\r\n protected _attachedMesh: Nullable<AbstractMesh> = null;\r\n protected _attachedNode: Nullable<Node> = null;\r\n protected _customRotationQuaternion: Nullable<Quaternion> = null;\r\n /**\r\n * Ratio for the scale of the gizmo (Default: 1)\r\n */\r\n protected _scaleRatio = 1;\r\n\r\n /**\r\n * boolean updated by pointermove when a gizmo mesh is hovered\r\n */\r\n protected _isHovered = false;\r\n\r\n /**\r\n * When enabled, any gizmo operation will perserve scaling sign. Default is off.\r\n * Only valid for TransformNode derived classes (Mesh, AbstractMesh, ...)\r\n */\r\n public static PreserveScaling = false;\r\n\r\n /**\r\n * Ratio for the scale of the gizmo (Default: 1)\r\n */\r\n public set scaleRatio(value: number) {\r\n this._scaleRatio = value;\r\n }\r\n\r\n public get scaleRatio() {\r\n return this._scaleRatio;\r\n }\r\n\r\n /**\r\n * True when the mouse pointer is hovered a gizmo mesh\r\n */\r\n public get isHovered() {\r\n return this._isHovered;\r\n }\r\n\r\n /**\r\n * If a custom mesh has been set (Default: false)\r\n */\r\n protected _customMeshSet = false;\r\n /**\r\n * Mesh that the gizmo will be attached to. (eg. on a drag gizmo the mesh that will be dragged)\r\n * * When set, interactions will be enabled\r\n */\r\n public get attachedMesh() {\r\n return this._attachedMesh;\r\n }\r\n public set attachedMesh(value) {\r\n this._attachedMesh = value;\r\n if (value) {\r\n this._attachedNode = value;\r\n }\r\n this._rootMesh.setEnabled(value ? true : false);\r\n this._attachedNodeChanged(value);\r\n }\r\n /**\r\n * Node that the gizmo will be attached to. (eg. on a drag gizmo the mesh, bone or NodeTransform that will be dragged)\r\n * * When set, interactions will be enabled\r\n */\r\n public get attachedNode() {\r\n return this._attachedNode;\r\n }\r\n public set attachedNode(value) {\r\n this._attachedNode = value;\r\n this._attachedMesh = null;\r\n this._rootMesh.setEnabled(value ? true : false);\r\n this._attachedNodeChanged(value);\r\n }\r\n\r\n /**\r\n * Disposes and replaces the current meshes in the gizmo with the specified mesh\r\n * @param mesh The mesh to replace the default mesh of the gizmo\r\n */\r\n public setCustomMesh(mesh: Mesh) {\r\n if (mesh.getScene() != this.gizmoLayer.utilityLayerScene) {\r\n throw \"When setting a custom mesh on a gizmo, the custom meshes scene must be the same as the gizmos (eg. gizmo.gizmoLayer.utilityLayerScene)\";\r\n }\r\n this._rootMesh.getChildMeshes().forEach((c) => {\r\n c.dispose();\r\n });\r\n mesh.parent = this._rootMesh;\r\n this._customMeshSet = true;\r\n }\r\n\r\n protected _updateGizmoRotationToMatchAttachedMesh = true;\r\n protected _updateGizmoPositionToMatchAttachedMesh = true;\r\n protected _anchorPoint = GizmoAnchorPoint.Origin;\r\n protected _updateScale = true;\r\n protected _coordinatesMode = GizmoCoordinatesMode.Local;\r\n\r\n /**\r\n * If set the gizmo's rotation will be updated to match the attached mesh each frame (Default: true)\r\n * NOTE: This is only possible for meshes with uniform scaling, as otherwise it's not possible to decompose the rotation\r\n */\r\n public set updateGizmoRotationToMatchAttachedMesh(value: boolean) {\r\n this._updateGizmoRotationToMatchAttachedMesh = value;\r\n }\r\n public get updateGizmoRotationToMatchAttachedMesh() {\r\n return this._updateGizmoRotationToMatchAttachedMesh;\r\n }\r\n /**\r\n * If set the gizmo's position will be updated to match the attached mesh each frame (Default: true)\r\n */\r\n public set updateGizmoPositionToMatchAttachedMesh(value: boolean) {\r\n this._updateGizmoPositionToMatchAttachedMesh = value;\r\n }\r\n public get updateGizmoPositionToMatchAttachedMesh() {\r\n return this._updateGizmoPositionToMatchAttachedMesh;\r\n }\r\n\r\n /**\r\n * Defines where the gizmo will be positioned if `updateGizmoPositionToMatchAttachedMesh` is enabled.\r\n * (Default: GizmoAnchorPoint.Origin)\r\n */\r\n public set anchorPoint(value: GizmoAnchorPoint) {\r\n this._anchorPoint = value;\r\n }\r\n public get anchorPoint() {\r\n return this._anchorPoint;\r\n }\r\n\r\n /**\r\n * Set the coordinate system to use. By default it's local.\r\n * But it's possible for a user to tweak so its local for translation and world for rotation.\r\n * In that case, setting the coordinate system will change `updateGizmoRotationToMatchAttachedMesh` and `updateGizmoPositionToMatchAttachedMesh`\r\n */\r\n public set coordinatesMode(coordinatesMode: GizmoCoordinatesMode) {\r\n this._coordinatesMode = coordinatesMode;\r\n const local = coordinatesMode == GizmoCoordinatesMode.Local;\r\n this.updateGizmoRotationToMatchAttachedMesh = local;\r\n this.updateGizmoPositionToMatchAttachedMesh = true;\r\n }\r\n\r\n public get coordinatesMode() {\r\n return this._coordinatesMode;\r\n }\r\n\r\n /**\r\n * When set, the gizmo will always appear the same size no matter where the camera is (default: true)\r\n */\r\n\r\n public set updateScale(value: boolean) {\r\n this._updateScale = value;\r\n }\r\n public get updateScale() {\r\n return this._updateScale;\r\n }\r\n protected _interactionsEnabled = true;\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n protected _attachedNodeChanged(value: Nullable<Node>) {}\r\n\r\n protected _beforeRenderObserver: Nullable<Observer<Scene>>;\r\n private _rightHandtoLeftHandMatrix = Matrix.RotationY(Math.PI);\r\n\r\n /**\r\n * Creates a gizmo\r\n * @param gizmoLayer The utility layer the gizmo will be added to\r\n */\r\n constructor(\r\n /** The utility layer the gizmo will be added to */\r\n public gizmoLayer: UtilityLayerRenderer = UtilityLayerRenderer.DefaultUtilityLayer\r\n ) {\r\n this._rootMesh = new Mesh(\"gizmoRootNode\", gizmoLayer.utilityLayerScene);\r\n this._rootMesh.rotationQuaternion = Quaternion.Identity();\r\n\r\n this._beforeRenderObserver = this.gizmoLayer.utilityLayerScene.onBeforeRenderObservable.add(() => {\r\n this._update();\r\n });\r\n }\r\n\r\n /**\r\n * posture that the gizmo will be display\r\n * When set null, default value will be used (Quaternion(0, 0, 0, 1))\r\n */\r\n public get customRotationQuaternion(): Nullable<Quaternion> {\r\n return this._customRotationQuaternion;\r\n }\r\n\r\n public set customRotationQuaternion(customRotationQuaternion: Nullable<Quaternion>) {\r\n this._customRotationQuaternion = customRotationQuaternion;\r\n }\r\n\r\n /**\r\n * Updates the gizmo to match the attached mesh's position/rotation\r\n */\r\n protected _update() {\r\n if (this.attachedNode) {\r\n let effectiveNode = this.attachedNode;\r\n if (this.attachedMesh) {\r\n effectiveNode = this.attachedMesh || this.attachedNode;\r\n }\r\n\r\n // Position\r\n if (this.updateGizmoPositionToMatchAttachedMesh) {\r\n if (this.anchorPoint == GizmoAnchorPoint.Pivot && (<TransformNode>effectiveNode).getAbsolutePivotPoint) {\r\n const position = (<TransformNode>effectiveNode).getAbsolutePivotPoint();\r\n this._rootMesh.position.copyFrom(position);\r\n } else {\r\n const row = effectiveNode.getWorldMatrix().getRow(3);\r\n const position = row ? row.toVector3() : new Vector3(0, 0, 0);\r\n this._rootMesh.position.copyFrom(position);\r\n }\r\n }\r\n\r\n // Rotation\r\n if (this.updateGizmoRotationToMatchAttachedMesh) {\r\n const supportedNode =\r\n (<Mesh>effectiveNode)._isMesh ||\r\n effectiveNode.getClassName() === \"AbstractMesh\" ||\r\n effectiveNode.getClassName() === \"TransformNode\" ||\r\n effectiveNode.getClassName() === \"InstancedMesh\";\r\n const transformNode = supportedNode ? (effectiveNode as TransformNode) : undefined;\r\n effectiveNode.getWorldMatrix().decompose(undefined, this._rootMesh.rotationQuaternion!, undefined, Gizmo.PreserveScaling ? transformNode : undefined);\r\n this._rootMesh.rotationQuaternion!.normalize();\r\n } else {\r\n if (this._customRotationQuaternion) {\r\n this._rootMesh.rotationQuaternion!.copyFrom(this._customRotationQuaternion);\r\n } else {\r\n this._rootMesh.rotationQuaternion!.set(0, 0, 0, 1);\r\n }\r\n }\r\n\r\n // Scale\r\n if (this.updateScale) {\r\n const activeCamera = this.gizmoLayer.utilityLayerScene.activeCamera!;\r\n let cameraPosition = activeCamera.globalPosition;\r\n if ((<WebVRFreeCamera>activeCamera).devicePosition) {\r\n cameraPosition = (<WebVRFreeCamera>activeCamera).devicePosition;\r\n }\r\n this._rootMesh.position.subtractToRef(cameraPosition, TmpVectors.Vector3[0]);\r\n let scale = this.scaleRatio;\r\n if (activeCamera.mode == Camera.ORTHOGRAPHIC_CAMERA) {\r\n if (activeCamera.orthoTop && activeCamera.orthoBottom) {\r\n const orthoHeight = activeCamera.orthoTop - activeCamera.orthoBottom;\r\n scale *= orthoHeight;\r\n }\r\n } else {\r\n const camForward = activeCamera.getScene().useRightHandedSystem ? Vector3.RightHandedForwardReadOnly : Vector3.LeftHandedForwardReadOnly;\r\n const direction = activeCamera.getDirection(camForward);\r\n scale *= Vector3.Dot(TmpVectors.Vector3[0], direction);\r\n }\r\n this._rootMesh.scaling.setAll(scale);\r\n\r\n // Account for handedness, similar to Matrix.decompose\r\n if (effectiveNode._getWorldMatrixDeterminant() < 0 && !Gizmo.PreserveScaling) {\r\n this._rootMesh.scaling.y *= -1;\r\n }\r\n } else {\r\n this._rootMesh.scaling.setAll(this.scaleRatio);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * computes the rotation/scaling/position of the transform once the Node world matrix has changed.\r\n */\r\n protected _matrixChanged() {\r\n if (!this._attachedNode) {\r\n return;\r\n }\r\n\r\n if ((<Camera>this._attachedNode)._isCamera) {\r\n const camera = this._attachedNode as Camera;\r\n let worldMatrix;\r\n let worldMatrixUC;\r\n if (camera.parent) {\r\n const parentInv = TmpVectors.Matrix[1];\r\n camera.parent._worldMatrix.invertToRef(parentInv);\r\n this._attachedNode._worldMatrix.multiplyToRef(parentInv, TmpVectors.Matrix[0]);\r\n worldMatrix = TmpVectors.Matrix[0];\r\n } else {\r\n worldMatrix = this._attachedNode._worldMatrix;\r\n }\r\n\r\n if (camera.getScene().useRightHandedSystem) {\r\n // avoid desync with RH matrix computation. Otherwise, rotation of PI around Y axis happens each frame resulting in axis flipped because worldMatrix is computed as inverse of viewMatrix.\r\n this._rightHandtoLeftHandMatrix.multiplyToRef(worldMatrix, TmpVectors.Matrix[1]);\r\n worldMatrixUC = TmpVectors.Matrix[1];\r\n } else {\r\n worldMatrixUC = worldMatrix;\r\n }\r\n\r\n worldMatrixUC.decompose(TmpVectors.Vector3[1], TmpVectors.Quaternion[0], TmpVectors.Vector3[0]);\r\n\r\n const inheritsTargetCamera =\r\n this._attachedNode.getClassName() === \"FreeCamera\" ||\r\n this._attachedNode.getClassName() === \"FlyCamera\" ||\r\n this._attachedNode.getClassName() === \"ArcFollowCamera\" ||\r\n this._attachedNode.getClassName() === \"TargetCamera\" ||\r\n this._attachedNode.getClassName() === \"TouchCamera\" ||\r\n this._attachedNode.getClassName() === \"UniversalCamera\";\r\n\r\n if (inheritsTargetCamera) {\r\n const targetCamera = this._attachedNode as TargetCamera;\r\n targetCamera.rotation = TmpVectors.Quaternion[0].toEulerAngles();\r\n\r\n if (targetCamera.rotationQuaternion) {\r\n targetCamera.rotationQuaternion.copyFrom(TmpVectors.Quaternion[0]);\r\n targetCamera.rotationQuaternion.normalize();\r\n }\r\n }\r\n\r\n camera.position.copyFrom(TmpVectors.Vector3[0]);\r\n } else if (\r\n (<Mesh>this._attachedNode)._isMesh ||\r\n this._attachedNode.getClassName() === \"AbstractMesh\" ||\r\n this._attachedNode.getClassName() === \"TransformNode\" ||\r\n this._attachedNode.getClassName() === \"InstancedMesh\"\r\n ) {\r\n const transform = this._attachedNode as TransformNode;\r\n if (transform.parent) {\r\n const parentInv = TmpVectors.Matrix[0];\r\n const localMat = TmpVectors.Matrix[1];\r\n transform.parent.getWorldMatrix().invertToRef(parentInv);\r\n this._attachedNode.getWorldMatrix().multiplyToRef(parentInv, localMat);\r\n localMat.decompose(TmpVectors.Vector3[0], TmpVectors.Quaternion[0], transform.position);\r\n TmpVectors.Quaternion[0].normalize();\r\n if (transform.isUsingPivotMatrix()) {\r\n // Calculate the local matrix without the translation.\r\n // Copied from TranslateNode.computeWorldMatrix\r\n const r = TmpVectors.Quaternion[1];\r\n Quaternion.RotationYawPitchRollToRef(transform.rotation.y, transform.rotation.x, transform.rotation.z, r);\r\n\r\n const scaleMatrix = TmpVectors.Matrix[2];\r\n Matrix.ScalingToRef(transform.scaling.x, transform.scaling.y, transform.scaling.z, scaleMatrix);\r\n\r\n const rotationMatrix = TmpVectors.Matrix[2];\r\n r.toRotationMatrix(rotationMatrix);\r\n\r\n const pivotMatrix = transform.getPivotMatrix();\r\n const invPivotMatrix = TmpVectors.Matrix[3];\r\n pivotMatrix.invertToRef(invPivotMatrix);\r\n\r\n pivotMatrix.multiplyToRef(scaleMatrix, TmpVectors.Matrix[4]);\r\n TmpVectors.Matrix[4].multiplyToRef(rotationMatrix, TmpVectors.Matrix[5]);\r\n TmpVectors.Matrix[5].multiplyToRef(invPivotMatrix, TmpVectors.Matrix[6]);\r\n\r\n TmpVectors.Matrix[6].getTranslationToRef(TmpVectors.Vector3[1]);\r\n\r\n transform.position.subtractInPlace(TmpVectors.Vector3[1]);\r\n }\r\n } else {\r\n this._attachedNode._worldMatrix.decompose(TmpVectors.Vector3[0], TmpVectors.Quaternion[0], transform.position, Gizmo.PreserveScaling ? transform : undefined);\r\n }\r\n TmpVectors.Vector3[0].scaleInPlace(1.0 / transform.scalingDeterminant);\r\n transform.scaling.copyFrom(TmpVectors.Vector3[0]);\r\n if (!transform.billboardMode) {\r\n if (transform.rotationQuaternion) {\r\n transform.rotationQuaternion.copyFrom(TmpVectors.Quaternion[0]);\r\n transform.rotationQuaternion.normalize();\r\n } else {\r\n transform.rotation = TmpVectors.Quaternion[0].toEulerAngles();\r\n }\r\n }\r\n } else if (this._attachedNode.getClassName() === \"Bone\") {\r\n const bone = this._attachedNode as Bone;\r\n const parent = bone.getParent();\r\n\r\n if (parent) {\r\n const invParent = TmpVectors.Matrix[0];\r\n const boneLocalMatrix = TmpVectors.Matrix[1];\r\n parent.getFinalMatrix().invertToRef(invParent);\r\n bone.getFinalMatrix().multiplyToRef(invParent, boneLocalMatrix);\r\n const lmat = bone.getLocalMatrix();\r\n lmat.copyFrom(boneLocalMatrix);\r\n } else {\r\n const lmat = bone.getLocalMatrix();\r\n lmat.copyFrom(bone.getFinalMatrix());\r\n }\r\n bone.markAsDirty();\r\n } else {\r\n const light = this._attachedNode as ShadowLight;\r\n if (light.getTypeID) {\r\n const type = light.getTypeID();\r\n if (type === Light.LIGHTTYPEID_DIRECTIONALLIGHT || type === Light.LIGHTTYPEID_SPOTLIGHT || type === Light.LIGHTTYPEID_POINTLIGHT) {\r\n const parent = light.parent;\r\n\r\n if (parent) {\r\n const invParent = TmpVectors.Matrix[0];\r\n const nodeLocalMatrix = TmpVectors.Matrix[1];\r\n parent.getWorldMatrix().invertToRef(invParent);\r\n light.getWorldMatrix().multiplyToRef(invParent, nodeLocalMatrix);\r\n nodeLocalMatrix.decompose(undefined, TmpVectors.Quaternion[0], TmpVectors.Vector3[0]);\r\n } else {\r\n this._attachedNode._worldMatrix.decompose(undefined, TmpVectors.Quaternion[0], TmpVectors.Vector3[0]);\r\n }\r\n // setter doesn't copy values. Need a new Vector3\r\n light.position = new Vector3(TmpVectors.Vector3[0].x, TmpVectors.Vector3[0].y, TmpVectors.Vector3[0].z);\r\n if (light.direction) {\r\n light.direction = new Vector3(light.direction.x, light.direction.y, light.direction.z);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * refresh gizmo mesh material\r\n * @param gizmoMeshes\r\n * @param material material to apply\r\n */\r\n protected _setGizmoMeshMaterial(gizmoMeshes: Mesh[], material: StandardMaterial) {\r\n if (gizmoMeshes) {\r\n gizmoMeshes.forEach((m: Mesh) => {\r\n m.material = material;\r\n if ((<LinesMesh>m).color) {\r\n (<LinesMesh>m).color = material.diffuseColor;\r\n }\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * Subscribes to pointer up, down, and hover events. Used for responsive gizmos.\r\n * @param gizmoLayer The utility layer the gizmo will be added to\r\n * @param gizmoAxisCache Gizmo axis definition used for reactive gizmo UI\r\n * @returns {Observer<PointerInfo>} pointerObserver\r\n */\r\n public static GizmoAxisPointerObserver(gizmoLayer: UtilityLayerRenderer, gizmoAxisCache: Map<Mesh, GizmoAxisCache>): Observer<PointerInfo> {\r\n let dragging = false;\r\n\r\n const pointerObserver = gizmoLayer.utilityLayerScene.onPointerObservable.add((pointerInfo) => {\r\n if (pointerInfo.pickInfo) {\r\n // On Hover Logic\r\n if (pointerInfo.type === PointerEventTypes.POINTERMOVE) {\r\n if (dragging) {\r\n return;\r\n }\r\n gizmoAxisCache.forEach((cache) => {\r\n if (cache.colliderMeshes && cache.gizmoMeshes) {\r\n const isHovered = cache.colliderMeshes?.indexOf(pointerInfo?.pickInfo?.pickedMesh as Mesh) != -1;\r\n const material = cache.dragBehavior.enabled ? (isHovered || cache.active ? cache.hoverMaterial : cache.material) : cache.disableMaterial;\r\n cache.gizmoMeshes.forEach((m: Mesh) => {\r\n m.material = material;\r\n if ((m as LinesMesh).color) {\r\n (m as LinesMesh).color = material.diffuseColor;\r\n }\r\n });\r\n }\r\n });\r\n }\r\n\r\n // On Mouse Down\r\n if (pointerInfo.type === PointerEventTypes.POINTERDOWN) {\r\n // If user Clicked Gizmo\r\n if (gizmoAxisCache.has(pointerInfo.pickInfo.pickedMesh?.parent as Mesh)) {\r\n dragging = true;\r\n const statusMap = gizmoAxisCache.get(pointerInfo.pickInfo.pickedMesh?.parent as Mesh);\r\n statusMap!.active = true;\r\n gizmoAxisCache.forEach((cache) => {\r\n const isHovered = cache.colliderMeshes?.indexOf(pointerInfo?.pickInfo?.pickedMesh as Mesh) != -1;\r\n const material = (isHovered || cache.active) && cache.dragBehavior.enabled ? cache.hoverMaterial : cache.disableMaterial;\r\n cache.gizmoMeshes.forEach((m: Mesh) => {\r\n m.material = material;\r\n if ((m as LinesMesh).color) {\r\n (m as LinesMesh).color = material.diffuseColor;\r\n }\r\n });\r\n });\r\n }\r\n }\r\n\r\n // On Mouse Up\r\n if (pointerInfo.type === PointerEventTypes.POINTERUP) {\r\n gizmoAxisCache.forEach((cache) => {\r\n cache.active = false;\r\n dragging = false;\r\n cache.gizmoMeshes.forEach((m: Mesh) => {\r\n m.material = cache.dragBehavior.enabled ? cache.material : cache.disableMaterial;\r\n if ((m as LinesMesh).color) {\r\n (m as LinesMesh).color = cache.material.diffuseColor;\r\n }\r\n });\r\n });\r\n }\r\n }\r\n });\r\n\r\n return pointerObserver!;\r\n }\r\n\r\n /**\r\n * Disposes of the gizmo\r\n */\r\n public dispose() {\r\n this._rootMesh.dispose();\r\n if (this._beforeRenderObserver) {\r\n this.gizmoLayer.utilityLayerScene.onBeforeRenderObservable.remove(this._beforeRenderObserver);\r\n }\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"gizmo.js","sourceRoot":"","sources":["../../../../dev/core/src/Gizmos/gizmo.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAE/E,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAI3C,OA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AAC;4BACjF,IAAK,CAAe,CAAC,KAAK,EAAE;gCACvB,CAAe,CAAC,KAAK,GAAG,KAAK,CAAC,QAAQ,CAAC,YAAY,CAAC;6BACxD;wBACL,CAAC,CAAC,CAAC;oBACP,CAAC,CAAC,CAAC;iBACN;aACJ;QACL,CAAC,CAAC,CAAC;QAEH,OAAO,eAAgB,CAAC;IAC5B,CAAC;IAED;;OAEG;IACI,OAAO;QACV,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;QACzB,IAAI,IAAI,CAAC,qBAAqB,EAAE;YAC5B,IAAI,CAAC,UAAU,CAAC,iBAAiB,CAAC,wBAAwB,CAAC,MAAM,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;SACjG;IACL,CAAC;;AA1dD;;;GAGG;AACW,qBAAe,GAAG,KAAK,AAAR,CAAS","sourcesContent":["import type { Observer } from \"../Misc/observable\";\r\nimport type { Nullable } from \"../types\";\r\nimport type { Scene, IDisposable } from \"../scene\";\r\nimport { Quaternion, Vector3, Matrix, TmpVectors } from \"../Maths/math.vector\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport { Mesh } from \"../Meshes/mesh\";\r\nimport { Camera } from \"../Cameras/camera\";\r\nimport type { TargetCamera } from \"../Cameras/targetCamera\";\r\nimport type { Node } from \"../node\";\r\nimport type { Bone } from \"../Bones/bone\";\r\nimport { UtilityLayerRenderer } from \"../Rendering/utilityLayerRenderer\";\r\nimport type { TransformNode } from \"../Meshes/transformNode\";\r\nimport type { StandardMaterial } from \"../Materials/standardMaterial\";\r\nimport type { PointerInfo } from \"../Events/pointerEvents\";\r\nimport { PointerEventTypes } from \"../Events/pointerEvents\";\r\nimport type { LinesMesh } from \"../Meshes/linesMesh\";\r\nimport type { PointerDragBehavior } from \"../Behaviors/Meshes/pointerDragBehavior\";\r\nimport type { ShadowLight } from \"../Lights/shadowLight\";\r\nimport { Light } from \"../Lights/light\";\r\n\r\n/**\r\n * Cache built by each axis. Used for managing state between all elements of gizmo for enhanced UI\r\n */\r\nexport interface GizmoAxisCache {\r\n /** Mesh used to render the Gizmo */\r\n gizmoMeshes: Mesh[];\r\n /** Mesh used to detect user interaction with Gizmo */\r\n colliderMeshes: Mesh[];\r\n /** Material used to indicate color of gizmo mesh */\r\n material: StandardMaterial;\r\n /** Material used to indicate hover state of the Gizmo */\r\n hoverMaterial: StandardMaterial;\r\n /** Material used to indicate disabled state of the Gizmo */\r\n disableMaterial: StandardMaterial;\r\n /** Used to indicate Active state of the Gizmo */\r\n active: boolean;\r\n /** DragBehavior */\r\n dragBehavior: PointerDragBehavior;\r\n}\r\n\r\n/**\r\n * Anchor options where the Gizmo can be positioned in relation to its anchored node\r\n */\r\nexport enum GizmoAnchorPoint {\r\n /** The origin of the attached node */\r\n Origin,\r\n /** The pivot point of the attached node*/\r\n Pivot,\r\n}\r\n\r\n/**\r\n * Coordinates mode: Local or World. Defines how axis is aligned: either on world axis or transform local axis\r\n */\r\nexport enum GizmoCoordinatesMode {\r\n World,\r\n Local,\r\n}\r\n\r\n/**\r\n * Interface for basic gizmo\r\n */\r\nexport interface IGizmo extends IDisposable {\r\n /** True when the mouse pointer is hovered a gizmo mesh */\r\n readonly isHovered: boolean;\r\n /** The root mesh of the gizmo */\r\n _rootMesh: Mesh;\r\n /** Ratio for the scale of the gizmo */\r\n scaleRatio: number;\r\n /**\r\n * Mesh that the gizmo will be attached to. (eg. on a drag gizmo the mesh that will be dragged)\r\n * * When set, interactions will be enabled\r\n */\r\n attachedMesh: Nullable<AbstractMesh>;\r\n /**\r\n * Node that the gizmo will be attached to. (eg. on a drag gizmo the mesh, bone or NodeTransform that will be dragged)\r\n * * When set, interactions will be enabled\r\n */\r\n attachedNode: Nullable<Node>;\r\n /**\r\n * If set the gizmo's rotation will be updated to match the attached mesh each frame (Default: true)\r\n */\r\n updateGizmoRotationToMatchAttachedMesh: boolean;\r\n /** The utility layer the gizmo will be added to */\r\n gizmoLayer: UtilityLayerRenderer;\r\n /**\r\n * If set the gizmo's position will be updated to match the attached mesh each frame (Default: true)\r\n */\r\n updateGizmoPositionToMatchAttachedMesh: boolean;\r\n /**\r\n * Defines where the gizmo will be positioned if `updateGizmoPositionToMatchAttachedMesh` is enabled.\r\n * (Default: GizmoAnchorPoint.Origin)\r\n */\r\n anchorPoint: GizmoAnchorPoint;\r\n\r\n /**\r\n * Set the coordinate mode to use. By default it's local.\r\n */\r\n coordinatesMode: GizmoCoordinatesMode;\r\n\r\n /**\r\n * When set, the gizmo will always appear the same size no matter where the camera is (default: true)\r\n */\r\n updateScale: boolean;\r\n /**\r\n * posture that the gizmo will be display\r\n * When set null, default value will be used (Quaternion(0, 0, 0, 1))\r\n */\r\n customRotationQuaternion: Nullable<Quaternion>;\r\n /** Disposes and replaces the current meshes in the gizmo with the specified mesh */\r\n setCustomMesh(mesh: Mesh): void;\r\n}\r\n/**\r\n * Renders gizmos on top of an existing scene which provide controls for position, rotation, etc.\r\n */\r\nexport class Gizmo implements IGizmo {\r\n /**\r\n * The root mesh of the gizmo\r\n */\r\n public _rootMesh: Mesh;\r\n protected _attachedMesh: Nullable<AbstractMesh> = null;\r\n protected _attachedNode: Nullable<Node> = null;\r\n protected _customRotationQuaternion: Nullable<Quaternion> = null;\r\n /**\r\n * Ratio for the scale of the gizmo (Default: 1)\r\n */\r\n protected _scaleRatio = 1;\r\n\r\n /**\r\n * boolean updated by pointermove when a gizmo mesh is hovered\r\n */\r\n protected _isHovered = false;\r\n\r\n /**\r\n * When enabled, any gizmo operation will perserve scaling sign. Default is off.\r\n * Only valid for TransformNode derived classes (Mesh, AbstractMesh, ...)\r\n */\r\n public static PreserveScaling = false;\r\n\r\n /**\r\n * Ratio for the scale of the gizmo (Default: 1)\r\n */\r\n public set scaleRatio(value: number) {\r\n this._scaleRatio = value;\r\n }\r\n\r\n public get scaleRatio() {\r\n return this._scaleRatio;\r\n }\r\n\r\n /**\r\n * True when the mouse pointer is hovered a gizmo mesh\r\n */\r\n public get isHovered() {\r\n return this._isHovered;\r\n }\r\n\r\n /**\r\n * If a custom mesh has been set (Default: false)\r\n */\r\n protected _customMeshSet = false;\r\n /**\r\n * Mesh that the gizmo will be attached to. (eg. on a drag gizmo the mesh that will be dragged)\r\n * * When set, interactions will be enabled\r\n */\r\n public get attachedMesh() {\r\n return this._attachedMesh;\r\n }\r\n public set attachedMesh(value) {\r\n this._attachedMesh = value;\r\n if (value) {\r\n this._attachedNode = value;\r\n }\r\n this._rootMesh.setEnabled(value ? true : false);\r\n this._attachedNodeChanged(value);\r\n }\r\n /**\r\n * Node that the gizmo will be attached to. (eg. on a drag gizmo the mesh, bone or NodeTransform that will be dragged)\r\n * * When set, interactions will be enabled\r\n */\r\n public get attachedNode() {\r\n return this._attachedNode;\r\n }\r\n public set attachedNode(value) {\r\n this._attachedNode = value;\r\n this._attachedMesh = null;\r\n this._rootMesh.setEnabled(value ? true : false);\r\n this._attachedNodeChanged(value);\r\n }\r\n\r\n /**\r\n * Disposes and replaces the current meshes in the gizmo with the specified mesh\r\n * @param mesh The mesh to replace the default mesh of the gizmo\r\n */\r\n public setCustomMesh(mesh: Mesh) {\r\n if (mesh.getScene() != this.gizmoLayer.utilityLayerScene) {\r\n throw \"When setting a custom mesh on a gizmo, the custom meshes scene must be the same as the gizmos (eg. gizmo.gizmoLayer.utilityLayerScene)\";\r\n }\r\n this._rootMesh.getChildMeshes().forEach((c) => {\r\n c.dispose();\r\n });\r\n mesh.parent = this._rootMesh;\r\n this._customMeshSet = true;\r\n }\r\n\r\n protected _updateGizmoRotationToMatchAttachedMesh = true;\r\n protected _updateGizmoPositionToMatchAttachedMesh = true;\r\n protected _anchorPoint = GizmoAnchorPoint.Origin;\r\n protected _updateScale = true;\r\n protected _coordinatesMode = GizmoCoordinatesMode.Local;\r\n\r\n /**\r\n * If set the gizmo's rotation will be updated to match the attached mesh each frame (Default: true)\r\n * NOTE: This is only possible for meshes with uniform scaling, as otherwise it's not possible to decompose the rotation\r\n */\r\n public set updateGizmoRotationToMatchAttachedMesh(value: boolean) {\r\n this._updateGizmoRotationToMatchAttachedMesh = value;\r\n }\r\n public get updateGizmoRotationToMatchAttachedMesh() {\r\n return this._updateGizmoRotationToMatchAttachedMesh;\r\n }\r\n /**\r\n * If set the gizmo's position will be updated to match the attached mesh each frame (Default: true)\r\n */\r\n public set updateGizmoPositionToMatchAttachedMesh(value: boolean) {\r\n this._updateGizmoPositionToMatchAttachedMesh = value;\r\n }\r\n public get updateGizmoPositionToMatchAttachedMesh() {\r\n return this._updateGizmoPositionToMatchAttachedMesh;\r\n }\r\n\r\n /**\r\n * Defines where the gizmo will be positioned if `updateGizmoPositionToMatchAttachedMesh` is enabled.\r\n * (Default: GizmoAnchorPoint.Origin)\r\n */\r\n public set anchorPoint(value: GizmoAnchorPoint) {\r\n this._anchorPoint = value;\r\n }\r\n public get anchorPoint() {\r\n return this._anchorPoint;\r\n }\r\n\r\n /**\r\n * Set the coordinate system to use. By default it's local.\r\n * But it's possible for a user to tweak so its local for translation and world for rotation.\r\n * In that case, setting the coordinate system will change `updateGizmoRotationToMatchAttachedMesh` and `updateGizmoPositionToMatchAttachedMesh`\r\n */\r\n public set coordinatesMode(coordinatesMode: GizmoCoordinatesMode) {\r\n this._coordinatesMode = coordinatesMode;\r\n const local = coordinatesMode == GizmoCoordinatesMode.Local;\r\n this.updateGizmoRotationToMatchAttachedMesh = local;\r\n this.updateGizmoPositionToMatchAttachedMesh = true;\r\n }\r\n\r\n public get coordinatesMode() {\r\n return this._coordinatesMode;\r\n }\r\n\r\n /**\r\n * When set, the gizmo will always appear the same size no matter where the camera is (default: true)\r\n */\r\n\r\n public set updateScale(value: boolean) {\r\n this._updateScale = value;\r\n }\r\n public get updateScale() {\r\n return this._updateScale;\r\n }\r\n protected _interactionsEnabled = true;\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n protected _attachedNodeChanged(value: Nullable<Node>) {}\r\n\r\n protected _beforeRenderObserver: Nullable<Observer<Scene>>;\r\n private _rightHandtoLeftHandMatrix = Matrix.RotationY(Math.PI);\r\n\r\n /**\r\n * Creates a gizmo\r\n * @param gizmoLayer The utility layer the gizmo will be added to\r\n */\r\n constructor(\r\n /** The utility layer the gizmo will be added to */\r\n public gizmoLayer: UtilityLayerRenderer = UtilityLayerRenderer.DefaultUtilityLayer\r\n ) {\r\n this._rootMesh = new Mesh(\"gizmoRootNode\", gizmoLayer.utilityLayerScene);\r\n this._rootMesh.rotationQuaternion = Quaternion.Identity();\r\n\r\n this._beforeRenderObserver = this.gizmoLayer.utilityLayerScene.onBeforeRenderObservable.add(() => {\r\n this._update();\r\n });\r\n }\r\n\r\n /**\r\n * posture that the gizmo will be display\r\n * When set null, default value will be used (Quaternion(0, 0, 0, 1))\r\n */\r\n public get customRotationQuaternion(): Nullable<Quaternion> {\r\n return this._customRotationQuaternion;\r\n }\r\n\r\n public set customRotationQuaternion(customRotationQuaternion: Nullable<Quaternion>) {\r\n this._customRotationQuaternion = customRotationQuaternion;\r\n }\r\n\r\n /**\r\n * Updates the gizmo to match the attached mesh's position/rotation\r\n */\r\n protected _update() {\r\n if (this.attachedNode) {\r\n let effectiveNode = this.attachedNode;\r\n if (this.attachedMesh) {\r\n effectiveNode = this.attachedMesh || this.attachedNode;\r\n }\r\n\r\n // Position\r\n if (this.updateGizmoPositionToMatchAttachedMesh) {\r\n if (this.anchorPoint == GizmoAnchorPoint.Pivot && (<TransformNode>effectiveNode).getAbsolutePivotPoint) {\r\n const position = (<TransformNode>effectiveNode).getAbsolutePivotPoint();\r\n this._rootMesh.position.copyFrom(position);\r\n } else {\r\n const row = effectiveNode.getWorldMatrix().getRow(3);\r\n const position = row ? row.toVector3() : new Vector3(0, 0, 0);\r\n this._rootMesh.position.copyFrom(position);\r\n }\r\n }\r\n\r\n // Rotation\r\n if (this.updateGizmoRotationToMatchAttachedMesh) {\r\n const supportedNode =\r\n (<Mesh>effectiveNode)._isMesh ||\r\n effectiveNode.getClassName() === \"AbstractMesh\" ||\r\n effectiveNode.getClassName() === \"TransformNode\" ||\r\n effectiveNode.getClassName() === \"InstancedMesh\";\r\n const transformNode = supportedNode ? (effectiveNode as TransformNode) : undefined;\r\n effectiveNode.getWorldMatrix().decompose(undefined, this._rootMesh.rotationQuaternion!, undefined, Gizmo.PreserveScaling ? transformNode : undefined);\r\n this._rootMesh.rotationQuaternion!.normalize();\r\n } else {\r\n if (this._customRotationQuaternion) {\r\n this._rootMesh.rotationQuaternion!.copyFrom(this._customRotationQuaternion);\r\n } else {\r\n this._rootMesh.rotationQuaternion!.set(0, 0, 0, 1);\r\n }\r\n }\r\n\r\n // Scale\r\n if (this.updateScale) {\r\n const activeCamera = this.gizmoLayer.utilityLayerScene.activeCamera!;\r\n const cameraPosition = activeCamera.globalPosition;\r\n this._rootMesh.position.subtractToRef(cameraPosition, TmpVectors.Vector3[0]);\r\n let scale = this.scaleRatio;\r\n if (activeCamera.mode == Camera.ORTHOGRAPHIC_CAMERA) {\r\n if (activeCamera.orthoTop && activeCamera.orthoBottom) {\r\n const orthoHeight = activeCamera.orthoTop - activeCamera.orthoBottom;\r\n scale *= orthoHeight;\r\n }\r\n } else {\r\n const camForward = activeCamera.getScene().useRightHandedSystem ? Vector3.RightHandedForwardReadOnly : Vector3.LeftHandedForwardReadOnly;\r\n const direction = activeCamera.getDirection(camForward);\r\n scale *= Vector3.Dot(TmpVectors.Vector3[0], direction);\r\n }\r\n this._rootMesh.scaling.setAll(scale);\r\n\r\n // Account for handedness, similar to Matrix.decompose\r\n if (effectiveNode._getWorldMatrixDeterminant() < 0 && !Gizmo.PreserveScaling) {\r\n this._rootMesh.scaling.y *= -1;\r\n }\r\n } else {\r\n this._rootMesh.scaling.setAll(this.scaleRatio);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * computes the rotation/scaling/position of the transform once the Node world matrix has changed.\r\n */\r\n protected _matrixChanged() {\r\n if (!this._attachedNode) {\r\n return;\r\n }\r\n\r\n if ((<Camera>this._attachedNode)._isCamera) {\r\n const camera = this._attachedNode as Camera;\r\n let worldMatrix;\r\n let worldMatrixUC;\r\n if (camera.parent) {\r\n const parentInv = TmpVectors.Matrix[1];\r\n camera.parent._worldMatrix.invertToRef(parentInv);\r\n this._attachedNode._worldMatrix.multiplyToRef(parentInv, TmpVectors.Matrix[0]);\r\n worldMatrix = TmpVectors.Matrix[0];\r\n } else {\r\n worldMatrix = this._attachedNode._worldMatrix;\r\n }\r\n\r\n if (camera.getScene().useRightHandedSystem) {\r\n // avoid desync with RH matrix computation. Otherwise, rotation of PI around Y axis happens each frame resulting in axis flipped because worldMatrix is computed as inverse of viewMatrix.\r\n this._rightHandtoLeftHandMatrix.multiplyToRef(worldMatrix, TmpVectors.Matrix[1]);\r\n worldMatrixUC = TmpVectors.Matrix[1];\r\n } else {\r\n worldMatrixUC = worldMatrix;\r\n }\r\n\r\n worldMatrixUC.decompose(TmpVectors.Vector3[1], TmpVectors.Quaternion[0], TmpVectors.Vector3[0]);\r\n\r\n const inheritsTargetCamera =\r\n this._attachedNode.getClassName() === \"FreeCamera\" ||\r\n this._attachedNode.getClassName() === \"FlyCamera\" ||\r\n this._attachedNode.getClassName() === \"ArcFollowCamera\" ||\r\n this._attachedNode.getClassName() === \"TargetCamera\" ||\r\n this._attachedNode.getClassName() === \"TouchCamera\" ||\r\n this._attachedNode.getClassName() === \"UniversalCamera\";\r\n\r\n if (inheritsTargetCamera) {\r\n const targetCamera = this._attachedNode as TargetCamera;\r\n targetCamera.rotation = TmpVectors.Quaternion[0].toEulerAngles();\r\n\r\n if (targetCamera.rotationQuaternion) {\r\n targetCamera.rotationQuaternion.copyFrom(TmpVectors.Quaternion[0]);\r\n targetCamera.rotationQuaternion.normalize();\r\n }\r\n }\r\n\r\n camera.position.copyFrom(TmpVectors.Vector3[0]);\r\n } else if (\r\n (<Mesh>this._attachedNode)._isMesh ||\r\n this._attachedNode.getClassName() === \"AbstractMesh\" ||\r\n this._attachedNode.getClassName() === \"TransformNode\" ||\r\n this._attachedNode.getClassName() === \"InstancedMesh\"\r\n ) {\r\n const transform = this._attachedNode as TransformNode;\r\n if (transform.parent) {\r\n const parentInv = TmpVectors.Matrix[0];\r\n const localMat = TmpVectors.Matrix[1];\r\n transform.parent.getWorldMatrix().invertToRef(parentInv);\r\n this._attachedNode.getWorldMatrix().multiplyToRef(parentInv, localMat);\r\n localMat.decompose(TmpVectors.Vector3[0], TmpVectors.Quaternion[0], transform.position);\r\n TmpVectors.Quaternion[0].normalize();\r\n if (transform.isUsingPivotMatrix()) {\r\n // Calculate the local matrix without the translation.\r\n // Copied from TranslateNode.computeWorldMatrix\r\n const r = TmpVectors.Quaternion[1];\r\n Quaternion.RotationYawPitchRollToRef(transform.rotation.y, transform.rotation.x, transform.rotation.z, r);\r\n\r\n const scaleMatrix = TmpVectors.Matrix[2];\r\n Matrix.ScalingToRef(transform.scaling.x, transform.scaling.y, transform.scaling.z, scaleMatrix);\r\n\r\n const rotationMatrix = TmpVectors.Matrix[2];\r\n r.toRotationMatrix(rotationMatrix);\r\n\r\n const pivotMatrix = transform.getPivotMatrix();\r\n const invPivotMatrix = TmpVectors.Matrix[3];\r\n pivotMatrix.invertToRef(invPivotMatrix);\r\n\r\n pivotMatrix.multiplyToRef(scaleMatrix, TmpVectors.Matrix[4]);\r\n TmpVectors.Matrix[4].multiplyToRef(rotationMatrix, TmpVectors.Matrix[5]);\r\n TmpVectors.Matrix[5].multiplyToRef(invPivotMatrix, TmpVectors.Matrix[6]);\r\n\r\n TmpVectors.Matrix[6].getTranslationToRef(TmpVectors.Vector3[1]);\r\n\r\n transform.position.subtractInPlace(TmpVectors.Vector3[1]);\r\n }\r\n } else {\r\n this._attachedNode._worldMatrix.decompose(TmpVectors.Vector3[0], TmpVectors.Quaternion[0], transform.position, Gizmo.PreserveScaling ? transform : undefined);\r\n }\r\n TmpVectors.Vector3[0].scaleInPlace(1.0 / transform.scalingDeterminant);\r\n transform.scaling.copyFrom(TmpVectors.Vector3[0]);\r\n if (!transform.billboardMode) {\r\n if (transform.rotationQuaternion) {\r\n transform.rotationQuaternion.copyFrom(TmpVectors.Quaternion[0]);\r\n transform.rotationQuaternion.normalize();\r\n } else {\r\n transform.rotation = TmpVectors.Quaternion[0].toEulerAngles();\r\n }\r\n }\r\n } else if (this._attachedNode.getClassName() === \"Bone\") {\r\n const bone = this._attachedNode as Bone;\r\n const parent = bone.getParent();\r\n\r\n if (parent) {\r\n const invParent = TmpVectors.Matrix[0];\r\n const boneLocalMatrix = TmpVectors.Matrix[1];\r\n parent.getFinalMatrix().invertToRef(invParent);\r\n bone.getFinalMatrix().multiplyToRef(invParent, boneLocalMatrix);\r\n const lmat = bone.getLocalMatrix();\r\n lmat.copyFrom(boneLocalMatrix);\r\n } else {\r\n const lmat = bone.getLocalMatrix();\r\n lmat.copyFrom(bone.getFinalMatrix());\r\n }\r\n bone.markAsDirty();\r\n } else {\r\n const light = this._attachedNode as ShadowLight;\r\n if (light.getTypeID) {\r\n const type = light.getTypeID();\r\n if (type === Light.LIGHTTYPEID_DIRECTIONALLIGHT || type === Light.LIGHTTYPEID_SPOTLIGHT || type === Light.LIGHTTYPEID_POINTLIGHT) {\r\n const parent = light.parent;\r\n\r\n if (parent) {\r\n const invParent = TmpVectors.Matrix[0];\r\n const nodeLocalMatrix = TmpVectors.Matrix[1];\r\n parent.getWorldMatrix().invertToRef(invParent);\r\n light.getWorldMatrix().multiplyToRef(invParent, nodeLocalMatrix);\r\n nodeLocalMatrix.decompose(undefined, TmpVectors.Quaternion[0], TmpVectors.Vector3[0]);\r\n } else {\r\n this._attachedNode._worldMatrix.decompose(undefined, TmpVectors.Quaternion[0], TmpVectors.Vector3[0]);\r\n }\r\n // setter doesn't copy values. Need a new Vector3\r\n light.position = new Vector3(TmpVectors.Vector3[0].x, TmpVectors.Vector3[0].y, TmpVectors.Vector3[0].z);\r\n if (light.direction) {\r\n light.direction = new Vector3(light.direction.x, light.direction.y, light.direction.z);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * refresh gizmo mesh material\r\n * @param gizmoMeshes\r\n * @param material material to apply\r\n */\r\n protected _setGizmoMeshMaterial(gizmoMeshes: Mesh[], material: StandardMaterial) {\r\n if (gizmoMeshes) {\r\n gizmoMeshes.forEach((m: Mesh) => {\r\n m.material = material;\r\n if ((<LinesMesh>m).color) {\r\n (<LinesMesh>m).color = material.diffuseColor;\r\n }\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * Subscribes to pointer up, down, and hover events. Used for responsive gizmos.\r\n * @param gizmoLayer The utility layer the gizmo will be added to\r\n * @param gizmoAxisCache Gizmo axis definition used for reactive gizmo UI\r\n * @returns {Observer<PointerInfo>} pointerObserver\r\n */\r\n public static GizmoAxisPointerObserver(gizmoLayer: UtilityLayerRenderer, gizmoAxisCache: Map<Mesh, GizmoAxisCache>): Observer<PointerInfo> {\r\n let dragging = false;\r\n\r\n const pointerObserver = gizmoLayer.utilityLayerScene.onPointerObservable.add((pointerInfo) => {\r\n if (pointerInfo.pickInfo) {\r\n // On Hover Logic\r\n if (pointerInfo.type === PointerEventTypes.POINTERMOVE) {\r\n if (dragging) {\r\n return;\r\n }\r\n gizmoAxisCache.forEach((cache) => {\r\n if (cache.colliderMeshes && cache.gizmoMeshes) {\r\n const isHovered = cache.colliderMeshes?.indexOf(pointerInfo?.pickInfo?.pickedMesh as Mesh) != -1;\r\n const material = cache.dragBehavior.enabled ? (isHovered || cache.active ? cache.hoverMaterial : cache.material) : cache.disableMaterial;\r\n cache.gizmoMeshes.forEach((m: Mesh) => {\r\n m.material = material;\r\n if ((m as LinesMesh).color) {\r\n (m as LinesMesh).color = material.diffuseColor;\r\n }\r\n });\r\n }\r\n });\r\n }\r\n\r\n // On Mouse Down\r\n if (pointerInfo.type === PointerEventTypes.POINTERDOWN) {\r\n // If user Clicked Gizmo\r\n if (gizmoAxisCache.has(pointerInfo.pickInfo.pickedMesh?.parent as Mesh)) {\r\n dragging = true;\r\n const statusMap = gizmoAxisCache.get(pointerInfo.pickInfo.pickedMesh?.parent as Mesh);\r\n statusMap!.active = true;\r\n gizmoAxisCache.forEach((cache) => {\r\n const isHovered = cache.colliderMeshes?.indexOf(pointerInfo?.pickInfo?.pickedMesh as Mesh) != -1;\r\n const material = (isHovered || cache.active) && cache.dragBehavior.enabled ? cache.hoverMaterial : cache.disableMaterial;\r\n cache.gizmoMeshes.forEach((m: Mesh) => {\r\n m.material = material;\r\n if ((m as LinesMesh).color) {\r\n (m as LinesMesh).color = material.diffuseColor;\r\n }\r\n });\r\n });\r\n }\r\n }\r\n\r\n // On Mouse Up\r\n if (pointerInfo.type === PointerEventTypes.POINTERUP) {\r\n gizmoAxisCache.forEach((cache) => {\r\n cache.active = false;\r\n dragging = false;\r\n cache.gizmoMeshes.forEach((m: Mesh) => {\r\n m.material = cache.dragBehavior.enabled ? cache.material : cache.disableMaterial;\r\n if ((m as LinesMesh).color) {\r\n (m as LinesMesh).color = cache.material.diffuseColor;\r\n }\r\n });\r\n });\r\n }\r\n }\r\n });\r\n\r\n return pointerObserver!;\r\n }\r\n\r\n /**\r\n * Disposes of the gizmo\r\n */\r\n public dispose() {\r\n this._rootMesh.dispose();\r\n if (this._beforeRenderObserver) {\r\n this.gizmoLayer.utilityLayerScene.onBeforeRenderObservable.remove(this._beforeRenderObserver);\r\n }\r\n }\r\n}\r\n"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { BaseTexture } from "../Textures/baseTexture";
|
|
2
|
+
import type { Nullable } from "../../types";
|
|
3
|
+
import { Color3 } from "../../Maths/math.color";
|
|
4
|
+
/**
|
|
5
|
+
* Default settings for GreasedLine materials
|
|
6
|
+
*/
|
|
7
|
+
export declare class GreasedLineMaterialDefaults {
|
|
8
|
+
/**
|
|
9
|
+
* Default line color for newly created lines
|
|
10
|
+
*/
|
|
11
|
+
static DEFAULT_COLOR: Color3;
|
|
12
|
+
/**
|
|
13
|
+
* Default line width when sizeAttenuation is true
|
|
14
|
+
*/
|
|
15
|
+
static DEFAULT_WIDTH_ATTENUATED: number;
|
|
16
|
+
/**
|
|
17
|
+
* Defaule line width
|
|
18
|
+
*/
|
|
19
|
+
static DEFAULT_WIDTH: number;
|
|
20
|
+
/**
|
|
21
|
+
* Empty colors texture for WebGPU
|
|
22
|
+
*/
|
|
23
|
+
static EmptyColorsTexture: Nullable<BaseTexture>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Color3 } from "../../Maths/math.color.js";
|
|
2
|
+
/**
|
|
3
|
+
* Default settings for GreasedLine materials
|
|
4
|
+
*/
|
|
5
|
+
export class GreasedLineMaterialDefaults {
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Default line color for newly created lines
|
|
9
|
+
*/
|
|
10
|
+
GreasedLineMaterialDefaults.DEFAULT_COLOR = Color3.White();
|
|
11
|
+
/**
|
|
12
|
+
* Default line width when sizeAttenuation is true
|
|
13
|
+
*/
|
|
14
|
+
GreasedLineMaterialDefaults.DEFAULT_WIDTH_ATTENUATED = 1;
|
|
15
|
+
/**
|
|
16
|
+
* Defaule line width
|
|
17
|
+
*/
|
|
18
|
+
GreasedLineMaterialDefaults.DEFAULT_WIDTH = 0.1;
|
|
19
|
+
//# sourceMappingURL=greasedLineMaterialDefaults.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"greasedLineMaterialDefaults.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/GreasedLine/greasedLineMaterialDefaults.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAEhD;;GAEG;AACH,MAAM,OAAO,2BAA2B;;AACpC;;GAEG;AACW,yCAAa,GAAG,MAAM,CAAC,KAAK,EAAE,CAAC;AAC7C;;GAEG;AACW,oDAAwB,GAAG,CAAC,CAAC;AAC3C;;GAEG;AACW,yCAAa,GAAG,GAAG,CAAC","sourcesContent":["import type { BaseTexture } from \"../Textures/baseTexture\";\r\nimport type { Nullable } from \"../../types\";\r\nimport { Color3 } from \"../../Maths/math.color\";\r\n\r\n/**\r\n * Default settings for GreasedLine materials\r\n */\r\nexport class GreasedLineMaterialDefaults {\r\n /**\r\n * Default line color for newly created lines\r\n */\r\n public static DEFAULT_COLOR = Color3.White();\r\n /**\r\n * Default line width when sizeAttenuation is true\r\n */\r\n public static DEFAULT_WIDTH_ATTENUATED = 1;\r\n /**\r\n * Defaule line width\r\n */\r\n public static DEFAULT_WIDTH = 0.1;\r\n /**\r\n * Empty colors texture for WebGPU\r\n */\r\n public static EmptyColorsTexture: Nullable<BaseTexture>;\r\n}\r\n"]}
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
import type { RawTexture } from "../Textures/rawTexture";
|
|
2
|
+
import type { Vector2 } from "../../Maths/math.vector";
|
|
3
|
+
import type { Nullable } from "../../types";
|
|
4
|
+
import type { Color3 } from "../../Maths/math.color";
|
|
5
|
+
/**
|
|
6
|
+
* Interface which defines the available methods for a GreasedLineMaterial
|
|
7
|
+
*/
|
|
8
|
+
export interface IGreasedLineMaterial {
|
|
9
|
+
/**
|
|
10
|
+
* Normalized value of how much of the line will be visible
|
|
11
|
+
* 0 - 0% of the line will be visible
|
|
12
|
+
* 1 - 100% of the line will be visible
|
|
13
|
+
*/
|
|
14
|
+
visibility: number;
|
|
15
|
+
/**
|
|
16
|
+
* Line base width. At each point the line width is calculated by widths[pointIndex] * width
|
|
17
|
+
*/
|
|
18
|
+
width: number;
|
|
19
|
+
/**
|
|
20
|
+
* Turns on/off dash mode
|
|
21
|
+
*/
|
|
22
|
+
useDash: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* @see GreasedLinePluginMaterial.setDashCount
|
|
25
|
+
* Number of dashes in the line.
|
|
26
|
+
* Defaults to 1.
|
|
27
|
+
*/
|
|
28
|
+
dashCount: number;
|
|
29
|
+
/**
|
|
30
|
+
* Dash offset
|
|
31
|
+
*/
|
|
32
|
+
dashOffset: number;
|
|
33
|
+
/**
|
|
34
|
+
* Length of the dash. 0 to 1. 0.5 means half empty, half drawn.
|
|
35
|
+
*/
|
|
36
|
+
dashRatio: number;
|
|
37
|
+
/**
|
|
38
|
+
* Whether to use the colors option to colorize the line
|
|
39
|
+
*/
|
|
40
|
+
useColors: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* The mixing mode of the color paramater. Default value is GreasedLineMeshColorMode.SET.
|
|
43
|
+
* MATERIAL_TYPE_SIMPLE mixes the color and colors of the greased line material.
|
|
44
|
+
* MATERIAL_TYPE_STANDARD and MATERIAL_TYPE_PBR mixes the color from the base material with the color and/or colors of the greased line material.
|
|
45
|
+
* @see GreasedLineMeshColorMode
|
|
46
|
+
*/
|
|
47
|
+
colorMode: GreasedLineMeshColorMode;
|
|
48
|
+
/**
|
|
49
|
+
* Colors of the line segments.
|
|
50
|
+
* Defaults to empty.
|
|
51
|
+
*/
|
|
52
|
+
colors: Nullable<Color3[]>;
|
|
53
|
+
/**
|
|
54
|
+
* If false then width units = scene units. If true then line will width be reduced.
|
|
55
|
+
* Defaults to false.
|
|
56
|
+
*/
|
|
57
|
+
sizeAttenuation: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Color of the line. Applies to all line segments.
|
|
60
|
+
* Defaults to White.
|
|
61
|
+
*/
|
|
62
|
+
color: Nullable<Color3>;
|
|
63
|
+
/**
|
|
64
|
+
* The method used to distribute the colors along the line.
|
|
65
|
+
* You can use segment distribution when each segment will use on color from the color table.
|
|
66
|
+
* Or you can use line distribution when the colors are distributed evenly along the line ignoring the segments.
|
|
67
|
+
*/
|
|
68
|
+
colorsDistributionType: GreasedLineMeshColorDistributionType;
|
|
69
|
+
/**
|
|
70
|
+
* Defaults to engine.getRenderWidth() and engine.getRenderHeight()
|
|
71
|
+
* Rendering resolution
|
|
72
|
+
*/
|
|
73
|
+
resolution: Vector2;
|
|
74
|
+
/**
|
|
75
|
+
* You can provide a colorsTexture to use instead of one generated from the 'colors' option
|
|
76
|
+
*/
|
|
77
|
+
colorsTexture: Nullable<RawTexture>;
|
|
78
|
+
/**
|
|
79
|
+
* Allows to change the color without marking the material dirty.
|
|
80
|
+
* MATERIAL_TYPE_STANDARD and MATERIAL_TYPE_PBR material's shaders will get recompiled if there was no color set and you set a color or when there was a color set and you set it to null.
|
|
81
|
+
* @param value the color
|
|
82
|
+
* @param doNotMarkDirty the flag
|
|
83
|
+
*/
|
|
84
|
+
setColor(value: Nullable<Color3>, doNotMarkDirty?: boolean): void;
|
|
85
|
+
/**
|
|
86
|
+
*
|
|
87
|
+
* @param colors colors array
|
|
88
|
+
* @param lazy if true the colors texture will not be updated
|
|
89
|
+
* @param forceNewTexture forces to create a new colors texture
|
|
90
|
+
*/
|
|
91
|
+
setColors(colors: Nullable<Color3[]>, lazy: boolean, forceNewTexture?: boolean): void;
|
|
92
|
+
/**
|
|
93
|
+
* Creates and sets the colors texture from the colors array which was created in lazy mode
|
|
94
|
+
*/
|
|
95
|
+
updateLazy(): void;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Material types for GreasedLine
|
|
99
|
+
* {@link https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param/greased_line#materialtype}
|
|
100
|
+
*/
|
|
101
|
+
export declare enum GreasedLineMeshMaterialType {
|
|
102
|
+
/**
|
|
103
|
+
* StandardMaterial
|
|
104
|
+
*/
|
|
105
|
+
MATERIAL_TYPE_STANDARD = 0,
|
|
106
|
+
/**
|
|
107
|
+
* PBR Material
|
|
108
|
+
*/
|
|
109
|
+
MATERIAL_TYPE_PBR = 1,
|
|
110
|
+
/**
|
|
111
|
+
* Simple and fast shader material not supporting lightning nor textures
|
|
112
|
+
*/
|
|
113
|
+
MATERIAL_TYPE_SIMPLE = 2
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Color blending mode of the @see GreasedLineMaterial and the base material
|
|
117
|
+
* {@link https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param/greased_line#colormode}
|
|
118
|
+
*/
|
|
119
|
+
export declare enum GreasedLineMeshColorMode {
|
|
120
|
+
/**
|
|
121
|
+
* Color blending mode SET
|
|
122
|
+
*/
|
|
123
|
+
COLOR_MODE_SET = 0,
|
|
124
|
+
/**
|
|
125
|
+
* Color blending mode ADD
|
|
126
|
+
*/
|
|
127
|
+
COLOR_MODE_ADD = 1,
|
|
128
|
+
/**
|
|
129
|
+
* Color blending mode ADD
|
|
130
|
+
*/
|
|
131
|
+
COLOR_MODE_MULTIPLY = 2
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Color distribution type of the @see colors.
|
|
135
|
+
* {@link https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param/greased_line#colordistributiontype}
|
|
136
|
+
*
|
|
137
|
+
*/
|
|
138
|
+
export declare enum GreasedLineMeshColorDistributionType {
|
|
139
|
+
/**
|
|
140
|
+
* Colors distributed between segments of the line
|
|
141
|
+
*/
|
|
142
|
+
COLOR_DISTRIBUTION_TYPE_SEGMENT = 0,
|
|
143
|
+
/**
|
|
144
|
+
* Colors distributed along the line ingoring the segments
|
|
145
|
+
*/
|
|
146
|
+
COLOR_DISTRIBUTION_TYPE_LINE = 1
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Options for GreasedLineMaterial
|
|
150
|
+
*/
|
|
151
|
+
export interface GreasedLineMaterialOptions {
|
|
152
|
+
/**
|
|
153
|
+
* Line width. If sizeAttenuation os false scene units will be used for width.
|
|
154
|
+
* Defaults to 0.1 if @see sizeAttenuation is false, or to 1 if it's true.
|
|
155
|
+
*/
|
|
156
|
+
width?: number;
|
|
157
|
+
/**
|
|
158
|
+
* If false then width units = scene units. If true then line will width be reduced.
|
|
159
|
+
* Defaults to false.
|
|
160
|
+
*/
|
|
161
|
+
sizeAttenuation?: boolean;
|
|
162
|
+
/**
|
|
163
|
+
* Type of the material to use to render the line.
|
|
164
|
+
* Defaults to StandardMaterial.
|
|
165
|
+
*/
|
|
166
|
+
materialType?: GreasedLineMeshMaterialType;
|
|
167
|
+
/**
|
|
168
|
+
* Color of the line. Applies to all line segments.
|
|
169
|
+
* Defaults to White.
|
|
170
|
+
*/
|
|
171
|
+
color?: Color3;
|
|
172
|
+
/**
|
|
173
|
+
* Color mode of the line. Applies to all line segments.
|
|
174
|
+
* The pixel color from the material shader will be modified with the value of @see color using the colorMode.
|
|
175
|
+
* Defaults to @see GreasedLineMeshColorMode.SET
|
|
176
|
+
*/
|
|
177
|
+
colorMode?: GreasedLineMeshColorMode;
|
|
178
|
+
/**
|
|
179
|
+
* Colors of the line segments.
|
|
180
|
+
* Defaults to empty.
|
|
181
|
+
*/
|
|
182
|
+
colors?: Color3[];
|
|
183
|
+
/**
|
|
184
|
+
* If true, @see colors are used, otherwise they're ignored.
|
|
185
|
+
* Defaults to false.
|
|
186
|
+
*/
|
|
187
|
+
useColors?: boolean;
|
|
188
|
+
/**
|
|
189
|
+
* Sampling type of the colors texture
|
|
190
|
+
* Defaults to NEAREST_NEAREST.
|
|
191
|
+
*/
|
|
192
|
+
colorsSampling?: number;
|
|
193
|
+
/**
|
|
194
|
+
* The method used to distribute the colors along the line.
|
|
195
|
+
* You can use segment distribution when each segment will use on color from the color table.
|
|
196
|
+
* Or you can use line distribution when the colors are distributed evenly along the line ignoring the segments.
|
|
197
|
+
*/
|
|
198
|
+
colorDistributionType?: GreasedLineMeshColorDistributionType;
|
|
199
|
+
/**
|
|
200
|
+
* If true, dashing is used.
|
|
201
|
+
* Defaults to false.
|
|
202
|
+
*/
|
|
203
|
+
useDash?: boolean;
|
|
204
|
+
/**
|
|
205
|
+
* @see GreasedLinePluginMaterial.setDashCount
|
|
206
|
+
* Number of dashes in the line.
|
|
207
|
+
* Defaults to 1.
|
|
208
|
+
*/
|
|
209
|
+
dashCount?: number;
|
|
210
|
+
/**
|
|
211
|
+
* Offset of the dashes along the line. 0 to 1.
|
|
212
|
+
* Defaults to 0.
|
|
213
|
+
* @see GreasedLinePluginMaterial.setDashOffset
|
|
214
|
+
*/
|
|
215
|
+
dashOffset?: number;
|
|
216
|
+
/**
|
|
217
|
+
* Length of the dash. 0 to 1. 0.5 means half empty, half drawn.
|
|
218
|
+
* Defaults to 0.5.
|
|
219
|
+
* @see GreasedLinePluginMaterial.setDashRatio
|
|
220
|
+
*/
|
|
221
|
+
dashRatio?: number;
|
|
222
|
+
/**
|
|
223
|
+
* Sets the line length visibility.
|
|
224
|
+
* 0 - 0% of the line will be visible.
|
|
225
|
+
* 1 - 100% of the line will be visible.
|
|
226
|
+
* @see GreasedLinePluginMaterial.setVisibility
|
|
227
|
+
*/
|
|
228
|
+
visibility?: number;
|
|
229
|
+
/**
|
|
230
|
+
* Defaults to engine.getRenderWidth() and engine.getRenderHeight()
|
|
231
|
+
* Rendering resolution
|
|
232
|
+
*/
|
|
233
|
+
resolution?: Vector2;
|
|
234
|
+
/**
|
|
235
|
+
* Whether to use camera facing for the line.
|
|
236
|
+
* Defaults to true.
|
|
237
|
+
*/
|
|
238
|
+
cameraFacing?: boolean;
|
|
239
|
+
/**
|
|
240
|
+
* You can provide a colorsTexture to use instead of one generated from the 'colors' option
|
|
241
|
+
*/
|
|
242
|
+
colorsTexture?: RawTexture;
|
|
243
|
+
}
|