@babylonjs/core 6.45.1 → 6.46.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Animations/animation.js +1 -1
- package/Animations/animation.js.map +1 -1
- package/Animations/animationGroup.d.ts +5 -3
- package/Animations/animationGroup.js +19 -4
- package/Animations/animationGroup.js.map +1 -1
- package/BakedVertexAnimation/bakedVertexAnimationManager.js +2 -1
- package/BakedVertexAnimation/bakedVertexAnimationManager.js.map +1 -1
- package/BakedVertexAnimation/vertexAnimationBaker.d.ts +4 -2
- package/BakedVertexAnimation/vertexAnimationBaker.js +25 -17
- package/BakedVertexAnimation/vertexAnimationBaker.js.map +1 -1
- package/Bones/skeleton.d.ts +1 -1
- package/Bones/skeleton.js +5 -2
- package/Bones/skeleton.js.map +1 -1
- package/Cameras/arcRotateCamera.d.ts +3 -3
- package/Cameras/arcRotateCamera.js +3 -3
- package/Cameras/arcRotateCamera.js.map +1 -1
- package/Cameras/camera.d.ts +3 -3
- package/Cameras/camera.js +2 -1
- package/Cameras/camera.js.map +1 -1
- package/Cameras/cameraInputsManager.js +1 -1
- package/Cameras/cameraInputsManager.js.map +1 -1
- package/Cameras/targetCamera.js +4 -0
- package/Cameras/targetCamera.js.map +1 -1
- package/Compute/computeShader.d.ts +4 -2
- package/Compute/computeShader.js +7 -3
- package/Compute/computeShader.js.map +1 -1
- package/Debug/directionalLightFrustumViewer.js +6 -6
- package/Debug/directionalLightFrustumViewer.js.map +1 -1
- package/Engines/Extensions/engine.computeShader.d.ts +2 -1
- package/Engines/Extensions/engine.computeShader.js +1 -0
- package/Engines/Extensions/engine.computeShader.js.map +1 -1
- package/Engines/Extensions/engine.dynamicBuffer.js.map +1 -1
- package/Engines/Extensions/engine.rawTexture.js +3 -3
- package/Engines/Extensions/engine.rawTexture.js.map +1 -1
- package/Engines/Native/nativeInterfaces.d.ts +4 -4
- package/Engines/Native/nativeInterfaces.js.map +1 -1
- package/Engines/Native/nativePipelineContext.js +1 -1
- package/Engines/Native/nativePipelineContext.js.map +1 -1
- package/Engines/WebGL/webGLPipelineContext.js +1 -1
- package/Engines/WebGL/webGLPipelineContext.js.map +1 -1
- package/Engines/WebGPU/webgpuComputeContext.js +7 -3
- package/Engines/WebGPU/webgpuComputeContext.js.map +1 -1
- package/Engines/nativeEngine.d.ts +1 -1
- package/Engines/nativeEngine.js +4 -3
- package/Engines/nativeEngine.js.map +1 -1
- package/Engines/thinEngine.js +2 -2
- package/Engines/thinEngine.js.map +1 -1
- package/FlowGraph/Blocks/Execution/Animation/flowGraphPauseAnimationBlock.d.ts +1 -1
- package/FlowGraph/Blocks/Execution/Animation/flowGraphPauseAnimationBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.d.ts +1 -1
- package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.js.map +1 -1
- package/Gizmos/gizmo.d.ts +1 -1
- package/Gizmos/gizmo.js.map +1 -1
- package/Layers/glowLayer.js +2 -1
- package/Layers/glowLayer.js.map +1 -1
- package/Layers/highlightLayer.js +2 -1
- package/Layers/highlightLayer.js.map +1 -1
- package/Lights/light.js +2 -1
- package/Lights/light.js.map +1 -1
- package/Loading/Plugins/babylonFileLoader.js +9 -0
- package/Loading/Plugins/babylonFileLoader.js.map +1 -1
- package/Loading/sceneLoader.d.ts +6 -1
- package/Loading/sceneLoader.js +6 -5
- package/Loading/sceneLoader.js.map +1 -1
- package/Materials/Background/backgroundMaterial.js +2 -1
- package/Materials/Background/backgroundMaterial.js.map +1 -1
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.js +1 -1
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.js.map +1 -1
- package/Materials/Node/nodeMaterial.d.ts +2 -1
- package/Materials/Node/nodeMaterial.js +4 -1
- package/Materials/Node/nodeMaterial.js.map +1 -1
- package/Materials/PBR/pbrBaseMaterial.d.ts +1 -1
- package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
- package/Materials/PBR/pbrMaterial.js +2 -1
- package/Materials/PBR/pbrMaterial.js.map +1 -1
- package/Materials/PBR/pbrMetallicRoughnessMaterial.js +2 -1
- package/Materials/PBR/pbrMetallicRoughnessMaterial.js.map +1 -1
- package/Materials/PBR/pbrSpecularGlossinessMaterial.js +2 -1
- package/Materials/PBR/pbrSpecularGlossinessMaterial.js.map +1 -1
- package/Materials/Textures/baseTexture.js +2 -1
- package/Materials/Textures/baseTexture.js.map +1 -1
- package/Materials/Textures/cubeTexture.js +2 -1
- package/Materials/Textures/cubeTexture.js.map +1 -1
- package/Materials/Textures/rawCubeTexture.js +1 -1
- package/Materials/Textures/rawCubeTexture.js.map +1 -1
- package/Materials/Textures/texture.js +2 -1
- package/Materials/Textures/texture.js.map +1 -1
- package/Materials/colorCurves.d.ts +1 -1
- package/Materials/colorCurves.functions.d.ts +5 -0
- package/Materials/colorCurves.functions.js +8 -0
- package/Materials/colorCurves.functions.js.map +1 -0
- package/Materials/colorCurves.js +8 -8
- package/Materials/colorCurves.js.map +1 -1
- package/Materials/fresnelParameters.js +1 -1
- package/Materials/fresnelParameters.js.map +1 -1
- package/Materials/imageProcessingConfiguration.d.ts +3 -48
- package/Materials/imageProcessingConfiguration.defines.d.ts +46 -0
- package/Materials/imageProcessingConfiguration.defines.js +27 -0
- package/Materials/imageProcessingConfiguration.defines.js.map +1 -0
- package/Materials/imageProcessingConfiguration.functions.d.ts +13 -0
- package/Materials/imageProcessingConfiguration.functions.js +41 -0
- package/Materials/imageProcessingConfiguration.functions.js.map +1 -0
- package/Materials/imageProcessingConfiguration.js +18 -69
- package/Materials/imageProcessingConfiguration.js.map +1 -1
- package/Materials/material.js +2 -1
- package/Materials/material.js.map +1 -1
- package/Materials/materialHelper.d.ts +33 -33
- package/Materials/materialHelper.js +244 -286
- package/Materials/materialHelper.js.map +1 -1
- package/Materials/materialPluginBase.js +2 -1
- package/Materials/materialPluginBase.js.map +1 -1
- package/Materials/materialStencilState.js +2 -1
- package/Materials/materialStencilState.js.map +1 -1
- package/Materials/shaderMaterial.js +1 -1
- package/Materials/shaderMaterial.js.map +1 -1
- package/Materials/standardMaterial.d.ts +1 -1
- package/Materials/standardMaterial.js +2 -1
- package/Materials/standardMaterial.js.map +1 -1
- package/Materials/uniformBuffer.js +2 -2
- package/Materials/uniformBuffer.js.map +1 -1
- package/Maths/math.color.d.ts +392 -66
- package/Maths/math.color.js +541 -65
- package/Maths/math.color.js.map +1 -1
- package/Maths/math.like.d.ts +17 -28
- package/Maths/math.like.js.map +1 -1
- package/Maths/math.plane.d.ts +2 -1
- package/Maths/math.plane.js.map +1 -1
- package/Maths/math.polar.d.ts +1 -1
- package/Maths/math.polar.js.map +1 -1
- package/Maths/math.scalar.d.ts +6 -6
- package/Maths/math.scalar.functions.d.ts +51 -0
- package/Maths/math.scalar.functions.js +80 -0
- package/Maths/math.scalar.functions.js.map +1 -0
- package/Maths/math.scalar.js +48 -73
- package/Maths/math.scalar.js.map +1 -1
- package/Maths/math.vector.d.ts +571 -72
- package/Maths/math.vector.js +917 -119
- package/Maths/math.vector.js.map +1 -1
- package/Maths/math.viewport.d.ts +2 -1
- package/Maths/math.viewport.js.map +1 -1
- package/Maths/tensor.d.ts +411 -0
- package/Maths/tensor.js +3 -0
- package/Maths/tensor.js.map +1 -0
- package/Meshes/Compression/dracoCompressionWorker.d.ts +1 -2
- package/Meshes/Compression/dracoCompressionWorker.js +1 -1
- package/Meshes/Compression/dracoCompressionWorker.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +10 -3
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
- package/Meshes/Node/Blocks/Set/setColorsBlock.js +20 -4
- package/Meshes/Node/Blocks/Set/setColorsBlock.js.map +1 -1
- package/Meshes/Node/nodeGeometry.js +2 -1
- package/Meshes/Node/nodeGeometry.js.map +1 -1
- package/Meshes/mesh.js +2 -2
- package/Meshes/mesh.js.map +1 -1
- package/Meshes/mesh.vertexData.d.ts +4 -0
- package/Meshes/mesh.vertexData.js +10 -0
- package/Meshes/mesh.vertexData.js.map +1 -1
- package/Meshes/transformNode.js +2 -1
- package/Meshes/transformNode.js.map +1 -1
- package/Misc/arrayTools.d.ts +2 -19
- package/Misc/arrayTools.js.map +1 -1
- package/Misc/decorators.d.ts +0 -80
- package/Misc/decorators.functions.d.ts +7 -0
- package/Misc/decorators.functions.js +52 -0
- package/Misc/decorators.functions.js.map +1 -0
- package/Misc/decorators.js +2 -318
- package/Misc/decorators.js.map +1 -1
- package/Misc/decorators.serialization.d.ts +81 -0
- package/Misc/decorators.serialization.js +269 -0
- package/Misc/decorators.serialization.js.map +1 -0
- package/Misc/index.d.ts +1 -0
- package/Misc/index.js +1 -0
- package/Misc/index.js.map +1 -1
- package/Misc/sceneRecorder.js +1 -1
- package/Misc/sceneRecorder.js.map +1 -1
- package/Misc/sceneSerializer.js +8 -1
- package/Misc/sceneSerializer.js.map +1 -1
- package/Misc/tools.functions.d.ts +14 -0
- package/Misc/tools.functions.js +23 -0
- package/Misc/tools.functions.js.map +1 -0
- package/Misc/tools.js +5 -6
- package/Misc/tools.js.map +1 -1
- package/Morph/morphTarget.js +2 -1
- package/Morph/morphTarget.js.map +1 -1
- package/Particles/EmitterTypes/boxParticleEmitter.js +8 -8
- package/Particles/EmitterTypes/boxParticleEmitter.js.map +1 -1
- package/Particles/baseParticleSystem.d.ts +8 -11
- package/Particles/baseParticleSystem.js +9 -40
- package/Particles/baseParticleSystem.js.map +1 -1
- package/Particles/gpuParticleSystem.d.ts +71 -1
- package/Particles/gpuParticleSystem.js +102 -1
- package/Particles/gpuParticleSystem.js.map +1 -1
- package/Particles/particle.d.ts +3 -3
- package/Particles/particle.js +3 -3
- package/Particles/particle.js.map +1 -1
- package/Particles/particleSystem.d.ts +81 -455
- package/Particles/particleSystem.functions.d.ts +61 -0
- package/Particles/particleSystem.functions.js +79 -0
- package/Particles/particleSystem.functions.js.map +1 -0
- package/Particles/particleSystem.js +390 -1984
- package/Particles/particleSystem.js.map +1 -1
- package/Particles/thinParticleSystem.d.ts +485 -0
- package/Particles/thinParticleSystem.js +1768 -0
- package/Particles/thinParticleSystem.js.map +1 -0
- package/Physics/castingResult.d.ts +1 -1
- package/Physics/castingResult.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js +2 -1
- package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js +2 -1
- package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/ssrRenderingPipeline.js +2 -1
- package/PostProcesses/RenderPipeline/Pipelines/ssrRenderingPipeline.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/standardRenderingPipeline.js +2 -1
- package/PostProcesses/RenderPipeline/Pipelines/standardRenderingPipeline.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/taaRenderingPipeline.js +2 -1
- package/PostProcesses/RenderPipeline/Pipelines/taaRenderingPipeline.js.map +1 -1
- package/PostProcesses/blackAndWhitePostProcess.js +2 -1
- package/PostProcesses/blackAndWhitePostProcess.js.map +1 -1
- package/PostProcesses/blurPostProcess.js +2 -1
- package/PostProcesses/blurPostProcess.js.map +1 -1
- package/PostProcesses/chromaticAberrationPostProcess.js +2 -1
- package/PostProcesses/chromaticAberrationPostProcess.js.map +1 -1
- package/PostProcesses/colorCorrectionPostProcess.js +2 -1
- package/PostProcesses/colorCorrectionPostProcess.js.map +1 -1
- package/PostProcesses/convolutionPostProcess.js +2 -1
- package/PostProcesses/convolutionPostProcess.js.map +1 -1
- package/PostProcesses/displayPassPostProcess.js +1 -1
- package/PostProcesses/displayPassPostProcess.js.map +1 -1
- package/PostProcesses/filterPostProcess.js +2 -1
- package/PostProcesses/filterPostProcess.js.map +1 -1
- package/PostProcesses/fxaaPostProcess.js +1 -1
- package/PostProcesses/fxaaPostProcess.js.map +1 -1
- package/PostProcesses/grainPostProcess.js +2 -1
- package/PostProcesses/grainPostProcess.js.map +1 -1
- package/PostProcesses/imageProcessingPostProcess.js.map +1 -1
- package/PostProcesses/motionBlurPostProcess.js +2 -1
- package/PostProcesses/motionBlurPostProcess.js.map +1 -1
- package/PostProcesses/passPostProcess.js +1 -1
- package/PostProcesses/passPostProcess.js.map +1 -1
- package/PostProcesses/postProcess.js +2 -1
- package/PostProcesses/postProcess.js.map +1 -1
- package/PostProcesses/refractionPostProcess.js +2 -1
- package/PostProcesses/refractionPostProcess.js.map +1 -1
- package/PostProcesses/screenSpaceCurvaturePostProcess.js +2 -1
- package/PostProcesses/screenSpaceCurvaturePostProcess.js.map +1 -1
- package/PostProcesses/screenSpaceReflectionPostProcess.js +2 -1
- package/PostProcesses/screenSpaceReflectionPostProcess.js.map +1 -1
- package/PostProcesses/sharpenPostProcess.js +2 -1
- package/PostProcesses/sharpenPostProcess.js.map +1 -1
- package/Probes/reflectionProbe.js +2 -1
- package/Probes/reflectionProbe.js.map +1 -1
- package/Sprites/spriteManager.d.ts +4 -0
- package/Sprites/spriteManager.js.map +1 -1
- package/XR/features/WebXRControllerTeleportation.d.ts +13 -0
- package/XR/features/WebXRControllerTeleportation.js +108 -32
- package/XR/features/WebXRControllerTeleportation.js.map +1 -1
- package/XR/features/WebXRNearInteraction.js +11 -1
- package/XR/features/WebXRNearInteraction.js.map +1 -1
- package/node.js +2 -1
- package/node.js.map +1 -1
- package/package.json +1 -1
- package/types.d.ts +105 -0
- package/types.js.map +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { FlowGraphContext } from "../../../flowGraphContext";
|
|
2
2
|
import type { FlowGraphDataConnection } from "../../../flowGraphDataConnection";
|
|
3
3
|
import { FlowGraphExecutionBlockWithOutSignal } from "../../../flowGraphExecutionBlockWithOutSignal";
|
|
4
|
-
import type { Animatable } from "../../../../Animations";
|
|
4
|
+
import type { Animatable } from "../../../../Animations/animatable";
|
|
5
5
|
import type { IFlowGraphBlockConfiguration } from "../../../flowGraphBlock";
|
|
6
6
|
/**
|
|
7
7
|
* @experimental
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flowGraphPauseAnimationBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/FlowGraph/Blocks/Execution/Animation/flowGraphPauseAnimationBlock.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oCAAoC,EAAE,MAAM,+CAA+C,CAAC;AAErG,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAE1D,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D;;;GAGG;AACH,MAAM,OAAO,4BAA6B,SAAQ,oCAAoC;IAMlF,YAAY,MAAqC;QAC7C,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC,iBAAiB,CAAC,kBAAkB,EAAE,WAAW,CAAC,CAAC;IACpF,CAAC;IAEM,QAAQ,CAAC,OAAyB;QACrC,MAAM,qBAAqB,GAAG,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QACtE,qBAAqB,CAAC,KAAK,EAAE,CAAC;QAC9B,IAAI,CAAC,GAAG,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;IACtC,CAAC;IAED;;OAEG;IACI,YAAY;QACf,OAAO,uBAAuB,CAAC;IACnC,CAAC;CACJ;AACD,aAAa,CAAC,uBAAuB,EAAE,4BAA4B,CAAC,CAAC","sourcesContent":["import type { FlowGraphContext } from \"../../../flowGraphContext\";\r\nimport type { FlowGraphDataConnection } from \"../../../flowGraphDataConnection\";\r\nimport { FlowGraphExecutionBlockWithOutSignal } from \"../../../flowGraphExecutionBlockWithOutSignal\";\r\nimport type { Animatable } from \"../../../../Animations\";\r\nimport { RichTypeAny } from \"../../../flowGraphRichTypes\";\r\nimport type { IFlowGraphBlockConfiguration } from \"../../../flowGraphBlock\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\n/**\r\n * @experimental\r\n * Block that pauses a running animation\r\n */\r\nexport class FlowGraphPauseAnimationBlock extends FlowGraphExecutionBlockWithOutSignal {\r\n /**\r\n * Input connection: The animation to pause.\r\n */\r\n public readonly animationToPause: FlowGraphDataConnection<Animatable>;\r\n\r\n constructor(config?: IFlowGraphBlockConfiguration) {\r\n super(config);\r\n this.animationToPause = this.registerDataInput(\"animationToPause\", RichTypeAny);\r\n }\r\n\r\n public _execute(context: FlowGraphContext): void {\r\n const animationToPauseValue = this.animationToPause.getValue(context);\r\n animationToPauseValue.pause();\r\n this.out._activateSignal(context);\r\n }\r\n\r\n /**\r\n * @returns class name of the block.\r\n */\r\n public getClassName(): string {\r\n return \"FGPauseAnimationBlock\";\r\n }\r\n}\r\nRegisterClass(\"FGPauseAnimationBlock\", FlowGraphPauseAnimationBlock);\r\n"]}
|
|
1
|
+
{"version":3,"file":"flowGraphPauseAnimationBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/FlowGraph/Blocks/Execution/Animation/flowGraphPauseAnimationBlock.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oCAAoC,EAAE,MAAM,+CAA+C,CAAC;AAErG,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAE1D,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D;;;GAGG;AACH,MAAM,OAAO,4BAA6B,SAAQ,oCAAoC;IAMlF,YAAY,MAAqC;QAC7C,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC,iBAAiB,CAAC,kBAAkB,EAAE,WAAW,CAAC,CAAC;IACpF,CAAC;IAEM,QAAQ,CAAC,OAAyB;QACrC,MAAM,qBAAqB,GAAG,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QACtE,qBAAqB,CAAC,KAAK,EAAE,CAAC;QAC9B,IAAI,CAAC,GAAG,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;IACtC,CAAC;IAED;;OAEG;IACI,YAAY;QACf,OAAO,uBAAuB,CAAC;IACnC,CAAC;CACJ;AACD,aAAa,CAAC,uBAAuB,EAAE,4BAA4B,CAAC,CAAC","sourcesContent":["import type { FlowGraphContext } from \"../../../flowGraphContext\";\r\nimport type { FlowGraphDataConnection } from \"../../../flowGraphDataConnection\";\r\nimport { FlowGraphExecutionBlockWithOutSignal } from \"../../../flowGraphExecutionBlockWithOutSignal\";\r\nimport type { Animatable } from \"../../../../Animations/animatable\";\r\nimport { RichTypeAny } from \"../../../flowGraphRichTypes\";\r\nimport type { IFlowGraphBlockConfiguration } from \"../../../flowGraphBlock\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\n/**\r\n * @experimental\r\n * Block that pauses a running animation\r\n */\r\nexport class FlowGraphPauseAnimationBlock extends FlowGraphExecutionBlockWithOutSignal {\r\n /**\r\n * Input connection: The animation to pause.\r\n */\r\n public readonly animationToPause: FlowGraphDataConnection<Animatable>;\r\n\r\n constructor(config?: IFlowGraphBlockConfiguration) {\r\n super(config);\r\n this.animationToPause = this.registerDataInput(\"animationToPause\", RichTypeAny);\r\n }\r\n\r\n public _execute(context: FlowGraphContext): void {\r\n const animationToPauseValue = this.animationToPause.getValue(context);\r\n animationToPauseValue.pause();\r\n this.out._activateSignal(context);\r\n }\r\n\r\n /**\r\n * @returns class name of the block.\r\n */\r\n public getClassName(): string {\r\n return \"FGPauseAnimationBlock\";\r\n }\r\n}\r\nRegisterClass(\"FGPauseAnimationBlock\", FlowGraphPauseAnimationBlock);\r\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { FlowGraphContext } from "../../../flowGraphContext";
|
|
2
2
|
import type { FlowGraphDataConnection } from "../../../flowGraphDataConnection";
|
|
3
3
|
import { FlowGraphExecutionBlockWithOutSignal } from "../../../flowGraphExecutionBlockWithOutSignal";
|
|
4
|
-
import type { Animatable } from "../../../../Animations";
|
|
4
|
+
import type { Animatable } from "../../../../Animations/animatable";
|
|
5
5
|
import type { IFlowGraphBlockConfiguration } from "../../../flowGraphBlock";
|
|
6
6
|
/**
|
|
7
7
|
* @experimental
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flowGraphStopAnimationBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oCAAoC,EAAE,MAAM,+CAA+C,CAAC;AAErG,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAE1D,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D;;;GAGG;AACH,MAAM,OAAO,2BAA4B,SAAQ,oCAAoC;IAMjF,YAAY,MAAqC;QAC7C,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,iBAAiB,CAAC,iBAAiB,EAAE,WAAW,CAAC,CAAC;IAClF,CAAC;IAEM,QAAQ,CAAC,OAAyB;QACrC,MAAM,oBAAoB,GAAG,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QACpE,oBAAoB,CAAC,IAAI,EAAE,CAAC;QAC5B,IAAI,CAAC,GAAG,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;IACtC,CAAC;IAED;;OAEG;IACI,YAAY;QACf,OAAO,sBAAsB,CAAC;IAClC,CAAC;CACJ;AACD,aAAa,CAAC,sBAAsB,EAAE,2BAA2B,CAAC,CAAC","sourcesContent":["import type { FlowGraphContext } from \"../../../flowGraphContext\";\r\nimport type { FlowGraphDataConnection } from \"../../../flowGraphDataConnection\";\r\nimport { FlowGraphExecutionBlockWithOutSignal } from \"../../../flowGraphExecutionBlockWithOutSignal\";\r\nimport type { Animatable } from \"../../../../Animations\";\r\nimport { RichTypeAny } from \"../../../flowGraphRichTypes\";\r\nimport type { IFlowGraphBlockConfiguration } from \"../../../flowGraphBlock\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\n/**\r\n * @experimental\r\n * Block that stops a running animation\r\n */\r\nexport class FlowGraphStopAnimationBlock extends FlowGraphExecutionBlockWithOutSignal {\r\n /**\r\n * Input connection: The animation to stop.\r\n */\r\n public readonly animationToStop: FlowGraphDataConnection<Animatable>;\r\n\r\n constructor(config?: IFlowGraphBlockConfiguration) {\r\n super(config);\r\n this.animationToStop = this.registerDataInput(\"animationToStop\", RichTypeAny);\r\n }\r\n\r\n public _execute(context: FlowGraphContext): void {\r\n const animationToStopValue = this.animationToStop.getValue(context);\r\n animationToStopValue.stop();\r\n this.out._activateSignal(context);\r\n }\r\n\r\n /**\r\n * @returns class name of the block.\r\n */\r\n public getClassName(): string {\r\n return \"FGStopAnimationBlock\";\r\n }\r\n}\r\nRegisterClass(\"FGStopAnimationBlock\", FlowGraphStopAnimationBlock);\r\n"]}
|
|
1
|
+
{"version":3,"file":"flowGraphStopAnimationBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oCAAoC,EAAE,MAAM,+CAA+C,CAAC;AAErG,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAE1D,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D;;;GAGG;AACH,MAAM,OAAO,2BAA4B,SAAQ,oCAAoC;IAMjF,YAAY,MAAqC;QAC7C,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,iBAAiB,CAAC,iBAAiB,EAAE,WAAW,CAAC,CAAC;IAClF,CAAC;IAEM,QAAQ,CAAC,OAAyB;QACrC,MAAM,oBAAoB,GAAG,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QACpE,oBAAoB,CAAC,IAAI,EAAE,CAAC;QAC5B,IAAI,CAAC,GAAG,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;IACtC,CAAC;IAED;;OAEG;IACI,YAAY;QACf,OAAO,sBAAsB,CAAC;IAClC,CAAC;CACJ;AACD,aAAa,CAAC,sBAAsB,EAAE,2BAA2B,CAAC,CAAC","sourcesContent":["import type { FlowGraphContext } from \"../../../flowGraphContext\";\r\nimport type { FlowGraphDataConnection } from \"../../../flowGraphDataConnection\";\r\nimport { FlowGraphExecutionBlockWithOutSignal } from \"../../../flowGraphExecutionBlockWithOutSignal\";\r\nimport type { Animatable } from \"../../../../Animations/animatable\";\r\nimport { RichTypeAny } from \"../../../flowGraphRichTypes\";\r\nimport type { IFlowGraphBlockConfiguration } from \"../../../flowGraphBlock\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\n/**\r\n * @experimental\r\n * Block that stops a running animation\r\n */\r\nexport class FlowGraphStopAnimationBlock extends FlowGraphExecutionBlockWithOutSignal {\r\n /**\r\n * Input connection: The animation to stop.\r\n */\r\n public readonly animationToStop: FlowGraphDataConnection<Animatable>;\r\n\r\n constructor(config?: IFlowGraphBlockConfiguration) {\r\n super(config);\r\n this.animationToStop = this.registerDataInput(\"animationToStop\", RichTypeAny);\r\n }\r\n\r\n public _execute(context: FlowGraphContext): void {\r\n const animationToStopValue = this.animationToStop.getValue(context);\r\n animationToStopValue.stop();\r\n this.out._activateSignal(context);\r\n }\r\n\r\n /**\r\n * @returns class name of the block.\r\n */\r\n public getClassName(): string {\r\n return \"FGStopAnimationBlock\";\r\n }\r\n}\r\nRegisterClass(\"FGStopAnimationBlock\", FlowGraphStopAnimationBlock);\r\n"]}
|
package/Gizmos/gizmo.d.ts
CHANGED
|
@@ -103,7 +103,7 @@ export interface IGizmo extends IDisposable {
|
|
|
103
103
|
* It's useful when the gizmo is attached to a bone: if the bone is part of a skeleton attached to a mesh, you should define the mesh as additionalTransformNode if you want the gizmo to be displayed at the bone's correct location.
|
|
104
104
|
* Otherwise, as the gizmo is relative to the skeleton root, the mesh transformation will not be taken into account.
|
|
105
105
|
*/
|
|
106
|
-
additionalTransformNode?: TransformNode;
|
|
106
|
+
additionalTransformNode?: TransformNode | undefined;
|
|
107
107
|
}
|
|
108
108
|
/**
|
|
109
109
|
* Renders gizmos on top of an existing scene which provide controls for position, rotation, etc.
|
package/Gizmos/gizmo.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAIzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAI5D,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAsBxC;;GAEG;AACH,MAAM,CAAN,IAAY,gBAKX;AALD,WAAY,gBAAgB;IACxB,sCAAsC;IACtC,2DAAM,CAAA;IACN,0CAA0C;IAC1C,yDAAK,CAAA;AACT,CAAC,EALW,gBAAgB,KAAhB,gBAAgB,QAK3B;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,oBAGX;AAHD,WAAY,oBAAoB;IAC5B,iEAAK,CAAA;IACL,iEAAK,CAAA;AACT,CAAC,EAHW,oBAAoB,KAApB,oBAAoB,QAG/B;AAiED;;GAEG;AACH,MAAM,OAAO,KAAK;IAgCd;;OAEG;IACH,IAAW,UAAU,CAAC,KAAa;QAC/B,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;IAC7B,CAAC;IAED,IAAW,UAAU;QACjB,OAAO,IAAI,CAAC,WAAW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AS;AAEtC;;;;GAIG;AACW,wBAAkB,GAAG,IAAI,AAAP,CAAQ","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 /**\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 setCustomMesh(mesh: Mesh): void;\r\n\r\n /**\r\n * Additional transform applied to the gizmo.\r\n * It's useful when the gizmo is attached to a bone: if the bone is part of a skeleton attached to a mesh, you should define the mesh as additionalTransformNode if you want the gizmo to be displayed at the bone's correct location.\r\n * Otherwise, as the gizmo is relative to the skeleton root, the mesh transformation will not be taken into account.\r\n */\r\n additionalTransformNode?: TransformNode;\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 protected _additionalTransformNode?: TransformNode;\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 * There are 2 ways to preserve scaling: using mesh scaling or absolute scaling. Depending of hierarchy, non uniform scaling and LH or RH coordinates. One is preferable than the other.\r\n * If the scaling to be preserved is the local scaling, then set this value to false.\r\n * Default is true which means scaling to be preserved is absolute one (with hierarchy applied)\r\n */\r\n public static UseAbsoluteScaling = true;\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 // eslint-disable-next-line no-throw-literal\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 /**\r\n * Additional transform applied to the gizmo.\r\n * It's useful when the gizmo is attached to a bone: if the bone is part of a skeleton attached to a mesh, you should define the mesh as additionalTransformNode if you want the gizmo to be displayed at the bone's correct location.\r\n * Otherwise, as the gizmo is relative to the skeleton root, the mesh transformation will not be taken into account.\r\n */\r\n public get additionalTransformNode() {\r\n return this._additionalTransformNode;\r\n }\r\n\r\n public set additionalTransformNode(value: TransformNode | undefined) {\r\n this._additionalTransformNode = value;\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 if (this.additionalTransformNode) {\r\n this._rootMesh.computeWorldMatrix(true);\r\n this._rootMesh.getWorldMatrix().multiplyToRef(this.additionalTransformNode.getWorldMatrix(), TmpVectors.Matrix[0]);\r\n TmpVectors.Matrix[0].decompose(this._rootMesh.scaling, this._rootMesh.rotationQuaternion!, this._rootMesh.position);\r\n }\r\n }\r\n\r\n /**\r\n * if transform has a pivot and is not using PostMultiplyPivotMatrix, then the worldMatrix contains the pivot matrix (it's not cancelled at the end)\r\n * so, when extracting the world matrix component, the translation (and other components) is containing the pivot translation.\r\n * And the pivot is applied each frame. Removing it anyway here makes it applied only in computeWorldMatrix.\r\n * @param transform local transform that needs to be transform by the pivot inverse matrix\r\n * @param localMatrix local matrix that needs to be transform by the pivot inverse matrix\r\n * @param result resulting matrix transformed by pivot inverse if the transform node is using pivot without using post Multiply Pivot Matrix\r\n */\r\n protected _handlePivotMatrixInverse(transform: TransformNode, localMatrix: Matrix, result: Matrix): void {\r\n if (transform.isUsingPivotMatrix() && !transform.isUsingPostMultiplyPivotMatrix()) {\r\n transform.getPivotMatrix().invertToRef(TmpVectors.Matrix[5]);\r\n TmpVectors.Matrix[5].multiplyToRef(localMatrix, result);\r\n return;\r\n }\r\n result.copyFrom(localMatrix);\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 const matrixToDecompose = TmpVectors.Matrix[4];\r\n this._handlePivotMatrixInverse(transform, localMat, matrixToDecompose);\r\n matrixToDecompose.decompose(\r\n TmpVectors.Vector3[0],\r\n TmpVectors.Quaternion[0],\r\n transform.position,\r\n Gizmo.PreserveScaling ? transform : undefined,\r\n Gizmo.UseAbsoluteScaling\r\n );\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 const matrixToDecompose = TmpVectors.Matrix[4];\r\n this._handlePivotMatrixInverse(transform, this._attachedNode._worldMatrix, matrixToDecompose);\r\n matrixToDecompose.decompose(\r\n TmpVectors.Vector3[0],\r\n TmpVectors.Quaternion[0],\r\n transform.position,\r\n Gizmo.PreserveScaling ? transform : undefined,\r\n Gizmo.UseAbsoluteScaling\r\n );\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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AAC,CAAC,CAAO,EAAE,EAAE;4BAClC,CAAC,CAAC,QAAQ,GAAG,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,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;;AArhBD;;;GAGG;AACW,qBAAe,GAAG,KAAK,AAAR,CAAS;AAEtC;;;;GAIG;AACW,wBAAkB,GAAG,IAAI,AAAP,CAAQ","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 /**\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 setCustomMesh(mesh: Mesh): void;\r\n\r\n /**\r\n * Additional transform applied to the gizmo.\r\n * It's useful when the gizmo is attached to a bone: if the bone is part of a skeleton attached to a mesh, you should define the mesh as additionalTransformNode if you want the gizmo to be displayed at the bone's correct location.\r\n * Otherwise, as the gizmo is relative to the skeleton root, the mesh transformation will not be taken into account.\r\n */\r\n additionalTransformNode?: TransformNode | undefined;\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 protected _additionalTransformNode?: TransformNode;\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 * There are 2 ways to preserve scaling: using mesh scaling or absolute scaling. Depending of hierarchy, non uniform scaling and LH or RH coordinates. One is preferable than the other.\r\n * If the scaling to be preserved is the local scaling, then set this value to false.\r\n * Default is true which means scaling to be preserved is absolute one (with hierarchy applied)\r\n */\r\n public static UseAbsoluteScaling = true;\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 // eslint-disable-next-line no-throw-literal\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 /**\r\n * Additional transform applied to the gizmo.\r\n * It's useful when the gizmo is attached to a bone: if the bone is part of a skeleton attached to a mesh, you should define the mesh as additionalTransformNode if you want the gizmo to be displayed at the bone's correct location.\r\n * Otherwise, as the gizmo is relative to the skeleton root, the mesh transformation will not be taken into account.\r\n */\r\n public get additionalTransformNode() {\r\n return this._additionalTransformNode;\r\n }\r\n\r\n public set additionalTransformNode(value: TransformNode | undefined) {\r\n this._additionalTransformNode = value;\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 if (this.additionalTransformNode) {\r\n this._rootMesh.computeWorldMatrix(true);\r\n this._rootMesh.getWorldMatrix().multiplyToRef(this.additionalTransformNode.getWorldMatrix(), TmpVectors.Matrix[0]);\r\n TmpVectors.Matrix[0].decompose(this._rootMesh.scaling, this._rootMesh.rotationQuaternion!, this._rootMesh.position);\r\n }\r\n }\r\n\r\n /**\r\n * if transform has a pivot and is not using PostMultiplyPivotMatrix, then the worldMatrix contains the pivot matrix (it's not cancelled at the end)\r\n * so, when extracting the world matrix component, the translation (and other components) is containing the pivot translation.\r\n * And the pivot is applied each frame. Removing it anyway here makes it applied only in computeWorldMatrix.\r\n * @param transform local transform that needs to be transform by the pivot inverse matrix\r\n * @param localMatrix local matrix that needs to be transform by the pivot inverse matrix\r\n * @param result resulting matrix transformed by pivot inverse if the transform node is using pivot without using post Multiply Pivot Matrix\r\n */\r\n protected _handlePivotMatrixInverse(transform: TransformNode, localMatrix: Matrix, result: Matrix): void {\r\n if (transform.isUsingPivotMatrix() && !transform.isUsingPostMultiplyPivotMatrix()) {\r\n transform.getPivotMatrix().invertToRef(TmpVectors.Matrix[5]);\r\n TmpVectors.Matrix[5].multiplyToRef(localMatrix, result);\r\n return;\r\n }\r\n result.copyFrom(localMatrix);\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 const matrixToDecompose = TmpVectors.Matrix[4];\r\n this._handlePivotMatrixInverse(transform, localMat, matrixToDecompose);\r\n matrixToDecompose.decompose(\r\n TmpVectors.Vector3[0],\r\n TmpVectors.Quaternion[0],\r\n transform.position,\r\n Gizmo.PreserveScaling ? transform : undefined,\r\n Gizmo.UseAbsoluteScaling\r\n );\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 const matrixToDecompose = TmpVectors.Matrix[4];\r\n this._handlePivotMatrixInverse(transform, this._attachedNode._worldMatrix, matrixToDecompose);\r\n matrixToDecompose.decompose(\r\n TmpVectors.Vector3[0],\r\n TmpVectors.Quaternion[0],\r\n transform.position,\r\n Gizmo.PreserveScaling ? transform : undefined,\r\n Gizmo.UseAbsoluteScaling\r\n );\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"]}
|
package/Layers/glowLayer.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __decorate } from "../tslib.es6.js";
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
3
|
-
import { serialize
|
|
3
|
+
import { serialize } from "../Misc/decorators.js";
|
|
4
4
|
import { Vector2 } from "../Maths/math.vector.js";
|
|
5
5
|
import { VertexBuffer } from "../Buffers/buffer.js";
|
|
6
6
|
import { Texture } from "../Materials/Textures/texture.js";
|
|
@@ -16,6 +16,7 @@ import { Color4 } from "../Maths/math.color.js";
|
|
|
16
16
|
import "../Shaders/glowMapMerge.fragment.js";
|
|
17
17
|
import "../Shaders/glowMapMerge.vertex.js";
|
|
18
18
|
import "../Layers/effectLayerSceneComponent.js";
|
|
19
|
+
import { SerializationHelper } from "../Misc/decorators.serialization.js";
|
|
19
20
|
AbstractScene.prototype.getGlowLayerByName = function (name) {
|
|
20
21
|
for (let index = 0; index < this.effectLayers?.length; index++) {
|
|
21
22
|
if (this.effectLayers[index].name === name && this.effectLayers[index].getEffectName() === GlowLayer.EffectName) {
|
package/Layers/glowLayer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"glowLayer.js","sourceRoot":"","sources":["../../../../dev/core/src/Layers/glowLayer.ts"],"names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EAAE,KAAK,GAAG,eAAe,CAAC,cAAc,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;YACpE,MAAM,IAAI,GAAG,KAAK,CAAC,WAAW,CAAC,eAAe,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC;YACtE,IAAI,IAAI,EAAE;gBACN,EAAE,CAAC,mBAAmB,CAAO,IAAI,CAAC,CAAC;aACtC;SACJ;QAED,OAAO,EAAE,CAAC;IACd,CAAC;;AA5lBD;;GAEG;AACoB,oBAAU,GAAG,WAAW,AAAd,CAAe;AAEhD;;GAEG;AACW,+BAAqB,GAAG,EAAE,AAAL,CAAM;AAEzC;;GAEG;AACW,6BAAmB,GAAG,GAAG,AAAN,CAAO;AAuBxC;IADC,SAAS,EAAE;+CAGX;AAaD;IADC,SAAS,EAAE;0CAGX;AAGO;IADP,SAAS,CAAC,SAAS,CAAC;2CACe;AAuiBxC,aAAa,CAAC,mBAAmB,EAAE,SAAS,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\r\nimport { serialize, SerializationHelper } from \"../Misc/decorators\";\r\nimport type { Nullable } from \"../types\";\r\nimport type { Camera } from \"../Cameras/camera\";\r\nimport type { Scene } from \"../scene\";\r\nimport { Vector2 } from \"../Maths/math.vector\";\r\nimport { VertexBuffer } from \"../Buffers/buffer\";\r\nimport type { SubMesh } from \"../Meshes/subMesh\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport type { Mesh } from \"../Meshes/mesh\";\r\nimport { Texture } from \"../Materials/Textures/texture\";\r\nimport { RenderTargetTexture } from \"../Materials/Textures/renderTargetTexture\";\r\nimport type { Effect } from \"../Materials/effect\";\r\nimport { Material } from \"../Materials/material\";\r\nimport type { PostProcess } from \"../PostProcesses/postProcess\";\r\nimport { BlurPostProcess } from \"../PostProcesses/blurPostProcess\";\r\nimport { EffectLayer } from \"./effectLayer\";\r\nimport { AbstractScene } from \"../abstractScene\";\r\nimport { Constants } from \"../Engines/constants\";\r\nimport { RegisterClass } from \"../Misc/typeStore\";\r\nimport { Engine } from \"../Engines/engine\";\r\nimport { Color4 } from \"../Maths/math.color\";\r\nimport type { PBRMaterial } from \"../Materials/PBR/pbrMaterial\";\r\n\r\nimport \"../Shaders/glowMapMerge.fragment\";\r\nimport \"../Shaders/glowMapMerge.vertex\";\r\nimport \"../Layers/effectLayerSceneComponent\";\r\n\r\ndeclare module \"../abstractScene\" {\r\n export interface AbstractScene {\r\n /**\r\n * Return the first glow layer of the scene with a given name.\r\n * @param name The name of the glow layer to look for.\r\n * @returns The glow layer if found otherwise null.\r\n */\r\n getGlowLayerByName(name: string): Nullable<GlowLayer>;\r\n }\r\n}\r\n\r\nAbstractScene.prototype.getGlowLayerByName = function (name: string): Nullable<GlowLayer> {\r\n for (let index = 0; index < this.effectLayers?.length; index++) {\r\n if (this.effectLayers[index].name === name && this.effectLayers[index].getEffectName() === GlowLayer.EffectName) {\r\n return (<any>this.effectLayers[index]) as GlowLayer;\r\n }\r\n }\r\n\r\n return null;\r\n};\r\n\r\n/**\r\n * Glow layer options. This helps customizing the behaviour\r\n * of the glow layer.\r\n */\r\nexport interface IGlowLayerOptions {\r\n /**\r\n * Multiplication factor apply to the canvas size to compute the render target size\r\n * used to generated the glowing objects (the smaller the faster). Default: 0.5\r\n */\r\n mainTextureRatio: number;\r\n\r\n /**\r\n * Enforces a fixed size texture to ensure resize independent blur. Default: undefined\r\n */\r\n mainTextureFixedSize?: number;\r\n\r\n /**\r\n * How big is the kernel of the blur texture. Default: 32\r\n */\r\n blurKernelSize: number;\r\n\r\n /**\r\n * The camera attached to the layer. Default: null\r\n */\r\n camera: Nullable<Camera>;\r\n\r\n /**\r\n * Enable MSAA by choosing the number of samples. Default: 1\r\n */\r\n mainTextureSamples?: number;\r\n\r\n /**\r\n * The rendering group to draw the layer in. Default: -1\r\n */\r\n renderingGroupId: number;\r\n\r\n /**\r\n * Forces the merge step to be done in ldr (clamp values > 1). Default: false\r\n */\r\n ldrMerge?: boolean;\r\n\r\n /**\r\n * Defines the blend mode used by the merge. Default: ALPHA_ADD\r\n */\r\n alphaBlendingMode?: number;\r\n\r\n /**\r\n * The type of the main texture. Default: TEXTURETYPE_UNSIGNED_INT\r\n */\r\n mainTextureType: number;\r\n\r\n /**\r\n * Whether or not to generate a stencil buffer. Default: false\r\n */\r\n generateStencilBuffer: boolean;\r\n}\r\n\r\n/**\r\n * The glow layer Helps adding a glow effect around the emissive parts of a mesh.\r\n *\r\n * Once instantiated in a scene, by default, all the emissive meshes will glow.\r\n *\r\n * Documentation: https://doc.babylonjs.com/features/featuresDeepDive/mesh/glowLayer\r\n */\r\nexport class GlowLayer extends EffectLayer {\r\n /**\r\n * Effect Name of the layer.\r\n */\r\n public static readonly EffectName = \"GlowLayer\";\r\n\r\n /**\r\n * The default blur kernel size used for the glow.\r\n */\r\n public static DefaultBlurKernelSize = 32;\r\n\r\n /**\r\n * The default texture size ratio used for the glow.\r\n */\r\n public static DefaultTextureRatio = 0.5;\r\n\r\n /**\r\n * Sets the kernel size of the blur.\r\n */\r\n public set blurKernelSize(value: number) {\r\n if (value === this._options.blurKernelSize) {\r\n return;\r\n }\r\n\r\n this._options.blurKernelSize = value;\r\n\r\n const effectiveKernel = this._getEffectiveBlurKernelSize();\r\n this._horizontalBlurPostprocess1.kernel = effectiveKernel;\r\n this._verticalBlurPostprocess1.kernel = effectiveKernel;\r\n this._horizontalBlurPostprocess2.kernel = effectiveKernel;\r\n this._verticalBlurPostprocess2.kernel = effectiveKernel;\r\n }\r\n\r\n /**\r\n * Gets the kernel size of the blur.\r\n */\r\n @serialize()\r\n public get blurKernelSize(): number {\r\n return this._options.blurKernelSize;\r\n }\r\n\r\n /**\r\n * Sets the glow intensity.\r\n */\r\n public set intensity(value: number) {\r\n this._intensity = value;\r\n }\r\n\r\n /**\r\n * Gets the glow intensity.\r\n */\r\n @serialize()\r\n public get intensity(): number {\r\n return this._intensity;\r\n }\r\n\r\n @serialize(\"options\")\r\n private _options: IGlowLayerOptions;\r\n\r\n private _intensity: number = 1.0;\r\n private _horizontalBlurPostprocess1: BlurPostProcess;\r\n private _verticalBlurPostprocess1: BlurPostProcess;\r\n private _horizontalBlurPostprocess2: BlurPostProcess;\r\n private _verticalBlurPostprocess2: BlurPostProcess;\r\n private _blurTexture1: RenderTargetTexture;\r\n private _blurTexture2: RenderTargetTexture;\r\n private _postProcesses1: PostProcess[];\r\n private _postProcesses2: PostProcess[];\r\n\r\n private _includedOnlyMeshes: number[] = [];\r\n private _excludedMeshes: number[] = [];\r\n private _meshesUsingTheirOwnMaterials: number[] = [];\r\n\r\n /**\r\n * Callback used to let the user override the color selection on a per mesh basis\r\n */\r\n public customEmissiveColorSelector: (mesh: Mesh, subMesh: SubMesh, material: Material, result: Color4) => void;\r\n /**\r\n * Callback used to let the user override the texture selection on a per mesh basis\r\n */\r\n public customEmissiveTextureSelector: (mesh: Mesh, subMesh: SubMesh, material: Material) => Texture;\r\n\r\n /**\r\n * Instantiates a new glow Layer and references it to the scene.\r\n * @param name The name of the layer\r\n * @param scene The scene to use the layer in\r\n * @param options Sets of none mandatory options to use with the layer (see IGlowLayerOptions for more information)\r\n */\r\n constructor(name: string, scene?: Scene, options?: Partial<IGlowLayerOptions>) {\r\n super(name, scene);\r\n this.neutralColor = new Color4(0, 0, 0, 1);\r\n\r\n // Adapt options\r\n this._options = {\r\n mainTextureRatio: GlowLayer.DefaultTextureRatio,\r\n blurKernelSize: 32,\r\n mainTextureFixedSize: undefined,\r\n camera: null,\r\n mainTextureSamples: 1,\r\n renderingGroupId: -1,\r\n ldrMerge: false,\r\n alphaBlendingMode: Constants.ALPHA_ADD,\r\n mainTextureType: Constants.TEXTURETYPE_UNSIGNED_INT,\r\n generateStencilBuffer: false,\r\n ...options,\r\n };\r\n\r\n // Initialize the layer\r\n this._init({\r\n alphaBlendingMode: this._options.alphaBlendingMode,\r\n camera: this._options.camera,\r\n mainTextureFixedSize: this._options.mainTextureFixedSize,\r\n mainTextureRatio: this._options.mainTextureRatio,\r\n renderingGroupId: this._options.renderingGroupId,\r\n mainTextureType: this._options.mainTextureType,\r\n generateStencilBuffer: this._options.generateStencilBuffer,\r\n });\r\n }\r\n\r\n /**\r\n * Get the effect name of the layer.\r\n * @returns The effect name\r\n */\r\n public getEffectName(): string {\r\n return GlowLayer.EffectName;\r\n }\r\n\r\n /**\r\n * @internal\r\n * Create the merge effect. This is the shader use to blit the information back\r\n * to the main canvas at the end of the scene rendering.\r\n */\r\n protected _createMergeEffect(): Effect {\r\n let defines = \"#define EMISSIVE \\n\";\r\n if (this._options.ldrMerge) {\r\n defines += \"#define LDR \\n\";\r\n }\r\n\r\n // Effect\r\n return this._engine.createEffect(\"glowMapMerge\", [VertexBuffer.PositionKind], [\"offset\"], [\"textureSampler\", \"textureSampler2\"], defines);\r\n }\r\n\r\n /**\r\n * Creates the render target textures and post processes used in the glow layer.\r\n */\r\n protected _createTextureAndPostProcesses(): void {\r\n let blurTextureWidth = this._mainTextureDesiredSize.width;\r\n let blurTextureHeight = this._mainTextureDesiredSize.height;\r\n blurTextureWidth = this._engine.needPOTTextures ? Engine.GetExponentOfTwo(blurTextureWidth, this._maxSize) : blurTextureWidth;\r\n blurTextureHeight = this._engine.needPOTTextures ? Engine.GetExponentOfTwo(blurTextureHeight, this._maxSize) : blurTextureHeight;\r\n\r\n let textureType = 0;\r\n if (this._engine.getCaps().textureHalfFloatRender) {\r\n textureType = Constants.TEXTURETYPE_HALF_FLOAT;\r\n } else {\r\n textureType = Constants.TEXTURETYPE_UNSIGNED_INT;\r\n }\r\n\r\n this._blurTexture1 = new RenderTargetTexture(\r\n \"GlowLayerBlurRTT\",\r\n {\r\n width: blurTextureWidth,\r\n height: blurTextureHeight,\r\n },\r\n this._scene,\r\n false,\r\n true,\r\n textureType\r\n );\r\n this._blurTexture1.wrapU = Texture.CLAMP_ADDRESSMODE;\r\n this._blurTexture1.wrapV = Texture.CLAMP_ADDRESSMODE;\r\n this._blurTexture1.updateSamplingMode(Texture.BILINEAR_SAMPLINGMODE);\r\n this._blurTexture1.renderParticles = false;\r\n this._blurTexture1.ignoreCameraViewport = true;\r\n\r\n const blurTextureWidth2 = Math.floor(blurTextureWidth / 2);\r\n const blurTextureHeight2 = Math.floor(blurTextureHeight / 2);\r\n\r\n this._blurTexture2 = new RenderTargetTexture(\r\n \"GlowLayerBlurRTT2\",\r\n {\r\n width: blurTextureWidth2,\r\n height: blurTextureHeight2,\r\n },\r\n this._scene,\r\n false,\r\n true,\r\n textureType\r\n );\r\n this._blurTexture2.wrapU = Texture.CLAMP_ADDRESSMODE;\r\n this._blurTexture2.wrapV = Texture.CLAMP_ADDRESSMODE;\r\n this._blurTexture2.updateSamplingMode(Texture.BILINEAR_SAMPLINGMODE);\r\n this._blurTexture2.renderParticles = false;\r\n this._blurTexture2.ignoreCameraViewport = true;\r\n\r\n this._textures = [this._blurTexture1, this._blurTexture2];\r\n\r\n const effectiveKernel = this._getEffectiveBlurKernelSize();\r\n this._horizontalBlurPostprocess1 = new BlurPostProcess(\r\n \"GlowLayerHBP1\",\r\n new Vector2(1.0, 0),\r\n effectiveKernel,\r\n {\r\n width: blurTextureWidth,\r\n height: blurTextureHeight,\r\n },\r\n null,\r\n Texture.BILINEAR_SAMPLINGMODE,\r\n this._scene.getEngine(),\r\n false,\r\n textureType\r\n );\r\n this._horizontalBlurPostprocess1.width = blurTextureWidth;\r\n this._horizontalBlurPostprocess1.height = blurTextureHeight;\r\n this._horizontalBlurPostprocess1.externalTextureSamplerBinding = true;\r\n this._horizontalBlurPostprocess1.onApplyObservable.add((effect) => {\r\n effect.setTexture(\"textureSampler\", this._mainTexture);\r\n });\r\n\r\n this._verticalBlurPostprocess1 = new BlurPostProcess(\r\n \"GlowLayerVBP1\",\r\n new Vector2(0, 1.0),\r\n effectiveKernel,\r\n {\r\n width: blurTextureWidth,\r\n height: blurTextureHeight,\r\n },\r\n null,\r\n Texture.BILINEAR_SAMPLINGMODE,\r\n this._scene.getEngine(),\r\n false,\r\n textureType\r\n );\r\n\r\n this._horizontalBlurPostprocess2 = new BlurPostProcess(\r\n \"GlowLayerHBP2\",\r\n new Vector2(1.0, 0),\r\n effectiveKernel,\r\n {\r\n width: blurTextureWidth2,\r\n height: blurTextureHeight2,\r\n },\r\n null,\r\n Texture.BILINEAR_SAMPLINGMODE,\r\n this._scene.getEngine(),\r\n false,\r\n textureType\r\n );\r\n this._horizontalBlurPostprocess2.width = blurTextureWidth2;\r\n this._horizontalBlurPostprocess2.height = blurTextureHeight2;\r\n this._horizontalBlurPostprocess2.externalTextureSamplerBinding = true;\r\n this._horizontalBlurPostprocess2.onApplyObservable.add((effect) => {\r\n effect.setTexture(\"textureSampler\", this._blurTexture1);\r\n });\r\n\r\n this._verticalBlurPostprocess2 = new BlurPostProcess(\r\n \"GlowLayerVBP2\",\r\n new Vector2(0, 1.0),\r\n effectiveKernel,\r\n {\r\n width: blurTextureWidth2,\r\n height: blurTextureHeight2,\r\n },\r\n null,\r\n Texture.BILINEAR_SAMPLINGMODE,\r\n this._scene.getEngine(),\r\n false,\r\n textureType\r\n );\r\n\r\n this._postProcesses = [this._horizontalBlurPostprocess1, this._verticalBlurPostprocess1, this._horizontalBlurPostprocess2, this._verticalBlurPostprocess2];\r\n this._postProcesses1 = [this._horizontalBlurPostprocess1, this._verticalBlurPostprocess1];\r\n this._postProcesses2 = [this._horizontalBlurPostprocess2, this._verticalBlurPostprocess2];\r\n\r\n this._mainTexture.samples = this._options.mainTextureSamples!;\r\n this._mainTexture.onAfterUnbindObservable.add(() => {\r\n const internalTexture = this._blurTexture1.renderTarget;\r\n if (internalTexture) {\r\n this._scene.postProcessManager.directRender(this._postProcesses1, internalTexture, true);\r\n\r\n const internalTexture2 = this._blurTexture2.renderTarget;\r\n if (internalTexture2) {\r\n this._scene.postProcessManager.directRender(this._postProcesses2, internalTexture2, true);\r\n }\r\n this._engine.unBindFramebuffer(internalTexture2 ?? internalTexture, true);\r\n }\r\n });\r\n\r\n // Prevent autoClear.\r\n this._postProcesses.map((pp) => {\r\n pp.autoClear = false;\r\n });\r\n }\r\n\r\n /**\r\n * @returns The blur kernel size used by the glow.\r\n * Note: The value passed in the options is divided by 2 for back compatibility.\r\n */\r\n private _getEffectiveBlurKernelSize() {\r\n return this._options.blurKernelSize / 2;\r\n }\r\n\r\n /**\r\n * Checks for the readiness of the element composing the layer.\r\n * @param subMesh the mesh to check for\r\n * @param useInstances specify whether or not to use instances to render the mesh\r\n * @returns true if ready otherwise, false\r\n */\r\n public isReady(subMesh: SubMesh, useInstances: boolean): boolean {\r\n const material = subMesh.getMaterial();\r\n const mesh = subMesh.getRenderingMesh();\r\n\r\n if (!material || !mesh) {\r\n return false;\r\n }\r\n\r\n const emissiveTexture = (<any>material).emissiveTexture;\r\n return super._isReady(subMesh, useInstances, emissiveTexture);\r\n }\r\n\r\n /**\r\n * @returns whether or not the layer needs stencil enabled during the mesh rendering.\r\n */\r\n public needStencil(): boolean {\r\n return false;\r\n }\r\n\r\n /**\r\n * Returns true if the mesh can be rendered, otherwise false.\r\n * @param mesh The mesh to render\r\n * @param material The material used on the mesh\r\n * @returns true if it can be rendered otherwise false\r\n */\r\n protected _canRenderMesh(mesh: AbstractMesh, material: Material): boolean {\r\n return true;\r\n }\r\n\r\n /**\r\n * Implementation specific of rendering the generating effect on the main canvas.\r\n * @param effect The effect used to render through\r\n */\r\n protected _internalRender(effect: Effect): void {\r\n // Texture\r\n effect.setTexture(\"textureSampler\", this._blurTexture1);\r\n effect.setTexture(\"textureSampler2\", this._blurTexture2);\r\n effect.setFloat(\"offset\", this._intensity);\r\n\r\n // Cache\r\n const engine = this._engine;\r\n const previousStencilBuffer = engine.getStencilBuffer();\r\n\r\n // Draw order\r\n engine.setStencilBuffer(false);\r\n\r\n engine.drawElementsType(Material.TriangleFillMode, 0, 6);\r\n\r\n // Draw order\r\n engine.setStencilBuffer(previousStencilBuffer);\r\n }\r\n\r\n /**\r\n * Sets the required values for both the emissive texture and and the main color.\r\n * @param mesh\r\n * @param subMesh\r\n * @param material\r\n */\r\n protected _setEmissiveTextureAndColor(mesh: Mesh, subMesh: SubMesh, material: Material): void {\r\n let textureLevel = 1.0;\r\n\r\n if (this.customEmissiveTextureSelector) {\r\n this._emissiveTextureAndColor.texture = this.customEmissiveTextureSelector(mesh, subMesh, material);\r\n } else {\r\n if (material) {\r\n this._emissiveTextureAndColor.texture = (<any>material).emissiveTexture;\r\n if (this._emissiveTextureAndColor.texture) {\r\n textureLevel = this._emissiveTextureAndColor.texture.level;\r\n }\r\n } else {\r\n this._emissiveTextureAndColor.texture = null;\r\n }\r\n }\r\n\r\n if (this.customEmissiveColorSelector) {\r\n this.customEmissiveColorSelector(mesh, subMesh, material, this._emissiveTextureAndColor.color);\r\n } else {\r\n if ((<any>material).emissiveColor) {\r\n const emissiveIntensity = (<PBRMaterial>material).emissiveIntensity ?? 1;\r\n textureLevel *= emissiveIntensity;\r\n this._emissiveTextureAndColor.color.set(\r\n (<any>material).emissiveColor.r * textureLevel,\r\n (<any>material).emissiveColor.g * textureLevel,\r\n (<any>material).emissiveColor.b * textureLevel,\r\n material.alpha\r\n );\r\n } else {\r\n this._emissiveTextureAndColor.color.set(this.neutralColor.r, this.neutralColor.g, this.neutralColor.b, this.neutralColor.a);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Returns true if the mesh should render, otherwise false.\r\n * @param mesh The mesh to render\r\n * @returns true if it should render otherwise false\r\n */\r\n protected _shouldRenderMesh(mesh: Mesh): boolean {\r\n return this.hasMesh(mesh);\r\n }\r\n\r\n /**\r\n * Adds specific effects defines.\r\n * @param defines The defines to add specifics to.\r\n */\r\n protected _addCustomEffectDefines(defines: string[]): void {\r\n defines.push(\"#define GLOW\");\r\n }\r\n\r\n /**\r\n * Add a mesh in the exclusion list to prevent it to impact or being impacted by the glow layer.\r\n * @param mesh The mesh to exclude from the glow layer\r\n */\r\n public addExcludedMesh(mesh: Mesh): void {\r\n if (this._excludedMeshes.indexOf(mesh.uniqueId) === -1) {\r\n this._excludedMeshes.push(mesh.uniqueId);\r\n }\r\n }\r\n\r\n /**\r\n * Remove a mesh from the exclusion list to let it impact or being impacted by the glow layer.\r\n * @param mesh The mesh to remove\r\n */\r\n public removeExcludedMesh(mesh: Mesh): void {\r\n const index = this._excludedMeshes.indexOf(mesh.uniqueId);\r\n if (index !== -1) {\r\n this._excludedMeshes.splice(index, 1);\r\n }\r\n }\r\n\r\n /**\r\n * Add a mesh in the inclusion list to impact or being impacted by the glow layer.\r\n * @param mesh The mesh to include in the glow layer\r\n */\r\n public addIncludedOnlyMesh(mesh: Mesh): void {\r\n if (this._includedOnlyMeshes.indexOf(mesh.uniqueId) === -1) {\r\n this._includedOnlyMeshes.push(mesh.uniqueId);\r\n }\r\n }\r\n\r\n /**\r\n * Remove a mesh from the Inclusion list to prevent it to impact or being impacted by the glow layer.\r\n * @param mesh The mesh to remove\r\n */\r\n public removeIncludedOnlyMesh(mesh: Mesh): void {\r\n const index = this._includedOnlyMeshes.indexOf(mesh.uniqueId);\r\n if (index !== -1) {\r\n this._includedOnlyMeshes.splice(index, 1);\r\n }\r\n }\r\n\r\n /**\r\n * Determine if a given mesh will be used in the glow layer\r\n * @param mesh The mesh to test\r\n * @returns true if the mesh will be highlighted by the current glow layer\r\n */\r\n public hasMesh(mesh: AbstractMesh): boolean {\r\n if (!super.hasMesh(mesh)) {\r\n return false;\r\n }\r\n\r\n // Included Mesh\r\n if (this._includedOnlyMeshes.length) {\r\n return this._includedOnlyMeshes.indexOf(mesh.uniqueId) !== -1;\r\n }\r\n\r\n // Excluded Mesh\r\n if (this._excludedMeshes.length) {\r\n return this._excludedMeshes.indexOf(mesh.uniqueId) === -1;\r\n }\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * Defines whether the current material of the mesh should be use to render the effect.\r\n * @param mesh defines the current mesh to render\r\n * @returns true if the material of the mesh should be use to render the effect\r\n */\r\n protected _useMeshMaterial(mesh: AbstractMesh): boolean {\r\n if (this._meshesUsingTheirOwnMaterials.length == 0) {\r\n return false;\r\n }\r\n return this._meshesUsingTheirOwnMaterials.indexOf(mesh.uniqueId) > -1;\r\n }\r\n\r\n /**\r\n * Add a mesh to be rendered through its own material and not with emissive only.\r\n * @param mesh The mesh for which we need to use its material\r\n */\r\n public referenceMeshToUseItsOwnMaterial(mesh: AbstractMesh): void {\r\n mesh.resetDrawCache(this._mainTexture.renderPassId);\r\n\r\n this._meshesUsingTheirOwnMaterials.push(mesh.uniqueId);\r\n\r\n mesh.onDisposeObservable.add(() => {\r\n this._disposeMesh(mesh as Mesh);\r\n });\r\n }\r\n\r\n /**\r\n * Remove a mesh from being rendered through its own material and not with emissive only.\r\n * @param mesh The mesh for which we need to not use its material\r\n */\r\n public unReferenceMeshFromUsingItsOwnMaterial(mesh: AbstractMesh): void {\r\n let index = this._meshesUsingTheirOwnMaterials.indexOf(mesh.uniqueId);\r\n while (index >= 0) {\r\n this._meshesUsingTheirOwnMaterials.splice(index, 1);\r\n index = this._meshesUsingTheirOwnMaterials.indexOf(mesh.uniqueId);\r\n }\r\n mesh.resetDrawCache(this._mainTexture.renderPassId);\r\n }\r\n\r\n /**\r\n * Free any resources and references associated to a mesh.\r\n * Internal use\r\n * @param mesh The mesh to free.\r\n * @internal\r\n */\r\n public _disposeMesh(mesh: Mesh): void {\r\n this.removeIncludedOnlyMesh(mesh);\r\n this.removeExcludedMesh(mesh);\r\n }\r\n\r\n /**\r\n * Gets the class name of the effect layer\r\n * @returns the string with the class name of the effect layer\r\n */\r\n public getClassName(): string {\r\n return \"GlowLayer\";\r\n }\r\n\r\n /**\r\n * Serializes this glow layer\r\n * @returns a serialized glow layer object\r\n */\r\n public serialize(): any {\r\n const serializationObject = SerializationHelper.Serialize(this);\r\n serializationObject.customType = \"BABYLON.GlowLayer\";\r\n\r\n let index;\r\n\r\n // Included meshes\r\n serializationObject.includedMeshes = [];\r\n\r\n if (this._includedOnlyMeshes.length) {\r\n for (index = 0; index < this._includedOnlyMeshes.length; index++) {\r\n const mesh = this._scene.getMeshByUniqueId(this._includedOnlyMeshes[index]);\r\n if (mesh) {\r\n serializationObject.includedMeshes.push(mesh.id);\r\n }\r\n }\r\n }\r\n\r\n // Excluded meshes\r\n serializationObject.excludedMeshes = [];\r\n\r\n if (this._excludedMeshes.length) {\r\n for (index = 0; index < this._excludedMeshes.length; index++) {\r\n const mesh = this._scene.getMeshByUniqueId(this._excludedMeshes[index]);\r\n if (mesh) {\r\n serializationObject.excludedMeshes.push(mesh.id);\r\n }\r\n }\r\n }\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Creates a Glow Layer from parsed glow layer data\r\n * @param parsedGlowLayer defines glow layer data\r\n * @param scene defines the current scene\r\n * @param rootUrl defines the root URL containing the glow layer information\r\n * @returns a parsed Glow Layer\r\n */\r\n public static Parse(parsedGlowLayer: any, scene: Scene, rootUrl: string): GlowLayer {\r\n const gl = SerializationHelper.Parse(() => new GlowLayer(parsedGlowLayer.name, scene, parsedGlowLayer.options), parsedGlowLayer, scene, rootUrl);\r\n let index;\r\n\r\n // Excluded meshes\r\n for (index = 0; index < parsedGlowLayer.excludedMeshes.length; index++) {\r\n const mesh = scene.getMeshById(parsedGlowLayer.excludedMeshes[index]);\r\n if (mesh) {\r\n gl.addExcludedMesh(<Mesh>mesh);\r\n }\r\n }\r\n\r\n // Included meshes\r\n for (index = 0; index < parsedGlowLayer.includedMeshes.length; index++) {\r\n const mesh = scene.getMeshById(parsedGlowLayer.includedMeshes[index]);\r\n if (mesh) {\r\n gl.addIncludedOnlyMesh(<Mesh>mesh);\r\n }\r\n }\r\n\r\n return gl;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GlowLayer\", GlowLayer);\r\n"]}
|
|
1
|
+
{"version":3,"file":"glowLayer.js","sourceRoot":"","sources":["../../../../dev/core/src/Layers/glowLayer.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAI/C,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAs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AM,IAAI,GAAG,KAAK,CAAC,WAAW,CAAC,eAAe,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC;YACtE,IAAI,IAAI,EAAE;gBACN,EAAE,CAAC,mBAAmB,CAAO,IAAI,CAAC,CAAC;aACtC;SACJ;QAED,OAAO,EAAE,CAAC;IACd,CAAC;;AA5lBD;;GAEG;AACoB,oBAAU,GAAG,WAAW,AAAd,CAAe;AAEhD;;GAEG;AACW,+BAAqB,GAAG,EAAE,AAAL,CAAM;AAEzC;;GAEG;AACW,6BAAmB,GAAG,GAAG,AAAN,CAAO;AAuBxC;IADC,SAAS,EAAE;+CAGX;AAaD;IADC,SAAS,EAAE;0CAGX;AAGO;IADP,SAAS,CAAC,SAAS,CAAC;2CACe;AAuiBxC,aAAa,CAAC,mBAAmB,EAAE,SAAS,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\r\nimport { serialize } from \"../Misc/decorators\";\r\nimport type { Nullable } from \"../types\";\r\nimport type { Camera } from \"../Cameras/camera\";\r\nimport type { Scene } from \"../scene\";\r\nimport { Vector2 } from \"../Maths/math.vector\";\r\nimport { VertexBuffer } from \"../Buffers/buffer\";\r\nimport type { SubMesh } from \"../Meshes/subMesh\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport type { Mesh } from \"../Meshes/mesh\";\r\nimport { Texture } from \"../Materials/Textures/texture\";\r\nimport { RenderTargetTexture } from \"../Materials/Textures/renderTargetTexture\";\r\nimport type { Effect } from \"../Materials/effect\";\r\nimport { Material } from \"../Materials/material\";\r\nimport type { PostProcess } from \"../PostProcesses/postProcess\";\r\nimport { BlurPostProcess } from \"../PostProcesses/blurPostProcess\";\r\nimport { EffectLayer } from \"./effectLayer\";\r\nimport { AbstractScene } from \"../abstractScene\";\r\nimport { Constants } from \"../Engines/constants\";\r\nimport { RegisterClass } from \"../Misc/typeStore\";\r\nimport { Engine } from \"../Engines/engine\";\r\nimport { Color4 } from \"../Maths/math.color\";\r\nimport type { PBRMaterial } from \"../Materials/PBR/pbrMaterial\";\r\n\r\nimport \"../Shaders/glowMapMerge.fragment\";\r\nimport \"../Shaders/glowMapMerge.vertex\";\r\nimport \"../Layers/effectLayerSceneComponent\";\r\nimport { SerializationHelper } from \"../Misc/decorators.serialization\";\r\n\r\ndeclare module \"../abstractScene\" {\r\n export interface AbstractScene {\r\n /**\r\n * Return the first glow layer of the scene with a given name.\r\n * @param name The name of the glow layer to look for.\r\n * @returns The glow layer if found otherwise null.\r\n */\r\n getGlowLayerByName(name: string): Nullable<GlowLayer>;\r\n }\r\n}\r\n\r\nAbstractScene.prototype.getGlowLayerByName = function (name: string): Nullable<GlowLayer> {\r\n for (let index = 0; index < this.effectLayers?.length; index++) {\r\n if (this.effectLayers[index].name === name && this.effectLayers[index].getEffectName() === GlowLayer.EffectName) {\r\n return (<any>this.effectLayers[index]) as GlowLayer;\r\n }\r\n }\r\n\r\n return null;\r\n};\r\n\r\n/**\r\n * Glow layer options. This helps customizing the behaviour\r\n * of the glow layer.\r\n */\r\nexport interface IGlowLayerOptions {\r\n /**\r\n * Multiplication factor apply to the canvas size to compute the render target size\r\n * used to generated the glowing objects (the smaller the faster). Default: 0.5\r\n */\r\n mainTextureRatio: number;\r\n\r\n /**\r\n * Enforces a fixed size texture to ensure resize independent blur. Default: undefined\r\n */\r\n mainTextureFixedSize?: number;\r\n\r\n /**\r\n * How big is the kernel of the blur texture. Default: 32\r\n */\r\n blurKernelSize: number;\r\n\r\n /**\r\n * The camera attached to the layer. Default: null\r\n */\r\n camera: Nullable<Camera>;\r\n\r\n /**\r\n * Enable MSAA by choosing the number of samples. Default: 1\r\n */\r\n mainTextureSamples?: number;\r\n\r\n /**\r\n * The rendering group to draw the layer in. Default: -1\r\n */\r\n renderingGroupId: number;\r\n\r\n /**\r\n * Forces the merge step to be done in ldr (clamp values > 1). Default: false\r\n */\r\n ldrMerge?: boolean;\r\n\r\n /**\r\n * Defines the blend mode used by the merge. Default: ALPHA_ADD\r\n */\r\n alphaBlendingMode?: number;\r\n\r\n /**\r\n * The type of the main texture. Default: TEXTURETYPE_UNSIGNED_INT\r\n */\r\n mainTextureType: number;\r\n\r\n /**\r\n * Whether or not to generate a stencil buffer. Default: false\r\n */\r\n generateStencilBuffer: boolean;\r\n}\r\n\r\n/**\r\n * The glow layer Helps adding a glow effect around the emissive parts of a mesh.\r\n *\r\n * Once instantiated in a scene, by default, all the emissive meshes will glow.\r\n *\r\n * Documentation: https://doc.babylonjs.com/features/featuresDeepDive/mesh/glowLayer\r\n */\r\nexport class GlowLayer extends EffectLayer {\r\n /**\r\n * Effect Name of the layer.\r\n */\r\n public static readonly EffectName = \"GlowLayer\";\r\n\r\n /**\r\n * The default blur kernel size used for the glow.\r\n */\r\n public static DefaultBlurKernelSize = 32;\r\n\r\n /**\r\n * The default texture size ratio used for the glow.\r\n */\r\n public static DefaultTextureRatio = 0.5;\r\n\r\n /**\r\n * Sets the kernel size of the blur.\r\n */\r\n public set blurKernelSize(value: number) {\r\n if (value === this._options.blurKernelSize) {\r\n return;\r\n }\r\n\r\n this._options.blurKernelSize = value;\r\n\r\n const effectiveKernel = this._getEffectiveBlurKernelSize();\r\n this._horizontalBlurPostprocess1.kernel = effectiveKernel;\r\n this._verticalBlurPostprocess1.kernel = effectiveKernel;\r\n this._horizontalBlurPostprocess2.kernel = effectiveKernel;\r\n this._verticalBlurPostprocess2.kernel = effectiveKernel;\r\n }\r\n\r\n /**\r\n * Gets the kernel size of the blur.\r\n */\r\n @serialize()\r\n public get blurKernelSize(): number {\r\n return this._options.blurKernelSize;\r\n }\r\n\r\n /**\r\n * Sets the glow intensity.\r\n */\r\n public set intensity(value: number) {\r\n this._intensity = value;\r\n }\r\n\r\n /**\r\n * Gets the glow intensity.\r\n */\r\n @serialize()\r\n public get intensity(): number {\r\n return this._intensity;\r\n }\r\n\r\n @serialize(\"options\")\r\n private _options: IGlowLayerOptions;\r\n\r\n private _intensity: number = 1.0;\r\n private _horizontalBlurPostprocess1: BlurPostProcess;\r\n private _verticalBlurPostprocess1: BlurPostProcess;\r\n private _horizontalBlurPostprocess2: BlurPostProcess;\r\n private _verticalBlurPostprocess2: BlurPostProcess;\r\n private _blurTexture1: RenderTargetTexture;\r\n private _blurTexture2: RenderTargetTexture;\r\n private _postProcesses1: PostProcess[];\r\n private _postProcesses2: PostProcess[];\r\n\r\n private _includedOnlyMeshes: number[] = [];\r\n private _excludedMeshes: number[] = [];\r\n private _meshesUsingTheirOwnMaterials: number[] = [];\r\n\r\n /**\r\n * Callback used to let the user override the color selection on a per mesh basis\r\n */\r\n public customEmissiveColorSelector: (mesh: Mesh, subMesh: SubMesh, material: Material, result: Color4) => void;\r\n /**\r\n * Callback used to let the user override the texture selection on a per mesh basis\r\n */\r\n public customEmissiveTextureSelector: (mesh: Mesh, subMesh: SubMesh, material: Material) => Texture;\r\n\r\n /**\r\n * Instantiates a new glow Layer and references it to the scene.\r\n * @param name The name of the layer\r\n * @param scene The scene to use the layer in\r\n * @param options Sets of none mandatory options to use with the layer (see IGlowLayerOptions for more information)\r\n */\r\n constructor(name: string, scene?: Scene, options?: Partial<IGlowLayerOptions>) {\r\n super(name, scene);\r\n this.neutralColor = new Color4(0, 0, 0, 1);\r\n\r\n // Adapt options\r\n this._options = {\r\n mainTextureRatio: GlowLayer.DefaultTextureRatio,\r\n blurKernelSize: 32,\r\n mainTextureFixedSize: undefined,\r\n camera: null,\r\n mainTextureSamples: 1,\r\n renderingGroupId: -1,\r\n ldrMerge: false,\r\n alphaBlendingMode: Constants.ALPHA_ADD,\r\n mainTextureType: Constants.TEXTURETYPE_UNSIGNED_INT,\r\n generateStencilBuffer: false,\r\n ...options,\r\n };\r\n\r\n // Initialize the layer\r\n this._init({\r\n alphaBlendingMode: this._options.alphaBlendingMode,\r\n camera: this._options.camera,\r\n mainTextureFixedSize: this._options.mainTextureFixedSize,\r\n mainTextureRatio: this._options.mainTextureRatio,\r\n renderingGroupId: this._options.renderingGroupId,\r\n mainTextureType: this._options.mainTextureType,\r\n generateStencilBuffer: this._options.generateStencilBuffer,\r\n });\r\n }\r\n\r\n /**\r\n * Get the effect name of the layer.\r\n * @returns The effect name\r\n */\r\n public getEffectName(): string {\r\n return GlowLayer.EffectName;\r\n }\r\n\r\n /**\r\n * @internal\r\n * Create the merge effect. This is the shader use to blit the information back\r\n * to the main canvas at the end of the scene rendering.\r\n */\r\n protected _createMergeEffect(): Effect {\r\n let defines = \"#define EMISSIVE \\n\";\r\n if (this._options.ldrMerge) {\r\n defines += \"#define LDR \\n\";\r\n }\r\n\r\n // Effect\r\n return this._engine.createEffect(\"glowMapMerge\", [VertexBuffer.PositionKind], [\"offset\"], [\"textureSampler\", \"textureSampler2\"], defines);\r\n }\r\n\r\n /**\r\n * Creates the render target textures and post processes used in the glow layer.\r\n */\r\n protected _createTextureAndPostProcesses(): void {\r\n let blurTextureWidth = this._mainTextureDesiredSize.width;\r\n let blurTextureHeight = this._mainTextureDesiredSize.height;\r\n blurTextureWidth = this._engine.needPOTTextures ? Engine.GetExponentOfTwo(blurTextureWidth, this._maxSize) : blurTextureWidth;\r\n blurTextureHeight = this._engine.needPOTTextures ? Engine.GetExponentOfTwo(blurTextureHeight, this._maxSize) : blurTextureHeight;\r\n\r\n let textureType = 0;\r\n if (this._engine.getCaps().textureHalfFloatRender) {\r\n textureType = Constants.TEXTURETYPE_HALF_FLOAT;\r\n } else {\r\n textureType = Constants.TEXTURETYPE_UNSIGNED_INT;\r\n }\r\n\r\n this._blurTexture1 = new RenderTargetTexture(\r\n \"GlowLayerBlurRTT\",\r\n {\r\n width: blurTextureWidth,\r\n height: blurTextureHeight,\r\n },\r\n this._scene,\r\n false,\r\n true,\r\n textureType\r\n );\r\n this._blurTexture1.wrapU = Texture.CLAMP_ADDRESSMODE;\r\n this._blurTexture1.wrapV = Texture.CLAMP_ADDRESSMODE;\r\n this._blurTexture1.updateSamplingMode(Texture.BILINEAR_SAMPLINGMODE);\r\n this._blurTexture1.renderParticles = false;\r\n this._blurTexture1.ignoreCameraViewport = true;\r\n\r\n const blurTextureWidth2 = Math.floor(blurTextureWidth / 2);\r\n const blurTextureHeight2 = Math.floor(blurTextureHeight / 2);\r\n\r\n this._blurTexture2 = new RenderTargetTexture(\r\n \"GlowLayerBlurRTT2\",\r\n {\r\n width: blurTextureWidth2,\r\n height: blurTextureHeight2,\r\n },\r\n this._scene,\r\n false,\r\n true,\r\n textureType\r\n );\r\n this._blurTexture2.wrapU = Texture.CLAMP_ADDRESSMODE;\r\n this._blurTexture2.wrapV = Texture.CLAMP_ADDRESSMODE;\r\n this._blurTexture2.updateSamplingMode(Texture.BILINEAR_SAMPLINGMODE);\r\n this._blurTexture2.renderParticles = false;\r\n this._blurTexture2.ignoreCameraViewport = true;\r\n\r\n this._textures = [this._blurTexture1, this._blurTexture2];\r\n\r\n const effectiveKernel = this._getEffectiveBlurKernelSize();\r\n this._horizontalBlurPostprocess1 = new BlurPostProcess(\r\n \"GlowLayerHBP1\",\r\n new Vector2(1.0, 0),\r\n effectiveKernel,\r\n {\r\n width: blurTextureWidth,\r\n height: blurTextureHeight,\r\n },\r\n null,\r\n Texture.BILINEAR_SAMPLINGMODE,\r\n this._scene.getEngine(),\r\n false,\r\n textureType\r\n );\r\n this._horizontalBlurPostprocess1.width = blurTextureWidth;\r\n this._horizontalBlurPostprocess1.height = blurTextureHeight;\r\n this._horizontalBlurPostprocess1.externalTextureSamplerBinding = true;\r\n this._horizontalBlurPostprocess1.onApplyObservable.add((effect) => {\r\n effect.setTexture(\"textureSampler\", this._mainTexture);\r\n });\r\n\r\n this._verticalBlurPostprocess1 = new BlurPostProcess(\r\n \"GlowLayerVBP1\",\r\n new Vector2(0, 1.0),\r\n effectiveKernel,\r\n {\r\n width: blurTextureWidth,\r\n height: blurTextureHeight,\r\n },\r\n null,\r\n Texture.BILINEAR_SAMPLINGMODE,\r\n this._scene.getEngine(),\r\n false,\r\n textureType\r\n );\r\n\r\n this._horizontalBlurPostprocess2 = new BlurPostProcess(\r\n \"GlowLayerHBP2\",\r\n new Vector2(1.0, 0),\r\n effectiveKernel,\r\n {\r\n width: blurTextureWidth2,\r\n height: blurTextureHeight2,\r\n },\r\n null,\r\n Texture.BILINEAR_SAMPLINGMODE,\r\n this._scene.getEngine(),\r\n false,\r\n textureType\r\n );\r\n this._horizontalBlurPostprocess2.width = blurTextureWidth2;\r\n this._horizontalBlurPostprocess2.height = blurTextureHeight2;\r\n this._horizontalBlurPostprocess2.externalTextureSamplerBinding = true;\r\n this._horizontalBlurPostprocess2.onApplyObservable.add((effect) => {\r\n effect.setTexture(\"textureSampler\", this._blurTexture1);\r\n });\r\n\r\n this._verticalBlurPostprocess2 = new BlurPostProcess(\r\n \"GlowLayerVBP2\",\r\n new Vector2(0, 1.0),\r\n effectiveKernel,\r\n {\r\n width: blurTextureWidth2,\r\n height: blurTextureHeight2,\r\n },\r\n null,\r\n Texture.BILINEAR_SAMPLINGMODE,\r\n this._scene.getEngine(),\r\n false,\r\n textureType\r\n );\r\n\r\n this._postProcesses = [this._horizontalBlurPostprocess1, this._verticalBlurPostprocess1, this._horizontalBlurPostprocess2, this._verticalBlurPostprocess2];\r\n this._postProcesses1 = [this._horizontalBlurPostprocess1, this._verticalBlurPostprocess1];\r\n this._postProcesses2 = [this._horizontalBlurPostprocess2, this._verticalBlurPostprocess2];\r\n\r\n this._mainTexture.samples = this._options.mainTextureSamples!;\r\n this._mainTexture.onAfterUnbindObservable.add(() => {\r\n const internalTexture = this._blurTexture1.renderTarget;\r\n if (internalTexture) {\r\n this._scene.postProcessManager.directRender(this._postProcesses1, internalTexture, true);\r\n\r\n const internalTexture2 = this._blurTexture2.renderTarget;\r\n if (internalTexture2) {\r\n this._scene.postProcessManager.directRender(this._postProcesses2, internalTexture2, true);\r\n }\r\n this._engine.unBindFramebuffer(internalTexture2 ?? internalTexture, true);\r\n }\r\n });\r\n\r\n // Prevent autoClear.\r\n this._postProcesses.map((pp) => {\r\n pp.autoClear = false;\r\n });\r\n }\r\n\r\n /**\r\n * @returns The blur kernel size used by the glow.\r\n * Note: The value passed in the options is divided by 2 for back compatibility.\r\n */\r\n private _getEffectiveBlurKernelSize() {\r\n return this._options.blurKernelSize / 2;\r\n }\r\n\r\n /**\r\n * Checks for the readiness of the element composing the layer.\r\n * @param subMesh the mesh to check for\r\n * @param useInstances specify whether or not to use instances to render the mesh\r\n * @returns true if ready otherwise, false\r\n */\r\n public isReady(subMesh: SubMesh, useInstances: boolean): boolean {\r\n const material = subMesh.getMaterial();\r\n const mesh = subMesh.getRenderingMesh();\r\n\r\n if (!material || !mesh) {\r\n return false;\r\n }\r\n\r\n const emissiveTexture = (<any>material).emissiveTexture;\r\n return super._isReady(subMesh, useInstances, emissiveTexture);\r\n }\r\n\r\n /**\r\n * @returns whether or not the layer needs stencil enabled during the mesh rendering.\r\n */\r\n public needStencil(): boolean {\r\n return false;\r\n }\r\n\r\n /**\r\n * Returns true if the mesh can be rendered, otherwise false.\r\n * @param mesh The mesh to render\r\n * @param material The material used on the mesh\r\n * @returns true if it can be rendered otherwise false\r\n */\r\n protected _canRenderMesh(mesh: AbstractMesh, material: Material): boolean {\r\n return true;\r\n }\r\n\r\n /**\r\n * Implementation specific of rendering the generating effect on the main canvas.\r\n * @param effect The effect used to render through\r\n */\r\n protected _internalRender(effect: Effect): void {\r\n // Texture\r\n effect.setTexture(\"textureSampler\", this._blurTexture1);\r\n effect.setTexture(\"textureSampler2\", this._blurTexture2);\r\n effect.setFloat(\"offset\", this._intensity);\r\n\r\n // Cache\r\n const engine = this._engine;\r\n const previousStencilBuffer = engine.getStencilBuffer();\r\n\r\n // Draw order\r\n engine.setStencilBuffer(false);\r\n\r\n engine.drawElementsType(Material.TriangleFillMode, 0, 6);\r\n\r\n // Draw order\r\n engine.setStencilBuffer(previousStencilBuffer);\r\n }\r\n\r\n /**\r\n * Sets the required values for both the emissive texture and and the main color.\r\n * @param mesh\r\n * @param subMesh\r\n * @param material\r\n */\r\n protected _setEmissiveTextureAndColor(mesh: Mesh, subMesh: SubMesh, material: Material): void {\r\n let textureLevel = 1.0;\r\n\r\n if (this.customEmissiveTextureSelector) {\r\n this._emissiveTextureAndColor.texture = this.customEmissiveTextureSelector(mesh, subMesh, material);\r\n } else {\r\n if (material) {\r\n this._emissiveTextureAndColor.texture = (<any>material).emissiveTexture;\r\n if (this._emissiveTextureAndColor.texture) {\r\n textureLevel = this._emissiveTextureAndColor.texture.level;\r\n }\r\n } else {\r\n this._emissiveTextureAndColor.texture = null;\r\n }\r\n }\r\n\r\n if (this.customEmissiveColorSelector) {\r\n this.customEmissiveColorSelector(mesh, subMesh, material, this._emissiveTextureAndColor.color);\r\n } else {\r\n if ((<any>material).emissiveColor) {\r\n const emissiveIntensity = (<PBRMaterial>material).emissiveIntensity ?? 1;\r\n textureLevel *= emissiveIntensity;\r\n this._emissiveTextureAndColor.color.set(\r\n (<any>material).emissiveColor.r * textureLevel,\r\n (<any>material).emissiveColor.g * textureLevel,\r\n (<any>material).emissiveColor.b * textureLevel,\r\n material.alpha\r\n );\r\n } else {\r\n this._emissiveTextureAndColor.color.set(this.neutralColor.r, this.neutralColor.g, this.neutralColor.b, this.neutralColor.a);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Returns true if the mesh should render, otherwise false.\r\n * @param mesh The mesh to render\r\n * @returns true if it should render otherwise false\r\n */\r\n protected _shouldRenderMesh(mesh: Mesh): boolean {\r\n return this.hasMesh(mesh);\r\n }\r\n\r\n /**\r\n * Adds specific effects defines.\r\n * @param defines The defines to add specifics to.\r\n */\r\n protected _addCustomEffectDefines(defines: string[]): void {\r\n defines.push(\"#define GLOW\");\r\n }\r\n\r\n /**\r\n * Add a mesh in the exclusion list to prevent it to impact or being impacted by the glow layer.\r\n * @param mesh The mesh to exclude from the glow layer\r\n */\r\n public addExcludedMesh(mesh: Mesh): void {\r\n if (this._excludedMeshes.indexOf(mesh.uniqueId) === -1) {\r\n this._excludedMeshes.push(mesh.uniqueId);\r\n }\r\n }\r\n\r\n /**\r\n * Remove a mesh from the exclusion list to let it impact or being impacted by the glow layer.\r\n * @param mesh The mesh to remove\r\n */\r\n public removeExcludedMesh(mesh: Mesh): void {\r\n const index = this._excludedMeshes.indexOf(mesh.uniqueId);\r\n if (index !== -1) {\r\n this._excludedMeshes.splice(index, 1);\r\n }\r\n }\r\n\r\n /**\r\n * Add a mesh in the inclusion list to impact or being impacted by the glow layer.\r\n * @param mesh The mesh to include in the glow layer\r\n */\r\n public addIncludedOnlyMesh(mesh: Mesh): void {\r\n if (this._includedOnlyMeshes.indexOf(mesh.uniqueId) === -1) {\r\n this._includedOnlyMeshes.push(mesh.uniqueId);\r\n }\r\n }\r\n\r\n /**\r\n * Remove a mesh from the Inclusion list to prevent it to impact or being impacted by the glow layer.\r\n * @param mesh The mesh to remove\r\n */\r\n public removeIncludedOnlyMesh(mesh: Mesh): void {\r\n const index = this._includedOnlyMeshes.indexOf(mesh.uniqueId);\r\n if (index !== -1) {\r\n this._includedOnlyMeshes.splice(index, 1);\r\n }\r\n }\r\n\r\n /**\r\n * Determine if a given mesh will be used in the glow layer\r\n * @param mesh The mesh to test\r\n * @returns true if the mesh will be highlighted by the current glow layer\r\n */\r\n public hasMesh(mesh: AbstractMesh): boolean {\r\n if (!super.hasMesh(mesh)) {\r\n return false;\r\n }\r\n\r\n // Included Mesh\r\n if (this._includedOnlyMeshes.length) {\r\n return this._includedOnlyMeshes.indexOf(mesh.uniqueId) !== -1;\r\n }\r\n\r\n // Excluded Mesh\r\n if (this._excludedMeshes.length) {\r\n return this._excludedMeshes.indexOf(mesh.uniqueId) === -1;\r\n }\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * Defines whether the current material of the mesh should be use to render the effect.\r\n * @param mesh defines the current mesh to render\r\n * @returns true if the material of the mesh should be use to render the effect\r\n */\r\n protected _useMeshMaterial(mesh: AbstractMesh): boolean {\r\n if (this._meshesUsingTheirOwnMaterials.length == 0) {\r\n return false;\r\n }\r\n return this._meshesUsingTheirOwnMaterials.indexOf(mesh.uniqueId) > -1;\r\n }\r\n\r\n /**\r\n * Add a mesh to be rendered through its own material and not with emissive only.\r\n * @param mesh The mesh for which we need to use its material\r\n */\r\n public referenceMeshToUseItsOwnMaterial(mesh: AbstractMesh): void {\r\n mesh.resetDrawCache(this._mainTexture.renderPassId);\r\n\r\n this._meshesUsingTheirOwnMaterials.push(mesh.uniqueId);\r\n\r\n mesh.onDisposeObservable.add(() => {\r\n this._disposeMesh(mesh as Mesh);\r\n });\r\n }\r\n\r\n /**\r\n * Remove a mesh from being rendered through its own material and not with emissive only.\r\n * @param mesh The mesh for which we need to not use its material\r\n */\r\n public unReferenceMeshFromUsingItsOwnMaterial(mesh: AbstractMesh): void {\r\n let index = this._meshesUsingTheirOwnMaterials.indexOf(mesh.uniqueId);\r\n while (index >= 0) {\r\n this._meshesUsingTheirOwnMaterials.splice(index, 1);\r\n index = this._meshesUsingTheirOwnMaterials.indexOf(mesh.uniqueId);\r\n }\r\n mesh.resetDrawCache(this._mainTexture.renderPassId);\r\n }\r\n\r\n /**\r\n * Free any resources and references associated to a mesh.\r\n * Internal use\r\n * @param mesh The mesh to free.\r\n * @internal\r\n */\r\n public _disposeMesh(mesh: Mesh): void {\r\n this.removeIncludedOnlyMesh(mesh);\r\n this.removeExcludedMesh(mesh);\r\n }\r\n\r\n /**\r\n * Gets the class name of the effect layer\r\n * @returns the string with the class name of the effect layer\r\n */\r\n public getClassName(): string {\r\n return \"GlowLayer\";\r\n }\r\n\r\n /**\r\n * Serializes this glow layer\r\n * @returns a serialized glow layer object\r\n */\r\n public serialize(): any {\r\n const serializationObject = SerializationHelper.Serialize(this);\r\n serializationObject.customType = \"BABYLON.GlowLayer\";\r\n\r\n let index;\r\n\r\n // Included meshes\r\n serializationObject.includedMeshes = [];\r\n\r\n if (this._includedOnlyMeshes.length) {\r\n for (index = 0; index < this._includedOnlyMeshes.length; index++) {\r\n const mesh = this._scene.getMeshByUniqueId(this._includedOnlyMeshes[index]);\r\n if (mesh) {\r\n serializationObject.includedMeshes.push(mesh.id);\r\n }\r\n }\r\n }\r\n\r\n // Excluded meshes\r\n serializationObject.excludedMeshes = [];\r\n\r\n if (this._excludedMeshes.length) {\r\n for (index = 0; index < this._excludedMeshes.length; index++) {\r\n const mesh = this._scene.getMeshByUniqueId(this._excludedMeshes[index]);\r\n if (mesh) {\r\n serializationObject.excludedMeshes.push(mesh.id);\r\n }\r\n }\r\n }\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Creates a Glow Layer from parsed glow layer data\r\n * @param parsedGlowLayer defines glow layer data\r\n * @param scene defines the current scene\r\n * @param rootUrl defines the root URL containing the glow layer information\r\n * @returns a parsed Glow Layer\r\n */\r\n public static Parse(parsedGlowLayer: any, scene: Scene, rootUrl: string): GlowLayer {\r\n const gl = SerializationHelper.Parse(() => new GlowLayer(parsedGlowLayer.name, scene, parsedGlowLayer.options), parsedGlowLayer, scene, rootUrl);\r\n let index;\r\n\r\n // Excluded meshes\r\n for (index = 0; index < parsedGlowLayer.excludedMeshes.length; index++) {\r\n const mesh = scene.getMeshById(parsedGlowLayer.excludedMeshes[index]);\r\n if (mesh) {\r\n gl.addExcludedMesh(<Mesh>mesh);\r\n }\r\n }\r\n\r\n // Included meshes\r\n for (index = 0; index < parsedGlowLayer.includedMeshes.length; index++) {\r\n const mesh = scene.getMeshById(parsedGlowLayer.includedMeshes[index]);\r\n if (mesh) {\r\n gl.addIncludedOnlyMesh(<Mesh>mesh);\r\n }\r\n }\r\n\r\n return gl;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GlowLayer\", GlowLayer);\r\n"]}
|
package/Layers/highlightLayer.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __decorate } from "../tslib.es6.js";
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
3
|
-
import { serialize
|
|
3
|
+
import { serialize } from "../Misc/decorators.js";
|
|
4
4
|
import { Observable } from "../Misc/observable.js";
|
|
5
5
|
import { Vector2 } from "../Maths/math.vector.js";
|
|
6
6
|
import { Engine } from "../Engines/engine.js";
|
|
@@ -21,6 +21,7 @@ import "../Shaders/glowMapMerge.fragment.js";
|
|
|
21
21
|
import "../Shaders/glowMapMerge.vertex.js";
|
|
22
22
|
import "../Shaders/glowBlurPostProcess.fragment.js";
|
|
23
23
|
import "../Layers/effectLayerSceneComponent.js";
|
|
24
|
+
import { SerializationHelper } from "../Misc/decorators.serialization.js";
|
|
24
25
|
AbstractScene.prototype.getHighlightLayerByName = function (name) {
|
|
25
26
|
for (let index = 0; index < this.effectLayers?.length; index++) {
|
|
26
27
|
if (this.effectLayers[index].name === name && this.effectLayers[index].getEffectName() === HighlightLayer.EffectName) {
|