@babylonjs/core 7.19.1 → 7.20.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/Bones/bone.js +3 -3
- package/Bones/bone.js.map +1 -1
- package/Bones/boneLookController.js +3 -3
- package/Bones/boneLookController.js.map +1 -1
- package/Buffers/buffer.nonFloatVertexBuffers.js +1 -1
- package/Buffers/buffer.nonFloatVertexBuffers.js.map +1 -1
- package/Collisions/gpuPicker.d.ts +8 -2
- package/Collisions/gpuPicker.js +41 -20
- package/Collisions/gpuPicker.js.map +1 -1
- package/Compat/compatibilityOptions.d.ts +13 -6
- package/Compat/compatibilityOptions.js +20 -4
- package/Compat/compatibilityOptions.js.map +1 -1
- package/Compat/index.d.ts +1 -1
- package/Compat/index.js +1 -1
- package/Compat/index.js.map +1 -1
- package/Culling/boundingBox.js +5 -5
- package/Culling/boundingBox.js.map +1 -1
- package/Culling/boundingInfo.js +2 -2
- package/Culling/boundingInfo.js.map +1 -1
- package/Culling/boundingSphere.js +2 -2
- package/Culling/boundingSphere.js.map +1 -1
- package/Culling/ray.js +2 -2
- package/Culling/ray.js.map +1 -1
- package/Debug/debugLayer.d.ts +3 -0
- package/Debug/debugLayer.js +15 -0
- package/Debug/debugLayer.js.map +1 -1
- package/Engines/Processors/shaderProcessor.d.ts +1 -0
- package/Engines/Processors/shaderProcessor.js +1 -0
- package/Engines/Processors/shaderProcessor.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.rawTexture.js +1 -0
- package/Engines/WebGPU/Extensions/engine.rawTexture.js.map +1 -1
- package/Engines/WebGPU/webgpuShaderProcessingContext.d.ts +1 -1
- package/Engines/WebGPU/webgpuShaderProcessingContext.js +4 -2
- package/Engines/WebGPU/webgpuShaderProcessingContext.js.map +1 -1
- package/Engines/WebGPU/webgpuShaderProcessorsWGSL.d.ts +2 -1
- package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js +12 -5
- package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js.map +1 -1
- package/Engines/WebGPU/webgpuTextureManager.d.ts +1 -4
- package/Engines/WebGPU/webgpuTextureManager.js +90 -75
- package/Engines/WebGPU/webgpuTextureManager.js.map +1 -1
- package/Engines/abstractEngine.d.ts +2 -2
- package/Engines/abstractEngine.js +2 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/Engines/engine.js +11 -2
- package/Engines/engine.js.map +1 -1
- package/Engines/nativeEngine.d.ts +1 -1
- package/Engines/nativeEngine.js +2 -1
- package/Engines/nativeEngine.js.map +1 -1
- package/Engines/thinEngine.d.ts +1 -1
- package/Engines/thinEngine.functions.d.ts +1 -1
- package/Engines/thinEngine.functions.js +2 -1
- package/Engines/thinEngine.functions.js.map +1 -1
- package/Engines/thinEngine.js +2 -2
- package/Engines/thinEngine.js.map +1 -1
- package/Engines/webgpuEngine.d.ts +9 -5
- package/Engines/webgpuEngine.js +35 -22
- package/Engines/webgpuEngine.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDoNBlock.d.ts +2 -2
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDoNBlock.js +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDoNBlock.js.map +1 -1
- package/Layers/effectLayer.d.ts +16 -1
- package/Layers/effectLayer.js +32 -2
- package/Layers/effectLayer.js.map +1 -1
- package/Layers/glowLayer.d.ts +1 -2
- package/Layers/glowLayer.js +16 -3
- package/Layers/glowLayer.js.map +1 -1
- package/Layers/highlightLayer.d.ts +5 -4
- package/Layers/highlightLayer.js +35 -11
- package/Layers/highlightLayer.js.map +1 -1
- package/Layers/index.d.ts +10 -0
- package/Layers/index.js +12 -0
- package/Layers/index.js.map +1 -1
- package/Lights/Shadows/index.d.ts +8 -0
- package/Lights/Shadows/index.js +9 -0
- package/Lights/Shadows/index.js.map +1 -1
- package/Lights/Shadows/shadowGenerator.d.ts +18 -5
- package/Lights/Shadows/shadowGenerator.js +44 -5
- package/Lights/Shadows/shadowGenerator.js.map +1 -1
- package/Loading/sceneLoader.d.ts +155 -16
- package/Loading/sceneLoader.js +197 -99
- package/Loading/sceneLoader.js.map +1 -1
- package/Materials/Node/nodeMaterial.js +8 -1
- package/Materials/Node/nodeMaterial.js.map +1 -1
- package/Materials/Node/nodeMaterialBuildState.js +1 -1
- package/Materials/Node/nodeMaterialBuildState.js.map +1 -1
- package/Materials/Textures/Loaders/hdrTextureLoader.js +3 -3
- package/Materials/Textures/Loaders/hdrTextureLoader.js.map +1 -1
- package/Materials/Textures/hdrCubeTexture.js +2 -2
- package/Materials/Textures/hdrCubeTexture.js.map +1 -1
- package/Materials/Textures/renderTargetTexture.js +2 -2
- package/Materials/Textures/renderTargetTexture.js.map +1 -1
- package/Materials/Textures/texture.js +3 -3
- package/Materials/Textures/texture.js.map +1 -1
- package/Materials/effect.functions.d.ts +1 -1
- package/Materials/effect.functions.js +6 -3
- package/Materials/effect.functions.js.map +1 -1
- package/Materials/effect.js +1 -1
- package/Materials/effect.js.map +1 -1
- package/Materials/standardMaterial.d.ts +1 -1
- package/Materials/standardMaterial.js +1 -1
- package/Materials/standardMaterial.js.map +1 -1
- package/Maths/math.color.js +3 -3
- package/Maths/math.color.js.map +1 -1
- package/Maths/math.constants.d.ts +1 -2
- package/Maths/math.constants.js +1 -2
- package/Maths/math.constants.js.map +1 -1
- package/Maths/math.like.d.ts +9 -0
- package/Maths/math.like.js.map +1 -1
- package/Maths/math.vector.d.ts +23 -23
- package/Maths/math.vector.js +56 -25
- package/Maths/math.vector.js.map +1 -1
- package/Meshes/Builders/boxBuilder.js +5 -5
- package/Meshes/Builders/boxBuilder.js.map +1 -1
- package/Meshes/Builders/capsuleBuilder.js +4 -4
- package/Meshes/Builders/capsuleBuilder.js.map +1 -1
- package/Meshes/Builders/cylinderBuilder.js +8 -8
- package/Meshes/Builders/cylinderBuilder.js.map +1 -1
- package/Meshes/Builders/decalBuilder.js +3 -3
- package/Meshes/Builders/decalBuilder.js.map +1 -1
- package/Meshes/Builders/discBuilder.js +3 -3
- package/Meshes/Builders/discBuilder.js.map +1 -1
- package/Meshes/Builders/goldbergBuilder.js +2 -2
- package/Meshes/Builders/goldbergBuilder.js.map +1 -1
- package/Meshes/Builders/groundBuilder.js +2 -2
- package/Meshes/Builders/groundBuilder.js.map +1 -1
- package/Meshes/Builders/icoSphereBuilder.js +2 -2
- package/Meshes/Builders/icoSphereBuilder.js.map +1 -1
- package/Meshes/Builders/planeBuilder.js +5 -5
- package/Meshes/Builders/planeBuilder.js.map +1 -1
- package/Meshes/Builders/polygonBuilder.js +4 -4
- package/Meshes/Builders/polygonBuilder.js.map +1 -1
- package/Meshes/Builders/polyhedronBuilder.js +3 -3
- package/Meshes/Builders/polyhedronBuilder.js.map +1 -1
- package/Meshes/Builders/ribbonBuilder.js +4 -4
- package/Meshes/Builders/ribbonBuilder.js.map +1 -1
- package/Meshes/Builders/sphereBuilder.js +2 -2
- package/Meshes/Builders/sphereBuilder.js.map +1 -1
- package/Meshes/Builders/tiledBoxBuilder.js +2 -2
- package/Meshes/Builders/tiledBoxBuilder.js.map +1 -1
- package/Meshes/Builders/torusBuilder.js +2 -2
- package/Meshes/Builders/torusBuilder.js.map +1 -1
- package/Meshes/Builders/torusKnotBuilder.js +2 -2
- package/Meshes/Builders/torusKnotBuilder.js.map +1 -1
- package/Meshes/geometry.js +7 -7
- package/Meshes/geometry.js.map +1 -1
- package/Misc/HighDynamicRange/hdr.d.ts +40 -42
- package/Misc/HighDynamicRange/hdr.js +209 -202
- package/Misc/HighDynamicRange/hdr.js.map +1 -1
- package/Misc/HighDynamicRange/index.d.ts +1 -1
- package/Misc/HighDynamicRange/index.js +1 -1
- package/Misc/HighDynamicRange/index.js.map +1 -1
- package/Misc/arrayTools.d.ts +12 -17
- package/Misc/arrayTools.js +18 -23
- package/Misc/arrayTools.js.map +1 -1
- package/Misc/dumpTools.d.ts +50 -47
- package/Misc/dumpTools.js +153 -143
- package/Misc/dumpTools.js.map +1 -1
- package/Misc/environmentTextureTools.js +2 -2
- package/Misc/environmentTextureTools.js.map +1 -1
- package/Misc/equirectangularCapture.js +2 -2
- package/Misc/equirectangularCapture.js.map +1 -1
- package/Misc/index.d.ts +6 -1
- package/Misc/index.js +7 -1
- package/Misc/index.js.map +1 -1
- package/Misc/rgbdTextureTools.d.ts +1 -0
- package/Misc/rgbdTextureTools.js +16 -2
- package/Misc/rgbdTextureTools.js.map +1 -1
- package/Misc/screenshotTools.js +3 -3
- package/Misc/screenshotTools.js.map +1 -1
- package/Physics/v1/physicsImpostor.js +2 -2
- package/Physics/v1/physicsImpostor.js.map +1 -1
- package/Physics/v2/Plugins/havokPlugin.js +2 -2
- package/Physics/v2/Plugins/havokPlugin.js.map +1 -1
- package/PostProcesses/blurPostProcess.d.ts +6 -0
- package/PostProcesses/blurPostProcess.js +20 -2
- package/PostProcesses/blurPostProcess.js.map +1 -1
- package/PostProcesses/index.d.ts +8 -0
- package/PostProcesses/index.js +10 -0
- package/PostProcesses/index.js.map +1 -1
- package/PostProcesses/passPostProcess.d.ts +2 -0
- package/PostProcesses/passPostProcess.js +24 -2
- package/PostProcesses/passPostProcess.js.map +1 -1
- package/PostProcesses/postProcess.d.ts +17 -2
- package/PostProcesses/postProcess.js +38 -1
- package/PostProcesses/postProcess.js.map +1 -1
- package/Shaders/ShadersInclude/pbrDebug.js +1 -1
- package/Shaders/ShadersInclude/pbrDebug.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/bayerDitherFunctions.d.ts +5 -0
- package/ShadersWGSL/ShadersInclude/bayerDitherFunctions.js +17 -0
- package/ShadersWGSL/ShadersInclude/bayerDitherFunctions.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/imageProcessingFunctions.js +1 -1
- package/ShadersWGSL/ShadersInclude/imageProcessingFunctions.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/kernelBlurFragment.d.ts +5 -0
- package/ShadersWGSL/ShadersInclude/kernelBlurFragment.js +20 -0
- package/ShadersWGSL/ShadersInclude/kernelBlurFragment.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/kernelBlurFragment2.d.ts +5 -0
- package/ShadersWGSL/ShadersInclude/kernelBlurFragment2.js +19 -0
- package/ShadersWGSL/ShadersInclude/kernelBlurFragment2.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/kernelBlurVaryingDeclaration.d.ts +5 -0
- package/ShadersWGSL/ShadersInclude/kernelBlurVaryingDeclaration.js +9 -0
- package/ShadersWGSL/ShadersInclude/kernelBlurVaryingDeclaration.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/kernelBlurVertex.d.ts +5 -0
- package/ShadersWGSL/ShadersInclude/kernelBlurVertex.js +9 -0
- package/ShadersWGSL/ShadersInclude/kernelBlurVertex.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/morphTargetsVertex.js +4 -4
- package/ShadersWGSL/ShadersInclude/morphTargetsVertex.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBRDFFunctions.js +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBRDFFunctions.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrDebug.js +1 -1
- package/ShadersWGSL/ShadersInclude/pbrDebug.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/shadowMapFragment.js +5 -5
- package/ShadersWGSL/ShadersInclude/shadowMapFragment.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/shadowMapFragmentExtraDeclaration.d.ts +7 -0
- package/ShadersWGSL/ShadersInclude/shadowMapFragmentExtraDeclaration.js +26 -0
- package/ShadersWGSL/ShadersInclude/shadowMapFragmentExtraDeclaration.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/shadowMapFragmentSoftTransparentShadow.d.ts +5 -0
- package/ShadersWGSL/ShadersInclude/shadowMapFragmentSoftTransparentShadow.js +12 -0
- package/ShadersWGSL/ShadersInclude/shadowMapFragmentSoftTransparentShadow.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/shadowMapVertexExtraDeclaration.d.ts +5 -0
- package/ShadersWGSL/ShadersInclude/shadowMapVertexExtraDeclaration.js +19 -0
- package/ShadersWGSL/ShadersInclude/shadowMapVertexExtraDeclaration.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/shadowMapVertexMetric.js +4 -4
- package/ShadersWGSL/ShadersInclude/shadowMapVertexMetric.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/shadowMapVertexNormalBias.d.ts +5 -0
- package/ShadersWGSL/ShadersInclude/shadowMapVertexNormalBias.js +17 -0
- package/ShadersWGSL/ShadersInclude/shadowMapVertexNormalBias.js.map +1 -0
- package/ShadersWGSL/background.fragment.js +1 -1
- package/ShadersWGSL/background.fragment.js.map +1 -1
- package/ShadersWGSL/default.fragment.js +2 -2
- package/ShadersWGSL/default.fragment.js.map +1 -1
- package/ShadersWGSL/depthBoxBlur.fragment.d.ts +5 -0
- package/ShadersWGSL/depthBoxBlur.fragment.js +14 -0
- package/ShadersWGSL/depthBoxBlur.fragment.js.map +1 -0
- package/ShadersWGSL/glowBlurPostProcess.fragment.d.ts +5 -0
- package/ShadersWGSL/glowBlurPostProcess.fragment.js +15 -0
- package/ShadersWGSL/glowBlurPostProcess.fragment.js.map +1 -0
- package/ShadersWGSL/glowMapGeneration.fragment.d.ts +8 -0
- package/ShadersWGSL/glowMapGeneration.fragment.js +74 -0
- package/ShadersWGSL/glowMapGeneration.fragment.js.map +1 -0
- package/ShadersWGSL/glowMapGeneration.vertex.d.ts +17 -0
- package/ShadersWGSL/glowMapGeneration.vertex.js +92 -0
- package/ShadersWGSL/glowMapGeneration.vertex.js.map +1 -0
- package/ShadersWGSL/glowMapMerge.fragment.d.ts +5 -0
- package/ShadersWGSL/glowMapMerge.fragment.js +32 -0
- package/ShadersWGSL/glowMapMerge.fragment.js.map +1 -0
- package/ShadersWGSL/glowMapMerge.vertex.d.ts +5 -0
- package/ShadersWGSL/glowMapMerge.vertex.js +16 -0
- package/ShadersWGSL/glowMapMerge.vertex.js.map +1 -0
- package/ShadersWGSL/kernelBlur.fragment.d.ts +9 -0
- package/ShadersWGSL/kernelBlur.fragment.js +48 -0
- package/ShadersWGSL/kernelBlur.fragment.js.map +1 -0
- package/ShadersWGSL/kernelBlur.vertex.d.ts +7 -0
- package/ShadersWGSL/kernelBlur.vertex.js +21 -0
- package/ShadersWGSL/kernelBlur.vertex.js.map +1 -0
- package/ShadersWGSL/pass.fragment.d.ts +5 -0
- package/ShadersWGSL/pass.fragment.js +12 -0
- package/ShadersWGSL/pass.fragment.js.map +1 -0
- package/ShadersWGSL/passCube.fragment.d.ts +5 -0
- package/ShadersWGSL/passCube.fragment.js +31 -0
- package/ShadersWGSL/passCube.fragment.js.map +1 -0
- package/ShadersWGSL/rgbdDecode.fragment.d.ts +6 -0
- package/ShadersWGSL/rgbdDecode.fragment.js +14 -0
- package/ShadersWGSL/rgbdDecode.fragment.js.map +1 -0
- package/ShadersWGSL/rgbdEncode.fragment.d.ts +6 -0
- package/ShadersWGSL/rgbdEncode.fragment.js +14 -0
- package/ShadersWGSL/rgbdEncode.fragment.js.map +1 -0
- package/ShadersWGSL/shadowMap.fragment.d.ts +9 -0
- package/ShadersWGSL/shadowMap.fragment.js +39 -0
- package/ShadersWGSL/shadowMap.fragment.js.map +1 -0
- package/ShadersWGSL/shadowMap.vertex.d.ts +22 -0
- package/ShadersWGSL/shadowMap.vertex.js +89 -0
- package/ShadersWGSL/shadowMap.vertex.js.map +1 -0
- package/package.json +1 -1
package/Bones/bone.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Vector3, Quaternion, Matrix, TmpVectors } from "../Maths/math.vector.js";
|
|
2
|
-
import {
|
|
2
|
+
import { BuildArray } from "../Misc/arrayTools.js";
|
|
3
3
|
import { Node } from "../node.js";
|
|
4
4
|
/**
|
|
5
5
|
* Class used to store bone information
|
|
@@ -1008,7 +1008,7 @@ export class Bone extends Node {
|
|
|
1008
1008
|
this.setRestMatrix(this.getLocalMatrix());
|
|
1009
1009
|
}
|
|
1010
1010
|
}
|
|
1011
|
-
Bone._TmpVecs =
|
|
1011
|
+
Bone._TmpVecs = BuildArray(2, Vector3.Zero);
|
|
1012
1012
|
Bone._TmpQuat = Quaternion.Identity();
|
|
1013
|
-
Bone._TmpMats =
|
|
1013
|
+
Bone._TmpMats = BuildArray(5, Matrix.Identity);
|
|
1014
1014
|
//# sourceMappingURL=bone.js.map
|
package/Bones/bone.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bone.js","sourceRoot":"","sources":["../../../../dev/core/src/Bones/bone.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAC/E,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGhD,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAM/B;;;GAGG;AACH,MAAM,OAAO,IAAK,SAAQ,IAAI;IA+C1B,gBAAgB;IAChB,IAAI,OAAO;QACP,IAAI,CAAC,QAAQ,EAAE,CAAC;QAChB,OAAO,IAAI,CAAC,YAAY,CAAC;IAC7B,CAAC;IAED,gBAAgB;IAChB,IAAI,OAAO,CAAC,KAAa;QACrB,oCAAoC;QACpC,IAAI,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC,YAAY,CAAC,UAAU,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE;YAC3E,OAAO;SACV;QAED,IAAI,CAAC,cAAc,GAAG,KAAK,CAAC,CAAC,sCAAsC;QAEnE,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAClC,IAAI,CAAC,wBAAwB,EAAE,CAAC;IACpC,CAAC;IAED;;;;;;;;;OASG;IACH;IACI;;OAEG;IACa,IAAY,EAC5B,QAAkB,EAClB,aAA6B,IAAI,EACjC,cAAgC,IAAI,EACpC,aAA+B,IAAI,EACnC,aAA+B,IAAI,EACnC,QAA0B,IAAI;QAE9B,KAAK,CAAC,IAAI,EA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AAK,IAAI,EAAE,EAAE;YACb,IAAI,CAAC,aAAa,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;SAChC;QAED,IAAI,CAAC,MAAM,EAAE,CAAC;QAEd,OAAO,CAAC,yBAAyB,CAAC,QAAQ,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;IAC9D,CAAC;IAED;;OAEG;IACI,oBAAoB;QACvB,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC;IAC9C,CAAC;;AA/rCc,aAAQ,GAAc,UAAU,CAAC,UAAU,CAAC,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,AAApD,CAAqD;AAC7D,aAAQ,GAAG,UAAU,CAAC,QAAQ,EAAE,AAAxB,CAAyB;AACjC,aAAQ,GAAa,UAAU,CAAC,UAAU,CAAC,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC,AAAtD,CAAuD","sourcesContent":["import type { Skeleton } from \"./skeleton\";\r\nimport { Vector3, Quaternion, Matrix, TmpVectors } from \"../Maths/math.vector\";\r\nimport { ArrayTools } from \"../Misc/arrayTools\";\r\nimport type { Nullable } from \"../types\";\r\nimport type { TransformNode } from \"../Meshes/transformNode\";\r\nimport { Node } from \"../node\";\r\nimport { Space } from \"../Maths/math.axis\";\r\n\r\nimport type { Animation } from \"../Animations/animation\";\r\nimport type { AnimationPropertiesOverride } from \"../Animations/animationPropertiesOverride\";\r\n\r\n/**\r\n * Class used to store bone information\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/bonesSkeletons\r\n */\r\nexport class Bone extends Node {\r\n private static _TmpVecs: Vector3[] = ArrayTools.BuildArray(2, Vector3.Zero);\r\n private static _TmpQuat = Quaternion.Identity();\r\n private static _TmpMats: Matrix[] = ArrayTools.BuildArray(5, Matrix.Identity);\r\n\r\n /**\r\n * Gets the list of child bones\r\n */\r\n public children: Bone[] = [];\r\n\r\n /** Gets the animations associated with this bone */\r\n public override animations: Animation[] = [];\r\n\r\n /**\r\n * Gets or sets bone length\r\n */\r\n public length: number;\r\n\r\n /**\r\n * @internal Internal only\r\n * Set this value to map this bone to a different index in the transform matrices\r\n * Set this value to -1 to exclude the bone from the transform matrices\r\n */\r\n public _index: Nullable<number> = null;\r\n\r\n private _skeleton: Skeleton;\r\n private _localMatrix: Matrix; // transformation of the bone, in local space\r\n private _absoluteMatrix: Matrix; // transformation of the bone, in world space (relative to the skeleton root)\r\n private _bindMatrix: Matrix; // the bind matrix, in local space\r\n private _absoluteBindMatrix: Matrix; // the bind matrix, in world space (relative to the skeleton root)\r\n private _absoluteInverseBindMatrix: Matrix; // the inverse of the bind matrix, in world space (relative to the skeleton root)\r\n private _finalMatrix: Matrix; // the final matrix used to transform vertices of the mesh according to the bone, in world space (relative to the skeleton root). It is the multiplication of _absoluteInverseBindMatrix with _absoluteMatrix.\r\n private _restMatrix: Matrix; // a matrix for the exclusive use of the end user (not used internally by the framework), in local space\r\n private _scalingDeterminant = 1;\r\n\r\n private _localScaling: Vector3;\r\n private _localRotation: Quaternion;\r\n private _localPosition: Vector3;\r\n private _needToDecompose = true;\r\n private _needToCompose = false;\r\n\r\n /** @internal */\r\n public _linkedTransformNode: Nullable<TransformNode> = null;\r\n\r\n /** @internal */\r\n public _waitingTransformNodeId: Nullable<string> = null;\r\n\r\n /** @internal */\r\n get _matrix(): Matrix {\r\n this._compose();\r\n return this._localMatrix;\r\n }\r\n\r\n /** @internal */\r\n set _matrix(value: Matrix) {\r\n // skip if the matrices are the same\r\n if (value.updateFlag === this._localMatrix.updateFlag && !this._needToCompose) {\r\n return;\r\n }\r\n\r\n this._needToCompose = false; // in case there was a pending compose\r\n\r\n this._localMatrix.copyFrom(value);\r\n this._markAsDirtyAndDecompose();\r\n }\r\n\r\n /**\r\n * Create a new bone\r\n * @param name defines the bone name\r\n * @param skeleton defines the parent skeleton\r\n * @param parentBone defines the parent (can be null if the bone is the root)\r\n * @param localMatrix defines the local matrix (default: identity)\r\n * @param restMatrix defines the rest matrix (default: localMatrix)\r\n * @param bindMatrix defines the bind matrix (default: localMatrix)\r\n * @param index defines index of the bone in the hierarchy (default: null)\r\n */\r\n constructor(\r\n /**\r\n * defines the bone name\r\n */\r\n public override name: string,\r\n skeleton: Skeleton,\r\n parentBone: Nullable<Bone> = null,\r\n localMatrix: Nullable<Matrix> = null,\r\n restMatrix: Nullable<Matrix> = null,\r\n bindMatrix: Nullable<Matrix> = null,\r\n index: Nullable<number> = null\r\n ) {\r\n super(name, skeleton.getScene(), false);\r\n this._skeleton = skeleton;\r\n this._localMatrix = localMatrix?.clone() ?? Matrix.Identity();\r\n this._restMatrix = restMatrix ?? this._localMatrix.clone();\r\n this._bindMatrix = bindMatrix ?? this._localMatrix.clone();\r\n this._index = index;\r\n\r\n this._absoluteMatrix = new Matrix();\r\n this._absoluteBindMatrix = new Matrix();\r\n this._absoluteInverseBindMatrix = new Matrix();\r\n this._finalMatrix = new Matrix();\r\n\r\n skeleton.bones.push(this);\r\n\r\n this.setParent(parentBone, false);\r\n\r\n this._updateAbsoluteBindMatrices();\r\n }\r\n\r\n /**\r\n * Gets the current object class name.\r\n * @returns the class name\r\n */\r\n public override getClassName(): string {\r\n return \"Bone\";\r\n }\r\n\r\n // Members\r\n\r\n /**\r\n * Gets the parent skeleton\r\n * @returns a skeleton\r\n */\r\n public getSkeleton(): Skeleton {\r\n return this._skeleton;\r\n }\r\n\r\n public override get parent(): Bone {\r\n return this._parentNode as Bone;\r\n }\r\n\r\n /**\r\n * Gets parent bone\r\n * @returns a bone or null if the bone is the root of the bone hierarchy\r\n */\r\n public getParent(): Nullable<Bone> {\r\n return this.parent;\r\n }\r\n\r\n /**\r\n * Returns an array containing the children of the bone\r\n * @returns an array containing the children of the bone (can be empty if the bone has no children)\r\n */\r\n public override getChildren(): Array<Bone> {\r\n return this.children;\r\n }\r\n\r\n /**\r\n * Gets the node index in matrix array generated for rendering\r\n * @returns the node index\r\n */\r\n public getIndex(): number {\r\n return this._index === null ? this.getSkeleton().bones.indexOf(this) : this._index;\r\n }\r\n\r\n public override set parent(newParent: Nullable<Bone>) {\r\n this.setParent(newParent);\r\n }\r\n\r\n /**\r\n * Sets the parent bone\r\n * @param parent defines the parent (can be null if the bone is the root)\r\n * @param updateAbsoluteBindMatrices defines if the absolute bind and absolute inverse bind matrices must be updated\r\n */\r\n public setParent(parent: Nullable<Bone>, updateAbsoluteBindMatrices: boolean = true): void {\r\n if (this.parent === parent) {\r\n return;\r\n }\r\n\r\n if (this.parent) {\r\n const index = this.parent.children.indexOf(this);\r\n if (index !== -1) {\r\n this.parent.children.splice(index, 1);\r\n }\r\n }\r\n\r\n this._parentNode = parent;\r\n\r\n if (this.parent) {\r\n this.parent.children.push(this);\r\n }\r\n\r\n if (updateAbsoluteBindMatrices) {\r\n this._updateAbsoluteBindMatrices();\r\n }\r\n\r\n this.markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets the local matrix\r\n * @returns the local matrix\r\n */\r\n public getLocalMatrix(): Matrix {\r\n this._compose();\r\n return this._localMatrix;\r\n }\r\n\r\n /**\r\n * Gets the bind matrix\r\n * @returns the bind matrix\r\n */\r\n public getBindMatrix(): Matrix {\r\n return this._bindMatrix;\r\n }\r\n\r\n /**\r\n * Gets the bind matrix.\r\n * @returns the bind matrix\r\n * @deprecated Please use getBindMatrix instead\r\n */\r\n public getBaseMatrix(): Matrix {\r\n return this.getBindMatrix();\r\n }\r\n\r\n /**\r\n * Gets the rest matrix\r\n * @returns the rest matrix\r\n */\r\n public getRestMatrix(): Matrix {\r\n return this._restMatrix;\r\n }\r\n\r\n /**\r\n * Gets the rest matrix\r\n * @returns the rest matrix\r\n * @deprecated Please use getRestMatrix instead\r\n */\r\n public getRestPose(): Matrix {\r\n return this.getRestMatrix();\r\n }\r\n\r\n /**\r\n * Sets the rest matrix\r\n * @param matrix the local-space rest matrix to set for this bone\r\n */\r\n public setRestMatrix(matrix: Matrix): void {\r\n this._restMatrix.copyFrom(matrix);\r\n }\r\n\r\n /**\r\n * Sets the rest matrix\r\n * @param matrix the local-space rest to set for this bone\r\n * @deprecated Please use setRestMatrix instead\r\n */\r\n public setRestPose(matrix: Matrix): void {\r\n this.setRestMatrix(matrix);\r\n }\r\n\r\n /**\r\n * Gets the bind matrix\r\n * @returns the bind matrix\r\n * @deprecated Please use getBindMatrix instead\r\n */\r\n public getBindPose(): Matrix {\r\n return this.getBindMatrix();\r\n }\r\n\r\n /**\r\n * Sets the bind matrix\r\n * This will trigger a recomputation of the absolute bind and absolute inverse bind matrices for this bone and its children\r\n * Note that the local matrix will also be set with the matrix passed in parameter!\r\n * @param matrix the local-space bind matrix to set for this bone\r\n */\r\n public setBindMatrix(matrix: Matrix): void {\r\n this.updateMatrix(matrix);\r\n }\r\n\r\n /**\r\n * Sets the bind matrix\r\n * @param matrix the local-space bind to set for this bone\r\n * @deprecated Please use setBindMatrix instead\r\n */\r\n public setBindPose(matrix: Matrix): void {\r\n this.setBindMatrix(matrix);\r\n }\r\n\r\n /**\r\n * Gets the matrix used to store the final world transformation of the bone (ie. the matrix sent to shaders)\r\n * @returns the final world matrix\r\n */\r\n public getFinalMatrix(): Matrix {\r\n return this._finalMatrix;\r\n }\r\n\r\n /**\r\n * Gets the matrix used to store the final world transformation of the bone (ie. the matrix sent to shaders)\r\n * @deprecated Please use getFinalMatrix instead\r\n * @returns the final world matrix\r\n */\r\n public override getWorldMatrix(): Matrix {\r\n return this.getFinalMatrix();\r\n }\r\n\r\n /**\r\n * Sets the local matrix to the rest matrix\r\n */\r\n public returnToRest(): void {\r\n if (this._linkedTransformNode) {\r\n const localScaling = TmpVectors.Vector3[0];\r\n const localRotation = TmpVectors.Quaternion[0];\r\n const localPosition = TmpVectors.Vector3[1];\r\n\r\n this.getRestMatrix().decompose(localScaling, localRotation, localPosition);\r\n\r\n this._linkedTransformNode.position.copyFrom(localPosition);\r\n this._linkedTransformNode.rotationQuaternion = this._linkedTransformNode.rotationQuaternion ?? Quaternion.Identity();\r\n this._linkedTransformNode.rotationQuaternion.copyFrom(localRotation);\r\n this._linkedTransformNode.scaling.copyFrom(localScaling);\r\n } else {\r\n this._matrix = this._restMatrix;\r\n }\r\n }\r\n\r\n /**\r\n * Gets the inverse of the bind matrix, in world space (relative to the skeleton root)\r\n * @returns the inverse bind matrix, in world space\r\n */\r\n public getAbsoluteInverseBindMatrix(): Matrix {\r\n return this._absoluteInverseBindMatrix;\r\n }\r\n\r\n /**\r\n * Gets the inverse of the bind matrix, in world space (relative to the skeleton root)\r\n * @returns the inverse bind matrix, in world space\r\n * @deprecated Please use getAbsoluteInverseBindMatrix instead\r\n */\r\n public getInvertedAbsoluteTransform(): Matrix {\r\n return this.getAbsoluteInverseBindMatrix();\r\n }\r\n\r\n /**\r\n * Gets the bone matrix, in world space (relative to the skeleton root)\r\n * @returns the bone matrix, in world space\r\n */\r\n public getAbsoluteMatrix(): Matrix {\r\n return this._absoluteMatrix;\r\n }\r\n\r\n /**\r\n * Gets the bone matrix, in world space (relative to the skeleton root)\r\n * @returns the bone matrix, in world space\r\n * @deprecated Please use getAbsoluteMatrix instead\r\n */\r\n public getAbsoluteTransform(): Matrix {\r\n return this._absoluteMatrix;\r\n }\r\n\r\n /**\r\n * Links with the given transform node.\r\n * The local matrix of this bone is overwritten by the transform of the node every frame.\r\n * @param transformNode defines the transform node to link to\r\n */\r\n public linkTransformNode(transformNode: Nullable<TransformNode>): void {\r\n if (this._linkedTransformNode) {\r\n this._skeleton._numBonesWithLinkedTransformNode--;\r\n }\r\n\r\n this._linkedTransformNode = transformNode;\r\n\r\n if (this._linkedTransformNode) {\r\n this._skeleton._numBonesWithLinkedTransformNode++;\r\n }\r\n }\r\n\r\n // Properties (matches TransformNode properties)\r\n\r\n /**\r\n * Gets the node used to drive the bone's transformation\r\n * @returns a transform node or null\r\n */\r\n public getTransformNode() {\r\n return this._linkedTransformNode;\r\n }\r\n\r\n /** Gets or sets current position (in local space) */\r\n public get position(): Vector3 {\r\n this._decompose();\r\n return this._localPosition;\r\n }\r\n\r\n public set position(newPosition: Vector3) {\r\n this._decompose();\r\n this._localPosition.copyFrom(newPosition);\r\n\r\n this._markAsDirtyAndCompose();\r\n }\r\n\r\n /** Gets or sets current rotation (in local space) */\r\n public get rotation(): Vector3 {\r\n return this.getRotation();\r\n }\r\n\r\n public set rotation(newRotation: Vector3) {\r\n this.setRotation(newRotation);\r\n }\r\n\r\n /** Gets or sets current rotation quaternion (in local space) */\r\n public get rotationQuaternion() {\r\n this._decompose();\r\n return this._localRotation;\r\n }\r\n\r\n public set rotationQuaternion(newRotation: Quaternion) {\r\n this.setRotationQuaternion(newRotation);\r\n }\r\n\r\n /** Gets or sets current scaling (in local space) */\r\n public get scaling(): Vector3 {\r\n return this.getScale();\r\n }\r\n\r\n public set scaling(newScaling: Vector3) {\r\n this.setScale(newScaling);\r\n }\r\n\r\n /**\r\n * Gets the animation properties override\r\n */\r\n public override get animationPropertiesOverride(): Nullable<AnimationPropertiesOverride> {\r\n return this._skeleton.animationPropertiesOverride;\r\n }\r\n\r\n // Methods\r\n private _decompose() {\r\n if (!this._needToDecompose) {\r\n return;\r\n }\r\n\r\n this._needToDecompose = false;\r\n\r\n if (!this._localScaling) {\r\n this._localScaling = Vector3.Zero();\r\n this._localRotation = Quaternion.Zero();\r\n this._localPosition = Vector3.Zero();\r\n }\r\n this._localMatrix.decompose(this._localScaling, this._localRotation, this._localPosition);\r\n }\r\n\r\n private _compose() {\r\n if (!this._needToCompose) {\r\n return;\r\n }\r\n\r\n if (!this._localScaling) {\r\n this._needToCompose = false;\r\n return;\r\n }\r\n\r\n this._needToCompose = false;\r\n Matrix.ComposeToRef(this._localScaling, this._localRotation, this._localPosition, this._localMatrix);\r\n }\r\n\r\n /**\r\n * Update the bind (and optionally the local) matrix\r\n * @param bindMatrix defines the new matrix to set to the bind/local matrix, in local space\r\n * @param updateAbsoluteBindMatrices defines if the absolute bind and absolute inverse bind matrices must be recomputed (default: true)\r\n * @param updateLocalMatrix defines if the local matrix should also be updated with the matrix passed in parameter (default: true)\r\n */\r\n public updateMatrix(bindMatrix: Matrix, updateAbsoluteBindMatrices = true, updateLocalMatrix = true): void {\r\n this._bindMatrix.copyFrom(bindMatrix);\r\n\r\n if (updateAbsoluteBindMatrices) {\r\n this._updateAbsoluteBindMatrices();\r\n }\r\n\r\n if (updateLocalMatrix) {\r\n this._matrix = bindMatrix;\r\n } else {\r\n this.markAsDirty();\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _updateAbsoluteBindMatrices(bindMatrix?: Matrix, updateChildren = true): void {\r\n if (!bindMatrix) {\r\n bindMatrix = this._bindMatrix;\r\n }\r\n\r\n if (this.parent) {\r\n bindMatrix.multiplyToRef(this.parent._absoluteBindMatrix, this._absoluteBindMatrix);\r\n } else {\r\n this._absoluteBindMatrix.copyFrom(bindMatrix);\r\n }\r\n\r\n this._absoluteBindMatrix.invertToRef(this._absoluteInverseBindMatrix);\r\n\r\n if (updateChildren) {\r\n for (let index = 0; index < this.children.length; index++) {\r\n this.children[index]._updateAbsoluteBindMatrices();\r\n }\r\n }\r\n\r\n this._scalingDeterminant = this._absoluteBindMatrix.determinant() < 0 ? -1 : 1;\r\n }\r\n\r\n /**\r\n * Flag the bone as dirty (Forcing it to update everything)\r\n * @returns this bone\r\n */\r\n public override markAsDirty(): Bone {\r\n this._currentRenderId++;\r\n this._childUpdateId++;\r\n this._skeleton._markAsDirty();\r\n return this;\r\n }\r\n\r\n /** @internal */\r\n public _markAsDirtyAndCompose() {\r\n this.markAsDirty();\r\n this._needToCompose = true;\r\n }\r\n\r\n private _markAsDirtyAndDecompose() {\r\n this.markAsDirty();\r\n this._needToDecompose = true;\r\n }\r\n\r\n private _updatePosition(vec: Vector3, space = Space.LOCAL, tNode?: TransformNode, translationMode = true): void {\r\n const lm = this.getLocalMatrix();\r\n\r\n if (space == Space.LOCAL) {\r\n if (translationMode) {\r\n lm.addAtIndex(12, vec.x);\r\n lm.addAtIndex(13, vec.y);\r\n lm.addAtIndex(14, vec.z);\r\n } else {\r\n lm.setTranslationFromFloats(vec.x, vec.y, vec.z);\r\n }\r\n } else {\r\n let wm: Nullable<Matrix> = null;\r\n\r\n //tNode.getWorldMatrix() needs to be called before skeleton.computeAbsoluteMatrices()\r\n if (tNode) {\r\n wm = tNode.getWorldMatrix();\r\n }\r\n\r\n this._skeleton.computeAbsoluteMatrices();\r\n\r\n const tmat = Bone._TmpMats[0];\r\n const tvec = Bone._TmpVecs[0];\r\n\r\n if (this.parent) {\r\n if (tNode && wm) {\r\n tmat.copyFrom(this.parent.getAbsoluteMatrix());\r\n tmat.multiplyToRef(wm, tmat);\r\n } else {\r\n tmat.copyFrom(this.parent.getAbsoluteMatrix());\r\n }\r\n } else {\r\n Matrix.IdentityToRef(tmat);\r\n }\r\n\r\n if (translationMode) {\r\n tmat.setTranslationFromFloats(0, 0, 0);\r\n }\r\n tmat.invert();\r\n Vector3.TransformCoordinatesToRef(vec, tmat, tvec);\r\n\r\n if (translationMode) {\r\n lm.addAtIndex(12, tvec.x);\r\n lm.addAtIndex(13, tvec.y);\r\n lm.addAtIndex(14, tvec.z);\r\n } else {\r\n lm.setTranslationFromFloats(tvec.x, tvec.y, tvec.z);\r\n }\r\n }\r\n\r\n this._markAsDirtyAndDecompose();\r\n }\r\n\r\n /**\r\n * Translate the bone in local or world space\r\n * @param vec The amount to translate the bone\r\n * @param space The space that the translation is in (default: Space.LOCAL)\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n */\r\n public translate(vec: Vector3, space = Space.LOCAL, tNode?: TransformNode): void {\r\n this._updatePosition(vec, space, tNode, true);\r\n }\r\n\r\n /**\r\n * Set the position of the bone in local or world space\r\n * @param position The position to set the bone\r\n * @param space The space that the position is in (default: Space.LOCAL)\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n */\r\n public setPosition(position: Vector3, space = Space.LOCAL, tNode?: TransformNode): void {\r\n this._updatePosition(position, space, tNode, false);\r\n }\r\n\r\n /**\r\n * Set the absolute position of the bone (world space)\r\n * @param position The position to set the bone\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n */\r\n public setAbsolutePosition(position: Vector3, tNode?: TransformNode) {\r\n this.setPosition(position, Space.WORLD, tNode);\r\n }\r\n\r\n /**\r\n * Scale the bone on the x, y and z axes (in local space)\r\n * @param x The amount to scale the bone on the x axis\r\n * @param y The amount to scale the bone on the y axis\r\n * @param z The amount to scale the bone on the z axis\r\n * @param scaleChildren sets this to true if children of the bone should be scaled as well (false by default)\r\n */\r\n public scale(x: number, y: number, z: number, scaleChildren = false): void {\r\n const locMat = this.getLocalMatrix();\r\n\r\n // Apply new scaling on top of current local matrix\r\n const scaleMat = Bone._TmpMats[0];\r\n Matrix.ScalingToRef(x, y, z, scaleMat);\r\n scaleMat.multiplyToRef(locMat, locMat);\r\n\r\n // Invert scaling matrix and apply the inverse to all children\r\n scaleMat.invert();\r\n\r\n for (const child of this.children) {\r\n const cm = child.getLocalMatrix();\r\n cm.multiplyToRef(scaleMat, cm);\r\n cm.multiplyAtIndex(12, x);\r\n cm.multiplyAtIndex(13, y);\r\n cm.multiplyAtIndex(14, z);\r\n\r\n child._markAsDirtyAndDecompose();\r\n }\r\n\r\n this._markAsDirtyAndDecompose();\r\n\r\n if (scaleChildren) {\r\n for (const child of this.children) {\r\n child.scale(x, y, z, scaleChildren);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Set the bone scaling in local space\r\n * @param scale defines the scaling vector\r\n */\r\n public setScale(scale: Vector3): void {\r\n this._decompose();\r\n this._localScaling.copyFrom(scale);\r\n this._markAsDirtyAndCompose();\r\n }\r\n\r\n /**\r\n * Gets the current scaling in local space\r\n * @returns the current scaling vector\r\n */\r\n public getScale(): Vector3 {\r\n this._decompose();\r\n return this._localScaling;\r\n }\r\n\r\n /**\r\n * Gets the current scaling in local space and stores it in a target vector\r\n * @param result defines the target vector\r\n */\r\n public getScaleToRef(result: Vector3) {\r\n this._decompose();\r\n result.copyFrom(this._localScaling);\r\n }\r\n\r\n /**\r\n * Set the yaw, pitch, and roll of the bone in local or world space\r\n * @param yaw The rotation of the bone on the y axis\r\n * @param pitch The rotation of the bone on the x axis\r\n * @param roll The rotation of the bone on the z axis\r\n * @param space The space that the axes of rotation are in\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n */\r\n public setYawPitchRoll(yaw: number, pitch: number, roll: number, space = Space.LOCAL, tNode?: TransformNode): void {\r\n if (space === Space.LOCAL) {\r\n const quat = Bone._TmpQuat;\r\n Quaternion.RotationYawPitchRollToRef(yaw, pitch, roll, quat);\r\n this.setRotationQuaternion(quat, space, tNode);\r\n return;\r\n }\r\n\r\n const rotMatInv = Bone._TmpMats[0];\r\n if (!this._getAbsoluteInverseMatrixUnscaledToRef(rotMatInv, tNode)) {\r\n return;\r\n }\r\n\r\n const rotMat = Bone._TmpMats[1];\r\n Matrix.RotationYawPitchRollToRef(yaw, pitch, roll, rotMat);\r\n\r\n rotMatInv.multiplyToRef(rotMat, rotMat);\r\n this._rotateWithMatrix(rotMat, space, tNode);\r\n }\r\n\r\n /**\r\n * Add a rotation to the bone on an axis in local or world space\r\n * @param axis The axis to rotate the bone on\r\n * @param amount The amount to rotate the bone\r\n * @param space The space that the axis is in\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n */\r\n public rotate(axis: Vector3, amount: number, space = Space.LOCAL, tNode?: TransformNode): void {\r\n const rmat = Bone._TmpMats[0];\r\n rmat.setTranslationFromFloats(0, 0, 0);\r\n Matrix.RotationAxisToRef(axis, amount, rmat);\r\n this._rotateWithMatrix(rmat, space, tNode);\r\n }\r\n\r\n /**\r\n * Set the rotation of the bone to a particular axis angle in local or world space\r\n * @param axis The axis to rotate the bone on\r\n * @param angle The angle that the bone should be rotated to\r\n * @param space The space that the axis is in\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n */\r\n public setAxisAngle(axis: Vector3, angle: number, space = Space.LOCAL, tNode?: TransformNode): void {\r\n if (space === Space.LOCAL) {\r\n const quat = Bone._TmpQuat;\r\n Quaternion.RotationAxisToRef(axis, angle, quat);\r\n\r\n this.setRotationQuaternion(quat, space, tNode);\r\n return;\r\n }\r\n\r\n const rotMatInv = Bone._TmpMats[0];\r\n if (!this._getAbsoluteInverseMatrixUnscaledToRef(rotMatInv, tNode)) {\r\n return;\r\n }\r\n\r\n const rotMat = Bone._TmpMats[1];\r\n Matrix.RotationAxisToRef(axis, angle, rotMat);\r\n\r\n rotMatInv.multiplyToRef(rotMat, rotMat);\r\n this._rotateWithMatrix(rotMat, space, tNode);\r\n }\r\n\r\n /**\r\n * Set the euler rotation of the bone in local or world space\r\n * @param rotation The euler rotation that the bone should be set to\r\n * @param space The space that the rotation is in\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n */\r\n public setRotation(rotation: Vector3, space = Space.LOCAL, tNode?: TransformNode): void {\r\n this.setYawPitchRoll(rotation.y, rotation.x, rotation.z, space, tNode);\r\n }\r\n\r\n /**\r\n * Set the quaternion rotation of the bone in local or world space\r\n * @param quat The quaternion rotation that the bone should be set to\r\n * @param space The space that the rotation is in\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n */\r\n public setRotationQuaternion(quat: Quaternion, space = Space.LOCAL, tNode?: TransformNode): void {\r\n if (space === Space.LOCAL) {\r\n this._decompose();\r\n this._localRotation.copyFrom(quat);\r\n\r\n this._markAsDirtyAndCompose();\r\n\r\n return;\r\n }\r\n\r\n const rotMatInv = Bone._TmpMats[0];\r\n if (!this._getAbsoluteInverseMatrixUnscaledToRef(rotMatInv, tNode)) {\r\n return;\r\n }\r\n\r\n const rotMat = Bone._TmpMats[1];\r\n Matrix.FromQuaternionToRef(quat, rotMat);\r\n\r\n rotMatInv.multiplyToRef(rotMat, rotMat);\r\n\r\n this._rotateWithMatrix(rotMat, space, tNode);\r\n }\r\n\r\n /**\r\n * Set the rotation matrix of the bone in local or world space\r\n * @param rotMat The rotation matrix that the bone should be set to\r\n * @param space The space that the rotation is in\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n */\r\n public setRotationMatrix(rotMat: Matrix, space = Space.LOCAL, tNode?: TransformNode): void {\r\n if (space === Space.LOCAL) {\r\n const quat = Bone._TmpQuat;\r\n Quaternion.FromRotationMatrixToRef(rotMat, quat);\r\n this.setRotationQuaternion(quat, space, tNode);\r\n return;\r\n }\r\n\r\n const rotMatInv = Bone._TmpMats[0];\r\n if (!this._getAbsoluteInverseMatrixUnscaledToRef(rotMatInv, tNode)) {\r\n return;\r\n }\r\n\r\n const rotMat2 = Bone._TmpMats[1];\r\n rotMat2.copyFrom(rotMat);\r\n\r\n rotMatInv.multiplyToRef(rotMat, rotMat2);\r\n\r\n this._rotateWithMatrix(rotMat2, space, tNode);\r\n }\r\n\r\n private _rotateWithMatrix(rmat: Matrix, space = Space.LOCAL, tNode?: TransformNode): void {\r\n const lmat = this.getLocalMatrix();\r\n const lx = lmat.m[12];\r\n const ly = lmat.m[13];\r\n const lz = lmat.m[14];\r\n const parent = this.getParent();\r\n const parentScale = Bone._TmpMats[3];\r\n const parentScaleInv = Bone._TmpMats[4];\r\n\r\n if (parent && space == Space.WORLD) {\r\n if (tNode) {\r\n parentScale.copyFrom(tNode.getWorldMatrix());\r\n parent.getAbsoluteMatrix().multiplyToRef(parentScale, parentScale);\r\n } else {\r\n parentScale.copyFrom(parent.getAbsoluteMatrix());\r\n }\r\n parentScaleInv.copyFrom(parentScale);\r\n parentScaleInv.invert();\r\n lmat.multiplyToRef(parentScale, lmat);\r\n lmat.multiplyToRef(rmat, lmat);\r\n lmat.multiplyToRef(parentScaleInv, lmat);\r\n } else {\r\n if (space == Space.WORLD && tNode) {\r\n parentScale.copyFrom(tNode.getWorldMatrix());\r\n parentScaleInv.copyFrom(parentScale);\r\n parentScaleInv.invert();\r\n lmat.multiplyToRef(parentScale, lmat);\r\n lmat.multiplyToRef(rmat, lmat);\r\n lmat.multiplyToRef(parentScaleInv, lmat);\r\n } else {\r\n lmat.multiplyToRef(rmat, lmat);\r\n }\r\n }\r\n\r\n lmat.setTranslationFromFloats(lx, ly, lz);\r\n\r\n this.computeAbsoluteMatrices();\r\n this._markAsDirtyAndDecompose();\r\n }\r\n\r\n private _getAbsoluteInverseMatrixUnscaledToRef(rotMatInv: Matrix, tNode?: TransformNode): boolean {\r\n const scaleMatrix = Bone._TmpMats[2];\r\n rotMatInv.copyFrom(this.getAbsoluteMatrix());\r\n\r\n if (tNode) {\r\n rotMatInv.multiplyToRef(tNode.getWorldMatrix(), rotMatInv);\r\n Matrix.ScalingToRef(tNode.scaling.x, tNode.scaling.y, tNode.scaling.z, scaleMatrix);\r\n } else {\r\n Matrix.IdentityToRef(scaleMatrix);\r\n }\r\n\r\n rotMatInv.invert();\r\n if (isNaN(rotMatInv.m[0])) {\r\n // Matrix failed to invert.\r\n // This can happen if scale is zero for example.\r\n return false;\r\n }\r\n\r\n scaleMatrix.multiplyAtIndex(0, this._scalingDeterminant);\r\n rotMatInv.multiplyToRef(scaleMatrix, rotMatInv);\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * Get the position of the bone in local or world space\r\n * @param space The space that the returned position is in\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n * @returns The position of the bone\r\n */\r\n public getPosition(space = Space.LOCAL, tNode: Nullable<TransformNode> = null): Vector3 {\r\n const pos = Vector3.Zero();\r\n\r\n this.getPositionToRef(space, tNode, pos);\r\n\r\n return pos;\r\n }\r\n\r\n /**\r\n * Copy the position of the bone to a vector3 in local or world space\r\n * @param space The space that the returned position is in\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n * @param result The vector3 to copy the position to\r\n */\r\n public getPositionToRef(space = Space.LOCAL, tNode: Nullable<TransformNode>, result: Vector3): void {\r\n if (space == Space.LOCAL) {\r\n const lm = this.getLocalMatrix();\r\n\r\n result.x = lm.m[12];\r\n result.y = lm.m[13];\r\n result.z = lm.m[14];\r\n } else {\r\n let wm: Nullable<Matrix> = null;\r\n\r\n //tNode.getWorldMatrix() needs to be called before skeleton.computeAbsoluteMatrices()\r\n if (tNode) {\r\n wm = tNode.getWorldMatrix();\r\n }\r\n\r\n this._skeleton.computeAbsoluteMatrices();\r\n\r\n let tmat = Bone._TmpMats[0];\r\n\r\n if (tNode && wm) {\r\n tmat.copyFrom(this.getAbsoluteMatrix());\r\n tmat.multiplyToRef(wm, tmat);\r\n } else {\r\n tmat = this.getAbsoluteMatrix();\r\n }\r\n\r\n result.x = tmat.m[12];\r\n result.y = tmat.m[13];\r\n result.z = tmat.m[14];\r\n }\r\n }\r\n\r\n /**\r\n * Get the absolute position of the bone (world space)\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n * @returns The absolute position of the bone\r\n */\r\n public getAbsolutePosition(tNode: Nullable<TransformNode> = null): Vector3 {\r\n const pos = Vector3.Zero();\r\n\r\n this.getPositionToRef(Space.WORLD, tNode, pos);\r\n\r\n return pos;\r\n }\r\n\r\n /**\r\n * Copy the absolute position of the bone (world space) to the result param\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n * @param result The vector3 to copy the absolute position to\r\n */\r\n public getAbsolutePositionToRef(tNode: TransformNode, result: Vector3) {\r\n this.getPositionToRef(Space.WORLD, tNode, result);\r\n }\r\n\r\n /**\r\n * Compute the absolute matrices of this bone and its children\r\n */\r\n public computeAbsoluteMatrices(): void {\r\n this._compose();\r\n\r\n if (this.parent) {\r\n this._localMatrix.multiplyToRef(this.parent._absoluteMatrix, this._absoluteMatrix);\r\n } else {\r\n this._absoluteMatrix.copyFrom(this._localMatrix);\r\n\r\n const poseMatrix = this._skeleton.getPoseMatrix();\r\n\r\n if (poseMatrix) {\r\n this._absoluteMatrix.multiplyToRef(poseMatrix, this._absoluteMatrix);\r\n }\r\n }\r\n\r\n const children = this.children;\r\n const len = children.length;\r\n\r\n for (let i = 0; i < len; i++) {\r\n children[i].computeAbsoluteMatrices();\r\n }\r\n }\r\n\r\n /**\r\n * Compute the absolute matrices of this bone and its children\r\n * @deprecated Please use computeAbsoluteMatrices instead\r\n */\r\n public computeAbsoluteTransforms(): void {\r\n this.computeAbsoluteMatrices();\r\n }\r\n\r\n /**\r\n * Get the world direction from an axis that is in the local space of the bone\r\n * @param localAxis The local direction that is used to compute the world direction\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n * @returns The world direction\r\n */\r\n public getDirection(localAxis: Vector3, tNode: Nullable<TransformNode> = null): Vector3 {\r\n const result = Vector3.Zero();\r\n\r\n this.getDirectionToRef(localAxis, tNode, result);\r\n\r\n return result;\r\n }\r\n\r\n /**\r\n * Copy the world direction to a vector3 from an axis that is in the local space of the bone\r\n * @param localAxis The local direction that is used to compute the world direction\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n * @param result The vector3 that the world direction will be copied to\r\n */\r\n public getDirectionToRef(localAxis: Vector3, tNode: Nullable<TransformNode> = null, result: Vector3): void {\r\n let wm: Nullable<Matrix> = null;\r\n\r\n //tNode.getWorldMatrix() needs to be called before skeleton.computeAbsoluteMatrices()\r\n if (tNode) {\r\n wm = tNode.getWorldMatrix();\r\n }\r\n\r\n this._skeleton.computeAbsoluteMatrices();\r\n\r\n const mat = Bone._TmpMats[0];\r\n\r\n mat.copyFrom(this.getAbsoluteMatrix());\r\n\r\n if (tNode && wm) {\r\n mat.multiplyToRef(wm, mat);\r\n }\r\n\r\n Vector3.TransformNormalToRef(localAxis, mat, result);\r\n\r\n result.normalize();\r\n }\r\n\r\n /**\r\n * Get the euler rotation of the bone in local or world space\r\n * @param space The space that the rotation should be in\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n * @returns The euler rotation\r\n */\r\n public getRotation(space = Space.LOCAL, tNode: Nullable<TransformNode> = null): Vector3 {\r\n const result = Vector3.Zero();\r\n\r\n this.getRotationToRef(space, tNode, result);\r\n\r\n return result;\r\n }\r\n\r\n /**\r\n * Copy the euler rotation of the bone to a vector3. The rotation can be in either local or world space\r\n * @param space The space that the rotation should be in\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n * @param result The vector3 that the rotation should be copied to\r\n */\r\n public getRotationToRef(space = Space.LOCAL, tNode: Nullable<TransformNode> = null, result: Vector3): void {\r\n const quat = Bone._TmpQuat;\r\n\r\n this.getRotationQuaternionToRef(space, tNode, quat);\r\n\r\n quat.toEulerAnglesToRef(result);\r\n }\r\n\r\n /**\r\n * Get the quaternion rotation of the bone in either local or world space\r\n * @param space The space that the rotation should be in\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n * @returns The quaternion rotation\r\n */\r\n public getRotationQuaternion(space = Space.LOCAL, tNode: Nullable<TransformNode> = null): Quaternion {\r\n const result = Quaternion.Identity();\r\n\r\n this.getRotationQuaternionToRef(space, tNode, result);\r\n\r\n return result;\r\n }\r\n\r\n /**\r\n * Copy the quaternion rotation of the bone to a quaternion. The rotation can be in either local or world space\r\n * @param space The space that the rotation should be in\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n * @param result The quaternion that the rotation should be copied to\r\n */\r\n public getRotationQuaternionToRef(space = Space.LOCAL, tNode: Nullable<TransformNode> = null, result: Quaternion): void {\r\n if (space == Space.LOCAL) {\r\n this._decompose();\r\n result.copyFrom(this._localRotation);\r\n } else {\r\n const mat = Bone._TmpMats[0];\r\n const amat = this.getAbsoluteMatrix();\r\n\r\n if (tNode) {\r\n amat.multiplyToRef(tNode.getWorldMatrix(), mat);\r\n } else {\r\n mat.copyFrom(amat);\r\n }\r\n\r\n mat.multiplyAtIndex(0, this._scalingDeterminant);\r\n mat.multiplyAtIndex(1, this._scalingDeterminant);\r\n mat.multiplyAtIndex(2, this._scalingDeterminant);\r\n\r\n mat.decompose(undefined, result, undefined);\r\n }\r\n }\r\n\r\n /**\r\n * Get the rotation matrix of the bone in local or world space\r\n * @param space The space that the rotation should be in\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n * @returns The rotation matrix\r\n */\r\n public getRotationMatrix(space = Space.LOCAL, tNode: TransformNode): Matrix {\r\n const result = Matrix.Identity();\r\n\r\n this.getRotationMatrixToRef(space, tNode, result);\r\n\r\n return result;\r\n }\r\n\r\n /**\r\n * Copy the rotation matrix of the bone to a matrix. The rotation can be in either local or world space\r\n * @param space The space that the rotation should be in\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n * @param result The quaternion that the rotation should be copied to\r\n */\r\n public getRotationMatrixToRef(space = Space.LOCAL, tNode: TransformNode, result: Matrix): void {\r\n if (space == Space.LOCAL) {\r\n this.getLocalMatrix().getRotationMatrixToRef(result);\r\n } else {\r\n const mat = Bone._TmpMats[0];\r\n const amat = this.getAbsoluteMatrix();\r\n\r\n if (tNode) {\r\n amat.multiplyToRef(tNode.getWorldMatrix(), mat);\r\n } else {\r\n mat.copyFrom(amat);\r\n }\r\n\r\n mat.multiplyAtIndex(0, this._scalingDeterminant);\r\n mat.multiplyAtIndex(1, this._scalingDeterminant);\r\n mat.multiplyAtIndex(2, this._scalingDeterminant);\r\n\r\n mat.getRotationMatrixToRef(result);\r\n }\r\n }\r\n\r\n /**\r\n * Get the world position of a point that is in the local space of the bone\r\n * @param position The local position\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n * @returns The world position\r\n */\r\n public getAbsolutePositionFromLocal(position: Vector3, tNode: Nullable<TransformNode> = null): Vector3 {\r\n const result = Vector3.Zero();\r\n\r\n this.getAbsolutePositionFromLocalToRef(position, tNode, result);\r\n\r\n return result;\r\n }\r\n\r\n /**\r\n * Get the world position of a point that is in the local space of the bone and copy it to the result param\r\n * @param position The local position\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n * @param result The vector3 that the world position should be copied to\r\n */\r\n public getAbsolutePositionFromLocalToRef(position: Vector3, tNode: Nullable<TransformNode> = null, result: Vector3): void {\r\n let wm: Nullable<Matrix> = null;\r\n\r\n //tNode.getWorldMatrix() needs to be called before skeleton.computeAbsoluteMatrices()\r\n if (tNode) {\r\n wm = tNode.getWorldMatrix();\r\n }\r\n\r\n this._skeleton.computeAbsoluteMatrices();\r\n\r\n const tmat = Bone._TmpMats[0];\r\n\r\n tmat.copyFrom(this.getAbsoluteMatrix());\r\n\r\n if (tNode && wm) {\r\n tmat.multiplyToRef(wm, tmat);\r\n }\r\n\r\n Vector3.TransformCoordinatesToRef(position, tmat, result);\r\n }\r\n\r\n /**\r\n * Get the local position of a point that is in world space\r\n * @param position The world position\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n * @returns The local position\r\n */\r\n public getLocalPositionFromAbsolute(position: Vector3, tNode: Nullable<TransformNode> = null): Vector3 {\r\n const result = Vector3.Zero();\r\n\r\n this.getLocalPositionFromAbsoluteToRef(position, tNode, result);\r\n\r\n return result;\r\n }\r\n\r\n /**\r\n * Get the local position of a point that is in world space and copy it to the result param\r\n * @param position The world position\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n * @param result The vector3 that the local position should be copied to\r\n */\r\n public getLocalPositionFromAbsoluteToRef(position: Vector3, tNode: Nullable<TransformNode> = null, result: Vector3): void {\r\n let wm: Nullable<Matrix> = null;\r\n\r\n //tNode.getWorldMatrix() needs to be called before skeleton.computeAbsoluteMatrices()\r\n if (tNode) {\r\n wm = tNode.getWorldMatrix();\r\n }\r\n\r\n this._skeleton.computeAbsoluteMatrices();\r\n\r\n const tmat = Bone._TmpMats[0];\r\n\r\n tmat.copyFrom(this.getAbsoluteMatrix());\r\n\r\n if (tNode && wm) {\r\n tmat.multiplyToRef(wm, tmat);\r\n }\r\n\r\n tmat.invert();\r\n\r\n Vector3.TransformCoordinatesToRef(position, tmat, result);\r\n }\r\n\r\n /**\r\n * Set the current local matrix as the restMatrix for this bone.\r\n */\r\n public setCurrentPoseAsRest(): void {\r\n this.setRestMatrix(this.getLocalMatrix());\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"bone.js","sourceRoot":"","sources":["../../../../dev/core/src/Bones/bone.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAC/E,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGhD,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAM/B;;;GAGG;AACH,MAAM,OAAO,IAAK,SAAQ,IAAI;IA+C1B,gBAAgB;IAChB,IAAI,OAAO;QACP,IAAI,CAAC,QAAQ,EAAE,CAAC;QAChB,OAAO,IAAI,CAAC,YAAY,CAAC;IAC7B,CAAC;IAED,gBAAgB;IAChB,IAAI,OAAO,CAAC,KAAa;QACrB,oCAAoC;QACpC,IAAI,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC,YAAY,CAAC,UAAU,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE;YAC3E,OAAO;SACV;QAED,IAAI,CAAC,cAAc,GAAG,KAAK,CAAC,CAAC,sCAAsC;QAEnE,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAClC,IAAI,CAAC,wBAAwB,EAAE,CAAC;IACpC,CAAC;IAED;;;;;;;;;OASG;IACH;IACI;;OAEG;IACa,IAAY,EAC5B,QAAkB,EAClB,aAA6B,IAAI,EACjC,cAAgC,IAAI,EACpC,aAA+B,IAAI,EACnC,aAA+B,IAAI,EACnC,QAA0B,IAAI;QAE9B,KAAK,CAAC,IAAI,EAAE,QAAQ,CAAC,QAAQ,EAAE,EAAE,KAAK,CAAC,CAAC;QARxB,SAAI,G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I,CAAC,CAAC;SAChC;QAED,IAAI,CAAC,MAAM,EAAE,CAAC;QAEd,OAAO,CAAC,yBAAyB,CAAC,QAAQ,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;IAC9D,CAAC;IAED;;OAEG;IACI,oBAAoB;QACvB,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC;IAC9C,CAAC;;AA/rCc,aAAQ,GAAc,UAAU,CAAC,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,AAAzC,CAA0C;AAClD,aAAQ,GAAG,UAAU,CAAC,QAAQ,EAAE,AAAxB,CAAyB;AACjC,aAAQ,GAAa,UAAU,CAAC,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC,AAA3C,CAA4C","sourcesContent":["import type { Skeleton } from \"./skeleton\";\r\nimport { Vector3, Quaternion, Matrix, TmpVectors } from \"../Maths/math.vector\";\r\nimport { BuildArray } from \"../Misc/arrayTools\";\r\nimport type { Nullable } from \"../types\";\r\nimport type { TransformNode } from \"../Meshes/transformNode\";\r\nimport { Node } from \"../node\";\r\nimport { Space } from \"../Maths/math.axis\";\r\n\r\nimport type { Animation } from \"../Animations/animation\";\r\nimport type { AnimationPropertiesOverride } from \"../Animations/animationPropertiesOverride\";\r\n\r\n/**\r\n * Class used to store bone information\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/bonesSkeletons\r\n */\r\nexport class Bone extends Node {\r\n private static _TmpVecs: Vector3[] = BuildArray(2, Vector3.Zero);\r\n private static _TmpQuat = Quaternion.Identity();\r\n private static _TmpMats: Matrix[] = BuildArray(5, Matrix.Identity);\r\n\r\n /**\r\n * Gets the list of child bones\r\n */\r\n public children: Bone[] = [];\r\n\r\n /** Gets the animations associated with this bone */\r\n public override animations: Animation[] = [];\r\n\r\n /**\r\n * Gets or sets bone length\r\n */\r\n public length: number;\r\n\r\n /**\r\n * @internal Internal only\r\n * Set this value to map this bone to a different index in the transform matrices\r\n * Set this value to -1 to exclude the bone from the transform matrices\r\n */\r\n public _index: Nullable<number> = null;\r\n\r\n private _skeleton: Skeleton;\r\n private _localMatrix: Matrix; // transformation of the bone, in local space\r\n private _absoluteMatrix: Matrix; // transformation of the bone, in world space (relative to the skeleton root)\r\n private _bindMatrix: Matrix; // the bind matrix, in local space\r\n private _absoluteBindMatrix: Matrix; // the bind matrix, in world space (relative to the skeleton root)\r\n private _absoluteInverseBindMatrix: Matrix; // the inverse of the bind matrix, in world space (relative to the skeleton root)\r\n private _finalMatrix: Matrix; // the final matrix used to transform vertices of the mesh according to the bone, in world space (relative to the skeleton root). It is the multiplication of _absoluteInverseBindMatrix with _absoluteMatrix.\r\n private _restMatrix: Matrix; // a matrix for the exclusive use of the end user (not used internally by the framework), in local space\r\n private _scalingDeterminant = 1;\r\n\r\n private _localScaling: Vector3;\r\n private _localRotation: Quaternion;\r\n private _localPosition: Vector3;\r\n private _needToDecompose = true;\r\n private _needToCompose = false;\r\n\r\n /** @internal */\r\n public _linkedTransformNode: Nullable<TransformNode> = null;\r\n\r\n /** @internal */\r\n public _waitingTransformNodeId: Nullable<string> = null;\r\n\r\n /** @internal */\r\n get _matrix(): Matrix {\r\n this._compose();\r\n return this._localMatrix;\r\n }\r\n\r\n /** @internal */\r\n set _matrix(value: Matrix) {\r\n // skip if the matrices are the same\r\n if (value.updateFlag === this._localMatrix.updateFlag && !this._needToCompose) {\r\n return;\r\n }\r\n\r\n this._needToCompose = false; // in case there was a pending compose\r\n\r\n this._localMatrix.copyFrom(value);\r\n this._markAsDirtyAndDecompose();\r\n }\r\n\r\n /**\r\n * Create a new bone\r\n * @param name defines the bone name\r\n * @param skeleton defines the parent skeleton\r\n * @param parentBone defines the parent (can be null if the bone is the root)\r\n * @param localMatrix defines the local matrix (default: identity)\r\n * @param restMatrix defines the rest matrix (default: localMatrix)\r\n * @param bindMatrix defines the bind matrix (default: localMatrix)\r\n * @param index defines index of the bone in the hierarchy (default: null)\r\n */\r\n constructor(\r\n /**\r\n * defines the bone name\r\n */\r\n public override name: string,\r\n skeleton: Skeleton,\r\n parentBone: Nullable<Bone> = null,\r\n localMatrix: Nullable<Matrix> = null,\r\n restMatrix: Nullable<Matrix> = null,\r\n bindMatrix: Nullable<Matrix> = null,\r\n index: Nullable<number> = null\r\n ) {\r\n super(name, skeleton.getScene(), false);\r\n this._skeleton = skeleton;\r\n this._localMatrix = localMatrix?.clone() ?? Matrix.Identity();\r\n this._restMatrix = restMatrix ?? this._localMatrix.clone();\r\n this._bindMatrix = bindMatrix ?? this._localMatrix.clone();\r\n this._index = index;\r\n\r\n this._absoluteMatrix = new Matrix();\r\n this._absoluteBindMatrix = new Matrix();\r\n this._absoluteInverseBindMatrix = new Matrix();\r\n this._finalMatrix = new Matrix();\r\n\r\n skeleton.bones.push(this);\r\n\r\n this.setParent(parentBone, false);\r\n\r\n this._updateAbsoluteBindMatrices();\r\n }\r\n\r\n /**\r\n * Gets the current object class name.\r\n * @returns the class name\r\n */\r\n public override getClassName(): string {\r\n return \"Bone\";\r\n }\r\n\r\n // Members\r\n\r\n /**\r\n * Gets the parent skeleton\r\n * @returns a skeleton\r\n */\r\n public getSkeleton(): Skeleton {\r\n return this._skeleton;\r\n }\r\n\r\n public override get parent(): Bone {\r\n return this._parentNode as Bone;\r\n }\r\n\r\n /**\r\n * Gets parent bone\r\n * @returns a bone or null if the bone is the root of the bone hierarchy\r\n */\r\n public getParent(): Nullable<Bone> {\r\n return this.parent;\r\n }\r\n\r\n /**\r\n * Returns an array containing the children of the bone\r\n * @returns an array containing the children of the bone (can be empty if the bone has no children)\r\n */\r\n public override getChildren(): Array<Bone> {\r\n return this.children;\r\n }\r\n\r\n /**\r\n * Gets the node index in matrix array generated for rendering\r\n * @returns the node index\r\n */\r\n public getIndex(): number {\r\n return this._index === null ? this.getSkeleton().bones.indexOf(this) : this._index;\r\n }\r\n\r\n public override set parent(newParent: Nullable<Bone>) {\r\n this.setParent(newParent);\r\n }\r\n\r\n /**\r\n * Sets the parent bone\r\n * @param parent defines the parent (can be null if the bone is the root)\r\n * @param updateAbsoluteBindMatrices defines if the absolute bind and absolute inverse bind matrices must be updated\r\n */\r\n public setParent(parent: Nullable<Bone>, updateAbsoluteBindMatrices: boolean = true): void {\r\n if (this.parent === parent) {\r\n return;\r\n }\r\n\r\n if (this.parent) {\r\n const index = this.parent.children.indexOf(this);\r\n if (index !== -1) {\r\n this.parent.children.splice(index, 1);\r\n }\r\n }\r\n\r\n this._parentNode = parent;\r\n\r\n if (this.parent) {\r\n this.parent.children.push(this);\r\n }\r\n\r\n if (updateAbsoluteBindMatrices) {\r\n this._updateAbsoluteBindMatrices();\r\n }\r\n\r\n this.markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets the local matrix\r\n * @returns the local matrix\r\n */\r\n public getLocalMatrix(): Matrix {\r\n this._compose();\r\n return this._localMatrix;\r\n }\r\n\r\n /**\r\n * Gets the bind matrix\r\n * @returns the bind matrix\r\n */\r\n public getBindMatrix(): Matrix {\r\n return this._bindMatrix;\r\n }\r\n\r\n /**\r\n * Gets the bind matrix.\r\n * @returns the bind matrix\r\n * @deprecated Please use getBindMatrix instead\r\n */\r\n public getBaseMatrix(): Matrix {\r\n return this.getBindMatrix();\r\n }\r\n\r\n /**\r\n * Gets the rest matrix\r\n * @returns the rest matrix\r\n */\r\n public getRestMatrix(): Matrix {\r\n return this._restMatrix;\r\n }\r\n\r\n /**\r\n * Gets the rest matrix\r\n * @returns the rest matrix\r\n * @deprecated Please use getRestMatrix instead\r\n */\r\n public getRestPose(): Matrix {\r\n return this.getRestMatrix();\r\n }\r\n\r\n /**\r\n * Sets the rest matrix\r\n * @param matrix the local-space rest matrix to set for this bone\r\n */\r\n public setRestMatrix(matrix: Matrix): void {\r\n this._restMatrix.copyFrom(matrix);\r\n }\r\n\r\n /**\r\n * Sets the rest matrix\r\n * @param matrix the local-space rest to set for this bone\r\n * @deprecated Please use setRestMatrix instead\r\n */\r\n public setRestPose(matrix: Matrix): void {\r\n this.setRestMatrix(matrix);\r\n }\r\n\r\n /**\r\n * Gets the bind matrix\r\n * @returns the bind matrix\r\n * @deprecated Please use getBindMatrix instead\r\n */\r\n public getBindPose(): Matrix {\r\n return this.getBindMatrix();\r\n }\r\n\r\n /**\r\n * Sets the bind matrix\r\n * This will trigger a recomputation of the absolute bind and absolute inverse bind matrices for this bone and its children\r\n * Note that the local matrix will also be set with the matrix passed in parameter!\r\n * @param matrix the local-space bind matrix to set for this bone\r\n */\r\n public setBindMatrix(matrix: Matrix): void {\r\n this.updateMatrix(matrix);\r\n }\r\n\r\n /**\r\n * Sets the bind matrix\r\n * @param matrix the local-space bind to set for this bone\r\n * @deprecated Please use setBindMatrix instead\r\n */\r\n public setBindPose(matrix: Matrix): void {\r\n this.setBindMatrix(matrix);\r\n }\r\n\r\n /**\r\n * Gets the matrix used to store the final world transformation of the bone (ie. the matrix sent to shaders)\r\n * @returns the final world matrix\r\n */\r\n public getFinalMatrix(): Matrix {\r\n return this._finalMatrix;\r\n }\r\n\r\n /**\r\n * Gets the matrix used to store the final world transformation of the bone (ie. the matrix sent to shaders)\r\n * @deprecated Please use getFinalMatrix instead\r\n * @returns the final world matrix\r\n */\r\n public override getWorldMatrix(): Matrix {\r\n return this.getFinalMatrix();\r\n }\r\n\r\n /**\r\n * Sets the local matrix to the rest matrix\r\n */\r\n public returnToRest(): void {\r\n if (this._linkedTransformNode) {\r\n const localScaling = TmpVectors.Vector3[0];\r\n const localRotation = TmpVectors.Quaternion[0];\r\n const localPosition = TmpVectors.Vector3[1];\r\n\r\n this.getRestMatrix().decompose(localScaling, localRotation, localPosition);\r\n\r\n this._linkedTransformNode.position.copyFrom(localPosition);\r\n this._linkedTransformNode.rotationQuaternion = this._linkedTransformNode.rotationQuaternion ?? Quaternion.Identity();\r\n this._linkedTransformNode.rotationQuaternion.copyFrom(localRotation);\r\n this._linkedTransformNode.scaling.copyFrom(localScaling);\r\n } else {\r\n this._matrix = this._restMatrix;\r\n }\r\n }\r\n\r\n /**\r\n * Gets the inverse of the bind matrix, in world space (relative to the skeleton root)\r\n * @returns the inverse bind matrix, in world space\r\n */\r\n public getAbsoluteInverseBindMatrix(): Matrix {\r\n return this._absoluteInverseBindMatrix;\r\n }\r\n\r\n /**\r\n * Gets the inverse of the bind matrix, in world space (relative to the skeleton root)\r\n * @returns the inverse bind matrix, in world space\r\n * @deprecated Please use getAbsoluteInverseBindMatrix instead\r\n */\r\n public getInvertedAbsoluteTransform(): Matrix {\r\n return this.getAbsoluteInverseBindMatrix();\r\n }\r\n\r\n /**\r\n * Gets the bone matrix, in world space (relative to the skeleton root)\r\n * @returns the bone matrix, in world space\r\n */\r\n public getAbsoluteMatrix(): Matrix {\r\n return this._absoluteMatrix;\r\n }\r\n\r\n /**\r\n * Gets the bone matrix, in world space (relative to the skeleton root)\r\n * @returns the bone matrix, in world space\r\n * @deprecated Please use getAbsoluteMatrix instead\r\n */\r\n public getAbsoluteTransform(): Matrix {\r\n return this._absoluteMatrix;\r\n }\r\n\r\n /**\r\n * Links with the given transform node.\r\n * The local matrix of this bone is overwritten by the transform of the node every frame.\r\n * @param transformNode defines the transform node to link to\r\n */\r\n public linkTransformNode(transformNode: Nullable<TransformNode>): void {\r\n if (this._linkedTransformNode) {\r\n this._skeleton._numBonesWithLinkedTransformNode--;\r\n }\r\n\r\n this._linkedTransformNode = transformNode;\r\n\r\n if (this._linkedTransformNode) {\r\n this._skeleton._numBonesWithLinkedTransformNode++;\r\n }\r\n }\r\n\r\n // Properties (matches TransformNode properties)\r\n\r\n /**\r\n * Gets the node used to drive the bone's transformation\r\n * @returns a transform node or null\r\n */\r\n public getTransformNode() {\r\n return this._linkedTransformNode;\r\n }\r\n\r\n /** Gets or sets current position (in local space) */\r\n public get position(): Vector3 {\r\n this._decompose();\r\n return this._localPosition;\r\n }\r\n\r\n public set position(newPosition: Vector3) {\r\n this._decompose();\r\n this._localPosition.copyFrom(newPosition);\r\n\r\n this._markAsDirtyAndCompose();\r\n }\r\n\r\n /** Gets or sets current rotation (in local space) */\r\n public get rotation(): Vector3 {\r\n return this.getRotation();\r\n }\r\n\r\n public set rotation(newRotation: Vector3) {\r\n this.setRotation(newRotation);\r\n }\r\n\r\n /** Gets or sets current rotation quaternion (in local space) */\r\n public get rotationQuaternion() {\r\n this._decompose();\r\n return this._localRotation;\r\n }\r\n\r\n public set rotationQuaternion(newRotation: Quaternion) {\r\n this.setRotationQuaternion(newRotation);\r\n }\r\n\r\n /** Gets or sets current scaling (in local space) */\r\n public get scaling(): Vector3 {\r\n return this.getScale();\r\n }\r\n\r\n public set scaling(newScaling: Vector3) {\r\n this.setScale(newScaling);\r\n }\r\n\r\n /**\r\n * Gets the animation properties override\r\n */\r\n public override get animationPropertiesOverride(): Nullable<AnimationPropertiesOverride> {\r\n return this._skeleton.animationPropertiesOverride;\r\n }\r\n\r\n // Methods\r\n private _decompose() {\r\n if (!this._needToDecompose) {\r\n return;\r\n }\r\n\r\n this._needToDecompose = false;\r\n\r\n if (!this._localScaling) {\r\n this._localScaling = Vector3.Zero();\r\n this._localRotation = Quaternion.Zero();\r\n this._localPosition = Vector3.Zero();\r\n }\r\n this._localMatrix.decompose(this._localScaling, this._localRotation, this._localPosition);\r\n }\r\n\r\n private _compose() {\r\n if (!this._needToCompose) {\r\n return;\r\n }\r\n\r\n if (!this._localScaling) {\r\n this._needToCompose = false;\r\n return;\r\n }\r\n\r\n this._needToCompose = false;\r\n Matrix.ComposeToRef(this._localScaling, this._localRotation, this._localPosition, this._localMatrix);\r\n }\r\n\r\n /**\r\n * Update the bind (and optionally the local) matrix\r\n * @param bindMatrix defines the new matrix to set to the bind/local matrix, in local space\r\n * @param updateAbsoluteBindMatrices defines if the absolute bind and absolute inverse bind matrices must be recomputed (default: true)\r\n * @param updateLocalMatrix defines if the local matrix should also be updated with the matrix passed in parameter (default: true)\r\n */\r\n public updateMatrix(bindMatrix: Matrix, updateAbsoluteBindMatrices = true, updateLocalMatrix = true): void {\r\n this._bindMatrix.copyFrom(bindMatrix);\r\n\r\n if (updateAbsoluteBindMatrices) {\r\n this._updateAbsoluteBindMatrices();\r\n }\r\n\r\n if (updateLocalMatrix) {\r\n this._matrix = bindMatrix;\r\n } else {\r\n this.markAsDirty();\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _updateAbsoluteBindMatrices(bindMatrix?: Matrix, updateChildren = true): void {\r\n if (!bindMatrix) {\r\n bindMatrix = this._bindMatrix;\r\n }\r\n\r\n if (this.parent) {\r\n bindMatrix.multiplyToRef(this.parent._absoluteBindMatrix, this._absoluteBindMatrix);\r\n } else {\r\n this._absoluteBindMatrix.copyFrom(bindMatrix);\r\n }\r\n\r\n this._absoluteBindMatrix.invertToRef(this._absoluteInverseBindMatrix);\r\n\r\n if (updateChildren) {\r\n for (let index = 0; index < this.children.length; index++) {\r\n this.children[index]._updateAbsoluteBindMatrices();\r\n }\r\n }\r\n\r\n this._scalingDeterminant = this._absoluteBindMatrix.determinant() < 0 ? -1 : 1;\r\n }\r\n\r\n /**\r\n * Flag the bone as dirty (Forcing it to update everything)\r\n * @returns this bone\r\n */\r\n public override markAsDirty(): Bone {\r\n this._currentRenderId++;\r\n this._childUpdateId++;\r\n this._skeleton._markAsDirty();\r\n return this;\r\n }\r\n\r\n /** @internal */\r\n public _markAsDirtyAndCompose() {\r\n this.markAsDirty();\r\n this._needToCompose = true;\r\n }\r\n\r\n private _markAsDirtyAndDecompose() {\r\n this.markAsDirty();\r\n this._needToDecompose = true;\r\n }\r\n\r\n private _updatePosition(vec: Vector3, space = Space.LOCAL, tNode?: TransformNode, translationMode = true): void {\r\n const lm = this.getLocalMatrix();\r\n\r\n if (space == Space.LOCAL) {\r\n if (translationMode) {\r\n lm.addAtIndex(12, vec.x);\r\n lm.addAtIndex(13, vec.y);\r\n lm.addAtIndex(14, vec.z);\r\n } else {\r\n lm.setTranslationFromFloats(vec.x, vec.y, vec.z);\r\n }\r\n } else {\r\n let wm: Nullable<Matrix> = null;\r\n\r\n //tNode.getWorldMatrix() needs to be called before skeleton.computeAbsoluteMatrices()\r\n if (tNode) {\r\n wm = tNode.getWorldMatrix();\r\n }\r\n\r\n this._skeleton.computeAbsoluteMatrices();\r\n\r\n const tmat = Bone._TmpMats[0];\r\n const tvec = Bone._TmpVecs[0];\r\n\r\n if (this.parent) {\r\n if (tNode && wm) {\r\n tmat.copyFrom(this.parent.getAbsoluteMatrix());\r\n tmat.multiplyToRef(wm, tmat);\r\n } else {\r\n tmat.copyFrom(this.parent.getAbsoluteMatrix());\r\n }\r\n } else {\r\n Matrix.IdentityToRef(tmat);\r\n }\r\n\r\n if (translationMode) {\r\n tmat.setTranslationFromFloats(0, 0, 0);\r\n }\r\n tmat.invert();\r\n Vector3.TransformCoordinatesToRef(vec, tmat, tvec);\r\n\r\n if (translationMode) {\r\n lm.addAtIndex(12, tvec.x);\r\n lm.addAtIndex(13, tvec.y);\r\n lm.addAtIndex(14, tvec.z);\r\n } else {\r\n lm.setTranslationFromFloats(tvec.x, tvec.y, tvec.z);\r\n }\r\n }\r\n\r\n this._markAsDirtyAndDecompose();\r\n }\r\n\r\n /**\r\n * Translate the bone in local or world space\r\n * @param vec The amount to translate the bone\r\n * @param space The space that the translation is in (default: Space.LOCAL)\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n */\r\n public translate(vec: Vector3, space = Space.LOCAL, tNode?: TransformNode): void {\r\n this._updatePosition(vec, space, tNode, true);\r\n }\r\n\r\n /**\r\n * Set the position of the bone in local or world space\r\n * @param position The position to set the bone\r\n * @param space The space that the position is in (default: Space.LOCAL)\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n */\r\n public setPosition(position: Vector3, space = Space.LOCAL, tNode?: TransformNode): void {\r\n this._updatePosition(position, space, tNode, false);\r\n }\r\n\r\n /**\r\n * Set the absolute position of the bone (world space)\r\n * @param position The position to set the bone\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n */\r\n public setAbsolutePosition(position: Vector3, tNode?: TransformNode) {\r\n this.setPosition(position, Space.WORLD, tNode);\r\n }\r\n\r\n /**\r\n * Scale the bone on the x, y and z axes (in local space)\r\n * @param x The amount to scale the bone on the x axis\r\n * @param y The amount to scale the bone on the y axis\r\n * @param z The amount to scale the bone on the z axis\r\n * @param scaleChildren sets this to true if children of the bone should be scaled as well (false by default)\r\n */\r\n public scale(x: number, y: number, z: number, scaleChildren = false): void {\r\n const locMat = this.getLocalMatrix();\r\n\r\n // Apply new scaling on top of current local matrix\r\n const scaleMat = Bone._TmpMats[0];\r\n Matrix.ScalingToRef(x, y, z, scaleMat);\r\n scaleMat.multiplyToRef(locMat, locMat);\r\n\r\n // Invert scaling matrix and apply the inverse to all children\r\n scaleMat.invert();\r\n\r\n for (const child of this.children) {\r\n const cm = child.getLocalMatrix();\r\n cm.multiplyToRef(scaleMat, cm);\r\n cm.multiplyAtIndex(12, x);\r\n cm.multiplyAtIndex(13, y);\r\n cm.multiplyAtIndex(14, z);\r\n\r\n child._markAsDirtyAndDecompose();\r\n }\r\n\r\n this._markAsDirtyAndDecompose();\r\n\r\n if (scaleChildren) {\r\n for (const child of this.children) {\r\n child.scale(x, y, z, scaleChildren);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Set the bone scaling in local space\r\n * @param scale defines the scaling vector\r\n */\r\n public setScale(scale: Vector3): void {\r\n this._decompose();\r\n this._localScaling.copyFrom(scale);\r\n this._markAsDirtyAndCompose();\r\n }\r\n\r\n /**\r\n * Gets the current scaling in local space\r\n * @returns the current scaling vector\r\n */\r\n public getScale(): Vector3 {\r\n this._decompose();\r\n return this._localScaling;\r\n }\r\n\r\n /**\r\n * Gets the current scaling in local space and stores it in a target vector\r\n * @param result defines the target vector\r\n */\r\n public getScaleToRef(result: Vector3) {\r\n this._decompose();\r\n result.copyFrom(this._localScaling);\r\n }\r\n\r\n /**\r\n * Set the yaw, pitch, and roll of the bone in local or world space\r\n * @param yaw The rotation of the bone on the y axis\r\n * @param pitch The rotation of the bone on the x axis\r\n * @param roll The rotation of the bone on the z axis\r\n * @param space The space that the axes of rotation are in\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n */\r\n public setYawPitchRoll(yaw: number, pitch: number, roll: number, space = Space.LOCAL, tNode?: TransformNode): void {\r\n if (space === Space.LOCAL) {\r\n const quat = Bone._TmpQuat;\r\n Quaternion.RotationYawPitchRollToRef(yaw, pitch, roll, quat);\r\n this.setRotationQuaternion(quat, space, tNode);\r\n return;\r\n }\r\n\r\n const rotMatInv = Bone._TmpMats[0];\r\n if (!this._getAbsoluteInverseMatrixUnscaledToRef(rotMatInv, tNode)) {\r\n return;\r\n }\r\n\r\n const rotMat = Bone._TmpMats[1];\r\n Matrix.RotationYawPitchRollToRef(yaw, pitch, roll, rotMat);\r\n\r\n rotMatInv.multiplyToRef(rotMat, rotMat);\r\n this._rotateWithMatrix(rotMat, space, tNode);\r\n }\r\n\r\n /**\r\n * Add a rotation to the bone on an axis in local or world space\r\n * @param axis The axis to rotate the bone on\r\n * @param amount The amount to rotate the bone\r\n * @param space The space that the axis is in\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n */\r\n public rotate(axis: Vector3, amount: number, space = Space.LOCAL, tNode?: TransformNode): void {\r\n const rmat = Bone._TmpMats[0];\r\n rmat.setTranslationFromFloats(0, 0, 0);\r\n Matrix.RotationAxisToRef(axis, amount, rmat);\r\n this._rotateWithMatrix(rmat, space, tNode);\r\n }\r\n\r\n /**\r\n * Set the rotation of the bone to a particular axis angle in local or world space\r\n * @param axis The axis to rotate the bone on\r\n * @param angle The angle that the bone should be rotated to\r\n * @param space The space that the axis is in\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n */\r\n public setAxisAngle(axis: Vector3, angle: number, space = Space.LOCAL, tNode?: TransformNode): void {\r\n if (space === Space.LOCAL) {\r\n const quat = Bone._TmpQuat;\r\n Quaternion.RotationAxisToRef(axis, angle, quat);\r\n\r\n this.setRotationQuaternion(quat, space, tNode);\r\n return;\r\n }\r\n\r\n const rotMatInv = Bone._TmpMats[0];\r\n if (!this._getAbsoluteInverseMatrixUnscaledToRef(rotMatInv, tNode)) {\r\n return;\r\n }\r\n\r\n const rotMat = Bone._TmpMats[1];\r\n Matrix.RotationAxisToRef(axis, angle, rotMat);\r\n\r\n rotMatInv.multiplyToRef(rotMat, rotMat);\r\n this._rotateWithMatrix(rotMat, space, tNode);\r\n }\r\n\r\n /**\r\n * Set the euler rotation of the bone in local or world space\r\n * @param rotation The euler rotation that the bone should be set to\r\n * @param space The space that the rotation is in\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n */\r\n public setRotation(rotation: Vector3, space = Space.LOCAL, tNode?: TransformNode): void {\r\n this.setYawPitchRoll(rotation.y, rotation.x, rotation.z, space, tNode);\r\n }\r\n\r\n /**\r\n * Set the quaternion rotation of the bone in local or world space\r\n * @param quat The quaternion rotation that the bone should be set to\r\n * @param space The space that the rotation is in\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n */\r\n public setRotationQuaternion(quat: Quaternion, space = Space.LOCAL, tNode?: TransformNode): void {\r\n if (space === Space.LOCAL) {\r\n this._decompose();\r\n this._localRotation.copyFrom(quat);\r\n\r\n this._markAsDirtyAndCompose();\r\n\r\n return;\r\n }\r\n\r\n const rotMatInv = Bone._TmpMats[0];\r\n if (!this._getAbsoluteInverseMatrixUnscaledToRef(rotMatInv, tNode)) {\r\n return;\r\n }\r\n\r\n const rotMat = Bone._TmpMats[1];\r\n Matrix.FromQuaternionToRef(quat, rotMat);\r\n\r\n rotMatInv.multiplyToRef(rotMat, rotMat);\r\n\r\n this._rotateWithMatrix(rotMat, space, tNode);\r\n }\r\n\r\n /**\r\n * Set the rotation matrix of the bone in local or world space\r\n * @param rotMat The rotation matrix that the bone should be set to\r\n * @param space The space that the rotation is in\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n */\r\n public setRotationMatrix(rotMat: Matrix, space = Space.LOCAL, tNode?: TransformNode): void {\r\n if (space === Space.LOCAL) {\r\n const quat = Bone._TmpQuat;\r\n Quaternion.FromRotationMatrixToRef(rotMat, quat);\r\n this.setRotationQuaternion(quat, space, tNode);\r\n return;\r\n }\r\n\r\n const rotMatInv = Bone._TmpMats[0];\r\n if (!this._getAbsoluteInverseMatrixUnscaledToRef(rotMatInv, tNode)) {\r\n return;\r\n }\r\n\r\n const rotMat2 = Bone._TmpMats[1];\r\n rotMat2.copyFrom(rotMat);\r\n\r\n rotMatInv.multiplyToRef(rotMat, rotMat2);\r\n\r\n this._rotateWithMatrix(rotMat2, space, tNode);\r\n }\r\n\r\n private _rotateWithMatrix(rmat: Matrix, space = Space.LOCAL, tNode?: TransformNode): void {\r\n const lmat = this.getLocalMatrix();\r\n const lx = lmat.m[12];\r\n const ly = lmat.m[13];\r\n const lz = lmat.m[14];\r\n const parent = this.getParent();\r\n const parentScale = Bone._TmpMats[3];\r\n const parentScaleInv = Bone._TmpMats[4];\r\n\r\n if (parent && space == Space.WORLD) {\r\n if (tNode) {\r\n parentScale.copyFrom(tNode.getWorldMatrix());\r\n parent.getAbsoluteMatrix().multiplyToRef(parentScale, parentScale);\r\n } else {\r\n parentScale.copyFrom(parent.getAbsoluteMatrix());\r\n }\r\n parentScaleInv.copyFrom(parentScale);\r\n parentScaleInv.invert();\r\n lmat.multiplyToRef(parentScale, lmat);\r\n lmat.multiplyToRef(rmat, lmat);\r\n lmat.multiplyToRef(parentScaleInv, lmat);\r\n } else {\r\n if (space == Space.WORLD && tNode) {\r\n parentScale.copyFrom(tNode.getWorldMatrix());\r\n parentScaleInv.copyFrom(parentScale);\r\n parentScaleInv.invert();\r\n lmat.multiplyToRef(parentScale, lmat);\r\n lmat.multiplyToRef(rmat, lmat);\r\n lmat.multiplyToRef(parentScaleInv, lmat);\r\n } else {\r\n lmat.multiplyToRef(rmat, lmat);\r\n }\r\n }\r\n\r\n lmat.setTranslationFromFloats(lx, ly, lz);\r\n\r\n this.computeAbsoluteMatrices();\r\n this._markAsDirtyAndDecompose();\r\n }\r\n\r\n private _getAbsoluteInverseMatrixUnscaledToRef(rotMatInv: Matrix, tNode?: TransformNode): boolean {\r\n const scaleMatrix = Bone._TmpMats[2];\r\n rotMatInv.copyFrom(this.getAbsoluteMatrix());\r\n\r\n if (tNode) {\r\n rotMatInv.multiplyToRef(tNode.getWorldMatrix(), rotMatInv);\r\n Matrix.ScalingToRef(tNode.scaling.x, tNode.scaling.y, tNode.scaling.z, scaleMatrix);\r\n } else {\r\n Matrix.IdentityToRef(scaleMatrix);\r\n }\r\n\r\n rotMatInv.invert();\r\n if (isNaN(rotMatInv.m[0])) {\r\n // Matrix failed to invert.\r\n // This can happen if scale is zero for example.\r\n return false;\r\n }\r\n\r\n scaleMatrix.multiplyAtIndex(0, this._scalingDeterminant);\r\n rotMatInv.multiplyToRef(scaleMatrix, rotMatInv);\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * Get the position of the bone in local or world space\r\n * @param space The space that the returned position is in\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n * @returns The position of the bone\r\n */\r\n public getPosition(space = Space.LOCAL, tNode: Nullable<TransformNode> = null): Vector3 {\r\n const pos = Vector3.Zero();\r\n\r\n this.getPositionToRef(space, tNode, pos);\r\n\r\n return pos;\r\n }\r\n\r\n /**\r\n * Copy the position of the bone to a vector3 in local or world space\r\n * @param space The space that the returned position is in\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n * @param result The vector3 to copy the position to\r\n */\r\n public getPositionToRef(space = Space.LOCAL, tNode: Nullable<TransformNode>, result: Vector3): void {\r\n if (space == Space.LOCAL) {\r\n const lm = this.getLocalMatrix();\r\n\r\n result.x = lm.m[12];\r\n result.y = lm.m[13];\r\n result.z = lm.m[14];\r\n } else {\r\n let wm: Nullable<Matrix> = null;\r\n\r\n //tNode.getWorldMatrix() needs to be called before skeleton.computeAbsoluteMatrices()\r\n if (tNode) {\r\n wm = tNode.getWorldMatrix();\r\n }\r\n\r\n this._skeleton.computeAbsoluteMatrices();\r\n\r\n let tmat = Bone._TmpMats[0];\r\n\r\n if (tNode && wm) {\r\n tmat.copyFrom(this.getAbsoluteMatrix());\r\n tmat.multiplyToRef(wm, tmat);\r\n } else {\r\n tmat = this.getAbsoluteMatrix();\r\n }\r\n\r\n result.x = tmat.m[12];\r\n result.y = tmat.m[13];\r\n result.z = tmat.m[14];\r\n }\r\n }\r\n\r\n /**\r\n * Get the absolute position of the bone (world space)\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n * @returns The absolute position of the bone\r\n */\r\n public getAbsolutePosition(tNode: Nullable<TransformNode> = null): Vector3 {\r\n const pos = Vector3.Zero();\r\n\r\n this.getPositionToRef(Space.WORLD, tNode, pos);\r\n\r\n return pos;\r\n }\r\n\r\n /**\r\n * Copy the absolute position of the bone (world space) to the result param\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n * @param result The vector3 to copy the absolute position to\r\n */\r\n public getAbsolutePositionToRef(tNode: TransformNode, result: Vector3) {\r\n this.getPositionToRef(Space.WORLD, tNode, result);\r\n }\r\n\r\n /**\r\n * Compute the absolute matrices of this bone and its children\r\n */\r\n public computeAbsoluteMatrices(): void {\r\n this._compose();\r\n\r\n if (this.parent) {\r\n this._localMatrix.multiplyToRef(this.parent._absoluteMatrix, this._absoluteMatrix);\r\n } else {\r\n this._absoluteMatrix.copyFrom(this._localMatrix);\r\n\r\n const poseMatrix = this._skeleton.getPoseMatrix();\r\n\r\n if (poseMatrix) {\r\n this._absoluteMatrix.multiplyToRef(poseMatrix, this._absoluteMatrix);\r\n }\r\n }\r\n\r\n const children = this.children;\r\n const len = children.length;\r\n\r\n for (let i = 0; i < len; i++) {\r\n children[i].computeAbsoluteMatrices();\r\n }\r\n }\r\n\r\n /**\r\n * Compute the absolute matrices of this bone and its children\r\n * @deprecated Please use computeAbsoluteMatrices instead\r\n */\r\n public computeAbsoluteTransforms(): void {\r\n this.computeAbsoluteMatrices();\r\n }\r\n\r\n /**\r\n * Get the world direction from an axis that is in the local space of the bone\r\n * @param localAxis The local direction that is used to compute the world direction\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n * @returns The world direction\r\n */\r\n public getDirection(localAxis: Vector3, tNode: Nullable<TransformNode> = null): Vector3 {\r\n const result = Vector3.Zero();\r\n\r\n this.getDirectionToRef(localAxis, tNode, result);\r\n\r\n return result;\r\n }\r\n\r\n /**\r\n * Copy the world direction to a vector3 from an axis that is in the local space of the bone\r\n * @param localAxis The local direction that is used to compute the world direction\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n * @param result The vector3 that the world direction will be copied to\r\n */\r\n public getDirectionToRef(localAxis: Vector3, tNode: Nullable<TransformNode> = null, result: Vector3): void {\r\n let wm: Nullable<Matrix> = null;\r\n\r\n //tNode.getWorldMatrix() needs to be called before skeleton.computeAbsoluteMatrices()\r\n if (tNode) {\r\n wm = tNode.getWorldMatrix();\r\n }\r\n\r\n this._skeleton.computeAbsoluteMatrices();\r\n\r\n const mat = Bone._TmpMats[0];\r\n\r\n mat.copyFrom(this.getAbsoluteMatrix());\r\n\r\n if (tNode && wm) {\r\n mat.multiplyToRef(wm, mat);\r\n }\r\n\r\n Vector3.TransformNormalToRef(localAxis, mat, result);\r\n\r\n result.normalize();\r\n }\r\n\r\n /**\r\n * Get the euler rotation of the bone in local or world space\r\n * @param space The space that the rotation should be in\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n * @returns The euler rotation\r\n */\r\n public getRotation(space = Space.LOCAL, tNode: Nullable<TransformNode> = null): Vector3 {\r\n const result = Vector3.Zero();\r\n\r\n this.getRotationToRef(space, tNode, result);\r\n\r\n return result;\r\n }\r\n\r\n /**\r\n * Copy the euler rotation of the bone to a vector3. The rotation can be in either local or world space\r\n * @param space The space that the rotation should be in\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n * @param result The vector3 that the rotation should be copied to\r\n */\r\n public getRotationToRef(space = Space.LOCAL, tNode: Nullable<TransformNode> = null, result: Vector3): void {\r\n const quat = Bone._TmpQuat;\r\n\r\n this.getRotationQuaternionToRef(space, tNode, quat);\r\n\r\n quat.toEulerAnglesToRef(result);\r\n }\r\n\r\n /**\r\n * Get the quaternion rotation of the bone in either local or world space\r\n * @param space The space that the rotation should be in\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n * @returns The quaternion rotation\r\n */\r\n public getRotationQuaternion(space = Space.LOCAL, tNode: Nullable<TransformNode> = null): Quaternion {\r\n const result = Quaternion.Identity();\r\n\r\n this.getRotationQuaternionToRef(space, tNode, result);\r\n\r\n return result;\r\n }\r\n\r\n /**\r\n * Copy the quaternion rotation of the bone to a quaternion. The rotation can be in either local or world space\r\n * @param space The space that the rotation should be in\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n * @param result The quaternion that the rotation should be copied to\r\n */\r\n public getRotationQuaternionToRef(space = Space.LOCAL, tNode: Nullable<TransformNode> = null, result: Quaternion): void {\r\n if (space == Space.LOCAL) {\r\n this._decompose();\r\n result.copyFrom(this._localRotation);\r\n } else {\r\n const mat = Bone._TmpMats[0];\r\n const amat = this.getAbsoluteMatrix();\r\n\r\n if (tNode) {\r\n amat.multiplyToRef(tNode.getWorldMatrix(), mat);\r\n } else {\r\n mat.copyFrom(amat);\r\n }\r\n\r\n mat.multiplyAtIndex(0, this._scalingDeterminant);\r\n mat.multiplyAtIndex(1, this._scalingDeterminant);\r\n mat.multiplyAtIndex(2, this._scalingDeterminant);\r\n\r\n mat.decompose(undefined, result, undefined);\r\n }\r\n }\r\n\r\n /**\r\n * Get the rotation matrix of the bone in local or world space\r\n * @param space The space that the rotation should be in\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n * @returns The rotation matrix\r\n */\r\n public getRotationMatrix(space = Space.LOCAL, tNode: TransformNode): Matrix {\r\n const result = Matrix.Identity();\r\n\r\n this.getRotationMatrixToRef(space, tNode, result);\r\n\r\n return result;\r\n }\r\n\r\n /**\r\n * Copy the rotation matrix of the bone to a matrix. The rotation can be in either local or world space\r\n * @param space The space that the rotation should be in\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n * @param result The quaternion that the rotation should be copied to\r\n */\r\n public getRotationMatrixToRef(space = Space.LOCAL, tNode: TransformNode, result: Matrix): void {\r\n if (space == Space.LOCAL) {\r\n this.getLocalMatrix().getRotationMatrixToRef(result);\r\n } else {\r\n const mat = Bone._TmpMats[0];\r\n const amat = this.getAbsoluteMatrix();\r\n\r\n if (tNode) {\r\n amat.multiplyToRef(tNode.getWorldMatrix(), mat);\r\n } else {\r\n mat.copyFrom(amat);\r\n }\r\n\r\n mat.multiplyAtIndex(0, this._scalingDeterminant);\r\n mat.multiplyAtIndex(1, this._scalingDeterminant);\r\n mat.multiplyAtIndex(2, this._scalingDeterminant);\r\n\r\n mat.getRotationMatrixToRef(result);\r\n }\r\n }\r\n\r\n /**\r\n * Get the world position of a point that is in the local space of the bone\r\n * @param position The local position\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n * @returns The world position\r\n */\r\n public getAbsolutePositionFromLocal(position: Vector3, tNode: Nullable<TransformNode> = null): Vector3 {\r\n const result = Vector3.Zero();\r\n\r\n this.getAbsolutePositionFromLocalToRef(position, tNode, result);\r\n\r\n return result;\r\n }\r\n\r\n /**\r\n * Get the world position of a point that is in the local space of the bone and copy it to the result param\r\n * @param position The local position\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n * @param result The vector3 that the world position should be copied to\r\n */\r\n public getAbsolutePositionFromLocalToRef(position: Vector3, tNode: Nullable<TransformNode> = null, result: Vector3): void {\r\n let wm: Nullable<Matrix> = null;\r\n\r\n //tNode.getWorldMatrix() needs to be called before skeleton.computeAbsoluteMatrices()\r\n if (tNode) {\r\n wm = tNode.getWorldMatrix();\r\n }\r\n\r\n this._skeleton.computeAbsoluteMatrices();\r\n\r\n const tmat = Bone._TmpMats[0];\r\n\r\n tmat.copyFrom(this.getAbsoluteMatrix());\r\n\r\n if (tNode && wm) {\r\n tmat.multiplyToRef(wm, tmat);\r\n }\r\n\r\n Vector3.TransformCoordinatesToRef(position, tmat, result);\r\n }\r\n\r\n /**\r\n * Get the local position of a point that is in world space\r\n * @param position The world position\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n * @returns The local position\r\n */\r\n public getLocalPositionFromAbsolute(position: Vector3, tNode: Nullable<TransformNode> = null): Vector3 {\r\n const result = Vector3.Zero();\r\n\r\n this.getLocalPositionFromAbsoluteToRef(position, tNode, result);\r\n\r\n return result;\r\n }\r\n\r\n /**\r\n * Get the local position of a point that is in world space and copy it to the result param\r\n * @param position The world position\r\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\r\n * @param result The vector3 that the local position should be copied to\r\n */\r\n public getLocalPositionFromAbsoluteToRef(position: Vector3, tNode: Nullable<TransformNode> = null, result: Vector3): void {\r\n let wm: Nullable<Matrix> = null;\r\n\r\n //tNode.getWorldMatrix() needs to be called before skeleton.computeAbsoluteMatrices()\r\n if (tNode) {\r\n wm = tNode.getWorldMatrix();\r\n }\r\n\r\n this._skeleton.computeAbsoluteMatrices();\r\n\r\n const tmat = Bone._TmpMats[0];\r\n\r\n tmat.copyFrom(this.getAbsoluteMatrix());\r\n\r\n if (tNode && wm) {\r\n tmat.multiplyToRef(wm, tmat);\r\n }\r\n\r\n tmat.invert();\r\n\r\n Vector3.TransformCoordinatesToRef(position, tmat, result);\r\n }\r\n\r\n /**\r\n * Set the current local matrix as the restMatrix for this bone.\r\n */\r\n public setCurrentPoseAsRest(): void {\r\n this.setRestMatrix(this.getLocalMatrix());\r\n }\r\n}\r\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BuildArray } from "../Misc/arrayTools.js";
|
|
2
2
|
import { Vector3, Quaternion, Matrix } from "../Maths/math.vector.js";
|
|
3
3
|
import { Axis } from "../Maths/math.axis.js";
|
|
4
4
|
/**
|
|
@@ -466,7 +466,7 @@ export class BoneLookController {
|
|
|
466
466
|
}
|
|
467
467
|
}
|
|
468
468
|
}
|
|
469
|
-
BoneLookController._TmpVecs =
|
|
469
|
+
BoneLookController._TmpVecs = BuildArray(10, Vector3.Zero);
|
|
470
470
|
BoneLookController._TmpQuat = Quaternion.Identity();
|
|
471
|
-
BoneLookController._TmpMats =
|
|
471
|
+
BoneLookController._TmpMats = BuildArray(5, Matrix.Identity);
|
|
472
472
|
//# sourceMappingURL=boneLookController.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"boneLookController.js","sourceRoot":"","sources":["../../../../dev/core/src/Bones/boneLookController.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAGnE,OAAO,EAAS,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAEjD;;;GAGG;AACH,MAAM,OAAO,kBAAkB;IAuE3B;;OAEG;IACH,IAAI,MAAM;QACN,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED,IAAI,MAAM,CAAC,KAAa;QACpB,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;QACrB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAClC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAClC,IAAI,IAAI,C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AAC,EAAE,CAAC;QACpB,IAAI,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;QAE5C,IAAI,IAAI,GAAG,IAAI,EAAE;YACb,IAAI,GAAG,GAAG,IAAI,IAAI,GAAG,GAAG,IAAI,EAAE;gBAC1B,OAAO,IAAI,CAAC;aACf;SACJ;aAAM;YACH,IAAI,GAAG,GAAG,IAAI,IAAI,GAAG,GAAG,IAAI,EAAE;gBAC1B,OAAO,IAAI,CAAC;aACf;SACJ;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;IAEO,8BAA8B;QAClC,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QACvB,IAAI,IAAI,CAAC,oBAAoB,EAAE;YAC3B,IAAI,CAAC,IAAI,CAAC,oBAAoB,CAAC,kBAAkB,EAAE;gBAC/C,IAAI,CAAC,oBAAoB,CAAC,kBAAkB,GAAG,IAAI,UAAU,EAAE,CAAC;aACnE;YACD,IAAI,CAAC,0BAA0B,sBAAc,IAAI,EAAE,IAAI,CAAC,oBAAoB,CAAC,kBAAkB,CAAC,CAAC;SACpG;IACL,CAAC;;AAvkBc,2BAAQ,GAAc,UAAU,CAAC,UAAU,CAAC,EAAE,EAAE,OAAO,CAAC,IAAI,CAAC,AAArD,CAAsD;AAC9D,2BAAQ,GAAG,UAAU,CAAC,QAAQ,EAAE,AAAxB,CAAyB;AACjC,2BAAQ,GAAa,UAAU,CAAC,UAAU,CAAC,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC,AAAtD,CAAuD","sourcesContent":["import type { Nullable } from \"../types\";\r\nimport { ArrayTools } from \"../Misc/arrayTools\";\r\nimport { Vector3, Quaternion, Matrix } from \"../Maths/math.vector\";\r\nimport type { TransformNode } from \"../Meshes/transformNode\";\r\nimport type { Bone } from \"./bone\";\r\nimport { Space, Axis } from \"../Maths/math.axis\";\r\n\r\n/**\r\n * Class used to make a bone look toward a point in space\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/bonesSkeletons#bonelookcontroller\r\n */\r\nexport class BoneLookController {\r\n private static _TmpVecs: Vector3[] = ArrayTools.BuildArray(10, Vector3.Zero);\r\n private static _TmpQuat = Quaternion.Identity();\r\n private static _TmpMats: Matrix[] = ArrayTools.BuildArray(5, Matrix.Identity);\r\n\r\n /**\r\n * The target Vector3 that the bone will look at\r\n */\r\n public target: Vector3;\r\n\r\n /**\r\n * The TransformNode that the bone is attached to\r\n * Name kept as mesh for back compatibility\r\n */\r\n public mesh: TransformNode;\r\n\r\n /**\r\n * The bone that will be looking to the target\r\n */\r\n public bone: Bone;\r\n\r\n /**\r\n * The up axis of the coordinate system that is used when the bone is rotated\r\n */\r\n public upAxis: Vector3 = Vector3.Up();\r\n\r\n /**\r\n * The space that the up axis is in - Space.BONE, Space.LOCAL (default), or Space.WORLD\r\n */\r\n public upAxisSpace: Space = Space.LOCAL;\r\n\r\n /**\r\n * Used to make an adjustment to the yaw of the bone\r\n */\r\n public adjustYaw = 0;\r\n\r\n /**\r\n * Used to make an adjustment to the pitch of the bone\r\n */\r\n public adjustPitch = 0;\r\n\r\n /**\r\n * Used to make an adjustment to the roll of the bone\r\n */\r\n public adjustRoll = 0;\r\n\r\n /**\r\n * The amount to slerp (spherical linear interpolation) to the target. Set this to a value between 0 and 1 (a value of 1 disables slerp)\r\n */\r\n public slerpAmount = 1;\r\n\r\n private _minYaw: number;\r\n private _maxYaw: number;\r\n private _minPitch: number;\r\n private _maxPitch: number;\r\n private _minYawSin: number;\r\n private _minYawCos: number;\r\n private _maxYawSin: number;\r\n private _maxYawCos: number;\r\n private _midYawConstraint: number;\r\n private _minPitchTan: number;\r\n private _maxPitchTan: number;\r\n\r\n private _boneQuat: Quaternion = Quaternion.Identity();\r\n private _slerping = false;\r\n private _transformYawPitch: Matrix;\r\n private _transformYawPitchInv: Matrix;\r\n private _firstFrameSkipped = false;\r\n private _yawRange: number;\r\n private _fowardAxis: Vector3 = Vector3.Forward();\r\n\r\n /**\r\n * Gets or sets the minimum yaw angle that the bone can look to\r\n */\r\n get minYaw(): number {\r\n return this._minYaw;\r\n }\r\n\r\n set minYaw(value: number) {\r\n this._minYaw = value;\r\n this._minYawSin = Math.sin(value);\r\n this._minYawCos = Math.cos(value);\r\n if (this._maxYaw != null) {\r\n this._midYawConstraint = this._getAngleDiff(this._minYaw, this._maxYaw) * 0.5 + this._minYaw;\r\n this._yawRange = this._maxYaw - this._minYaw;\r\n }\r\n }\r\n\r\n /**\r\n * Gets or sets the maximum yaw angle that the bone can look to\r\n */\r\n get maxYaw(): number {\r\n return this._maxYaw;\r\n }\r\n\r\n set maxYaw(value: number) {\r\n this._maxYaw = value;\r\n this._maxYawSin = Math.sin(value);\r\n this._maxYawCos = Math.cos(value);\r\n if (this._minYaw != null) {\r\n this._midYawConstraint = this._getAngleDiff(this._minYaw, this._maxYaw) * 0.5 + this._minYaw;\r\n this._yawRange = this._maxYaw - this._minYaw;\r\n }\r\n }\r\n\r\n /**\r\n * Use the absolute value for yaw when checking the min/max constraints\r\n */\r\n public useAbsoluteValueForYaw = false;\r\n\r\n /**\r\n * Gets or sets the minimum pitch angle that the bone can look to\r\n */\r\n get minPitch(): number {\r\n return this._minPitch;\r\n }\r\n\r\n set minPitch(value: number) {\r\n this._minPitch = value;\r\n this._minPitchTan = Math.tan(value);\r\n }\r\n\r\n /**\r\n * Gets or sets the maximum pitch angle that the bone can look to\r\n */\r\n get maxPitch(): number {\r\n return this._maxPitch;\r\n }\r\n\r\n set maxPitch(value: number) {\r\n this._maxPitch = value;\r\n this._maxPitchTan = Math.tan(value);\r\n }\r\n\r\n /**\r\n * Create a BoneLookController\r\n * @param mesh the TransformNode that the bone belongs to\r\n * @param bone the bone that will be looking to the target\r\n * @param target the target Vector3 to look at\r\n * @param options optional settings:\r\n * * maxYaw: the maximum angle the bone will yaw to\r\n * * minYaw: the minimum angle the bone will yaw to\r\n * * maxPitch: the maximum angle the bone will pitch to\r\n * * minPitch: the minimum angle the bone will yaw to\r\n * * slerpAmount: set the between 0 and 1 to make the bone slerp to the target.\r\n * * upAxis: the up axis of the coordinate system\r\n * * upAxisSpace: the space that the up axis is in - Space.BONE, Space.LOCAL (default), or Space.WORLD.\r\n * * yawAxis: set yawAxis if the bone does not yaw on the y axis\r\n * * pitchAxis: set pitchAxis if the bone does not pitch on the x axis\r\n * * adjustYaw: used to make an adjustment to the yaw of the bone\r\n * * adjustPitch: used to make an adjustment to the pitch of the bone\r\n * * adjustRoll: used to make an adjustment to the roll of the bone\r\n * @param options.maxYaw\r\n * @param options.minYaw\r\n * @param options.maxPitch\r\n * @param options.minPitch\r\n * @param options.slerpAmount\r\n * @param options.upAxis\r\n * @param options.upAxisSpace\r\n * @param options.yawAxis\r\n * @param options.pitchAxis\r\n * @param options.adjustYaw\r\n * @param options.adjustPitch\r\n * @param options.adjustRoll\r\n **/\r\n constructor(\r\n mesh: TransformNode,\r\n bone: Bone,\r\n target: Vector3,\r\n options?: {\r\n maxYaw?: number;\r\n minYaw?: number;\r\n maxPitch?: number;\r\n minPitch?: number;\r\n slerpAmount?: number;\r\n upAxis?: Vector3;\r\n upAxisSpace?: Space;\r\n yawAxis?: Vector3;\r\n pitchAxis?: Vector3;\r\n adjustYaw?: number;\r\n adjustPitch?: number;\r\n adjustRoll?: number;\r\n useAbsoluteValueForYaw?: boolean;\r\n }\r\n ) {\r\n this.mesh = mesh;\r\n this.bone = bone;\r\n this.target = target;\r\n\r\n if (options) {\r\n if (options.adjustYaw) {\r\n this.adjustYaw = options.adjustYaw;\r\n }\r\n\r\n if (options.adjustPitch) {\r\n this.adjustPitch = options.adjustPitch;\r\n }\r\n\r\n if (options.adjustRoll) {\r\n this.adjustRoll = options.adjustRoll;\r\n }\r\n\r\n if (options.maxYaw != null) {\r\n this.maxYaw = options.maxYaw;\r\n } else {\r\n this.maxYaw = Math.PI;\r\n }\r\n\r\n if (options.minYaw != null) {\r\n this.minYaw = options.minYaw;\r\n } else {\r\n this.minYaw = -Math.PI;\r\n }\r\n\r\n if (options.maxPitch != null) {\r\n this.maxPitch = options.maxPitch;\r\n } else {\r\n this.maxPitch = Math.PI;\r\n }\r\n\r\n if (options.minPitch != null) {\r\n this.minPitch = options.minPitch;\r\n } else {\r\n this.minPitch = -Math.PI;\r\n }\r\n\r\n if (options.slerpAmount != null) {\r\n this.slerpAmount = options.slerpAmount;\r\n }\r\n\r\n if (options.upAxis != null) {\r\n this.upAxis = options.upAxis;\r\n }\r\n\r\n if (options.upAxisSpace != null) {\r\n this.upAxisSpace = options.upAxisSpace;\r\n }\r\n\r\n if (options.yawAxis != null || options.pitchAxis != null) {\r\n let newYawAxis = Axis.Y;\r\n let newPitchAxis = Axis.X;\r\n\r\n if (options.yawAxis != null) {\r\n newYawAxis = options.yawAxis.clone();\r\n newYawAxis.normalize();\r\n }\r\n\r\n if (options.pitchAxis != null) {\r\n newPitchAxis = options.pitchAxis.clone();\r\n newPitchAxis.normalize();\r\n }\r\n\r\n const newRollAxis = Vector3.Cross(newPitchAxis, newYawAxis);\r\n\r\n this._transformYawPitch = Matrix.Identity();\r\n Matrix.FromXYZAxesToRef(newPitchAxis, newYawAxis, newRollAxis, this._transformYawPitch);\r\n\r\n this._transformYawPitchInv = this._transformYawPitch.clone();\r\n this._transformYawPitch.invert();\r\n }\r\n\r\n if (options.useAbsoluteValueForYaw !== undefined) {\r\n this.useAbsoluteValueForYaw = options.useAbsoluteValueForYaw;\r\n }\r\n }\r\n\r\n if (!bone.getParent() && this.upAxisSpace == Space.BONE) {\r\n this.upAxisSpace = Space.LOCAL;\r\n }\r\n }\r\n\r\n /**\r\n * Update the bone to look at the target. This should be called before the scene is rendered (use scene.registerBeforeRender())\r\n */\r\n public update(): void {\r\n //skip the first frame when slerping so that the TransformNode rotation is correct\r\n if (this.slerpAmount < 1 && !this._firstFrameSkipped) {\r\n this._firstFrameSkipped = true;\r\n return;\r\n }\r\n\r\n const bone = this.bone;\r\n const bonePos = BoneLookController._TmpVecs[0];\r\n bone.getAbsolutePositionToRef(this.mesh, bonePos);\r\n\r\n let target = this.target;\r\n const _tmpMat1 = BoneLookController._TmpMats[0];\r\n const _tmpMat2 = BoneLookController._TmpMats[1];\r\n\r\n const mesh = this.mesh;\r\n const parentBone = bone.getParent();\r\n\r\n const upAxis = BoneLookController._TmpVecs[1];\r\n upAxis.copyFrom(this.upAxis);\r\n\r\n if (this.upAxisSpace == Space.BONE && parentBone) {\r\n if (this._transformYawPitch) {\r\n Vector3.TransformCoordinatesToRef(upAxis, this._transformYawPitchInv, upAxis);\r\n }\r\n parentBone.getDirectionToRef(upAxis, this.mesh, upAxis);\r\n } else if (this.upAxisSpace == Space.LOCAL) {\r\n mesh.getDirectionToRef(upAxis, upAxis);\r\n if (mesh.scaling.x != 1 || mesh.scaling.y != 1 || mesh.scaling.z != 1) {\r\n upAxis.normalize();\r\n }\r\n }\r\n\r\n let checkYaw = false;\r\n let checkPitch = false;\r\n\r\n if (this._maxYaw != Math.PI || this._minYaw != -Math.PI) {\r\n checkYaw = true;\r\n }\r\n if (this._maxPitch != Math.PI || this._minPitch != -Math.PI) {\r\n checkPitch = true;\r\n }\r\n\r\n if (checkYaw || checkPitch) {\r\n const spaceMat = BoneLookController._TmpMats[2];\r\n const spaceMatInv = BoneLookController._TmpMats[3];\r\n\r\n if (this.upAxisSpace == Space.BONE && upAxis.y == 1 && parentBone) {\r\n parentBone.getRotationMatrixToRef(Space.WORLD, this.mesh, spaceMat);\r\n } else if (this.upAxisSpace == Space.LOCAL && upAxis.y == 1 && !parentBone) {\r\n spaceMat.copyFrom(mesh.getWorldMatrix());\r\n } else {\r\n let forwardAxis = BoneLookController._TmpVecs[2];\r\n forwardAxis.copyFrom(this._fowardAxis);\r\n\r\n if (this._transformYawPitch) {\r\n Vector3.TransformCoordinatesToRef(forwardAxis, this._transformYawPitchInv, forwardAxis);\r\n }\r\n\r\n if (parentBone) {\r\n parentBone.getDirectionToRef(forwardAxis, this.mesh, forwardAxis);\r\n } else {\r\n mesh.getDirectionToRef(forwardAxis, forwardAxis);\r\n }\r\n\r\n const rightAxis = Vector3.Cross(upAxis, forwardAxis);\r\n rightAxis.normalize();\r\n forwardAxis = Vector3.Cross(rightAxis, upAxis);\r\n\r\n Matrix.FromXYZAxesToRef(rightAxis, upAxis, forwardAxis, spaceMat);\r\n }\r\n\r\n spaceMat.invertToRef(spaceMatInv);\r\n\r\n let xzlen: Nullable<number> = null;\r\n\r\n if (checkPitch) {\r\n const localTarget = BoneLookController._TmpVecs[3];\r\n target.subtractToRef(bonePos, localTarget);\r\n Vector3.TransformCoordinatesToRef(localTarget, spaceMatInv, localTarget);\r\n\r\n xzlen = Math.sqrt(localTarget.x * localTarget.x + localTarget.z * localTarget.z);\r\n const pitch = Math.atan2(localTarget.y, xzlen);\r\n let newPitch = pitch;\r\n\r\n if (pitch > this._maxPitch) {\r\n localTarget.y = this._maxPitchTan * xzlen;\r\n newPitch = this._maxPitch;\r\n } else if (pitch < this._minPitch) {\r\n localTarget.y = this._minPitchTan * xzlen;\r\n newPitch = this._minPitch;\r\n }\r\n\r\n if (pitch != newPitch) {\r\n Vector3.TransformCoordinatesToRef(localTarget, spaceMat, localTarget);\r\n localTarget.addInPlace(bonePos);\r\n target = localTarget;\r\n }\r\n }\r\n\r\n if (checkYaw) {\r\n const localTarget = BoneLookController._TmpVecs[4];\r\n target.subtractToRef(bonePos, localTarget);\r\n Vector3.TransformCoordinatesToRef(localTarget, spaceMatInv, localTarget);\r\n\r\n const yaw = Math.atan2(localTarget.x, localTarget.z);\r\n const yawCheck = this.useAbsoluteValueForYaw ? Math.abs(yaw) : yaw;\r\n let newYaw = yaw;\r\n\r\n if (yawCheck > this._maxYaw || yawCheck < this._minYaw) {\r\n if (xzlen == null) {\r\n xzlen = Math.sqrt(localTarget.x * localTarget.x + localTarget.z * localTarget.z);\r\n }\r\n\r\n if (this._yawRange > Math.PI) {\r\n if (this._isAngleBetween(yaw, this._maxYaw, this._midYawConstraint)) {\r\n localTarget.z = this._maxYawCos * xzlen;\r\n localTarget.x = this._maxYawSin * xzlen;\r\n newYaw = this._maxYaw;\r\n } else if (this._isAngleBetween(yaw, this._midYawConstraint, this._minYaw)) {\r\n localTarget.z = this._minYawCos * xzlen;\r\n localTarget.x = this._minYawSin * xzlen;\r\n newYaw = this._minYaw;\r\n }\r\n } else {\r\n if (yawCheck > this._maxYaw) {\r\n localTarget.z = this._maxYawCos * xzlen;\r\n localTarget.x = this._maxYawSin * xzlen;\r\n if (yaw < 0 && this.useAbsoluteValueForYaw) {\r\n localTarget.x *= -1;\r\n }\r\n newYaw = this._maxYaw;\r\n } else if (yawCheck < this._minYaw) {\r\n localTarget.z = this._minYawCos * xzlen;\r\n localTarget.x = this._minYawSin * xzlen;\r\n if (yaw < 0 && this.useAbsoluteValueForYaw) {\r\n localTarget.x *= -1;\r\n }\r\n newYaw = this._minYaw;\r\n }\r\n }\r\n }\r\n\r\n if (this._slerping && this._yawRange > Math.PI) {\r\n //are we going to be crossing into the min/max region?\r\n const boneFwd = BoneLookController._TmpVecs[8];\r\n boneFwd.copyFrom(Axis.Z);\r\n if (this._transformYawPitch) {\r\n Vector3.TransformCoordinatesToRef(boneFwd, this._transformYawPitchInv, boneFwd);\r\n }\r\n\r\n const boneRotMat = BoneLookController._TmpMats[4];\r\n this._boneQuat.toRotationMatrix(boneRotMat);\r\n this.mesh.getWorldMatrix().multiplyToRef(boneRotMat, boneRotMat);\r\n Vector3.TransformCoordinatesToRef(boneFwd, boneRotMat, boneFwd);\r\n Vector3.TransformCoordinatesToRef(boneFwd, spaceMatInv, boneFwd);\r\n\r\n const boneYaw = Math.atan2(boneFwd.x, boneFwd.z);\r\n const angBtwTar = this._getAngleBetween(boneYaw, yaw);\r\n const angBtwMidYaw = this._getAngleBetween(boneYaw, this._midYawConstraint);\r\n\r\n if (angBtwTar > angBtwMidYaw) {\r\n if (xzlen == null) {\r\n xzlen = Math.sqrt(localTarget.x * localTarget.x + localTarget.z * localTarget.z);\r\n }\r\n\r\n const angBtwMax = this._getAngleBetween(boneYaw, this._maxYaw);\r\n const angBtwMin = this._getAngleBetween(boneYaw, this._minYaw);\r\n\r\n if (angBtwMin < angBtwMax) {\r\n newYaw = boneYaw + Math.PI * 0.75;\r\n localTarget.z = Math.cos(newYaw) * xzlen;\r\n localTarget.x = Math.sin(newYaw) * xzlen;\r\n } else {\r\n newYaw = boneYaw - Math.PI * 0.75;\r\n localTarget.z = Math.cos(newYaw) * xzlen;\r\n localTarget.x = Math.sin(newYaw) * xzlen;\r\n }\r\n }\r\n }\r\n\r\n if (yaw != newYaw) {\r\n Vector3.TransformCoordinatesToRef(localTarget, spaceMat, localTarget);\r\n localTarget.addInPlace(bonePos);\r\n target = localTarget;\r\n }\r\n }\r\n }\r\n\r\n const zaxis = BoneLookController._TmpVecs[5];\r\n const xaxis = BoneLookController._TmpVecs[6];\r\n const yaxis = BoneLookController._TmpVecs[7];\r\n const tmpQuat = BoneLookController._TmpQuat;\r\n const boneScaling = BoneLookController._TmpVecs[9];\r\n\r\n target.subtractToRef(bonePos, zaxis);\r\n zaxis.normalize();\r\n Vector3.CrossToRef(upAxis, zaxis, xaxis);\r\n xaxis.normalize();\r\n Vector3.CrossToRef(zaxis, xaxis, yaxis);\r\n yaxis.normalize();\r\n Matrix.FromXYZAxesToRef(xaxis, yaxis, zaxis, _tmpMat1);\r\n\r\n if (xaxis.x === 0 && xaxis.y === 0 && xaxis.z === 0) {\r\n return;\r\n }\r\n\r\n if (yaxis.x === 0 && yaxis.y === 0 && yaxis.z === 0) {\r\n return;\r\n }\r\n\r\n if (zaxis.x === 0 && zaxis.y === 0 && zaxis.z === 0) {\r\n return;\r\n }\r\n\r\n if (this.adjustYaw || this.adjustPitch || this.adjustRoll) {\r\n Matrix.RotationYawPitchRollToRef(this.adjustYaw, this.adjustPitch, this.adjustRoll, _tmpMat2);\r\n _tmpMat2.multiplyToRef(_tmpMat1, _tmpMat1);\r\n }\r\n\r\n boneScaling.copyFrom(this.bone.getScale());\r\n\r\n if (this.slerpAmount < 1) {\r\n if (!this._slerping) {\r\n this.bone.getRotationQuaternionToRef(Space.WORLD, this.mesh, this._boneQuat);\r\n }\r\n if (this._transformYawPitch) {\r\n this._transformYawPitch.multiplyToRef(_tmpMat1, _tmpMat1);\r\n }\r\n Quaternion.FromRotationMatrixToRef(_tmpMat1, tmpQuat);\r\n Quaternion.SlerpToRef(this._boneQuat, tmpQuat, this.slerpAmount, this._boneQuat);\r\n\r\n this.bone.setRotationQuaternion(this._boneQuat, Space.WORLD, this.mesh);\r\n this._slerping = true;\r\n } else {\r\n if (this._transformYawPitch) {\r\n this._transformYawPitch.multiplyToRef(_tmpMat1, _tmpMat1);\r\n }\r\n this.bone.setRotationMatrix(_tmpMat1, Space.WORLD, this.mesh);\r\n this._slerping = false;\r\n }\r\n\r\n this.bone.setScale(boneScaling);\r\n\r\n this._updateLinkedTransformRotation();\r\n }\r\n\r\n private _getAngleDiff(ang1: number, ang2: number): number {\r\n let angDiff = ang2 - ang1;\r\n angDiff %= Math.PI * 2;\r\n\r\n if (angDiff > Math.PI) {\r\n angDiff -= Math.PI * 2;\r\n } else if (angDiff < -Math.PI) {\r\n angDiff += Math.PI * 2;\r\n }\r\n\r\n return angDiff;\r\n }\r\n\r\n private _getAngleBetween(ang1: number, ang2: number): number {\r\n ang1 %= 2 * Math.PI;\r\n ang1 = ang1 < 0 ? ang1 + 2 * Math.PI : ang1;\r\n\r\n ang2 %= 2 * Math.PI;\r\n ang2 = ang2 < 0 ? ang2 + 2 * Math.PI : ang2;\r\n\r\n let ab = 0;\r\n\r\n if (ang1 < ang2) {\r\n ab = ang2 - ang1;\r\n } else {\r\n ab = ang1 - ang2;\r\n }\r\n\r\n if (ab > Math.PI) {\r\n ab = Math.PI * 2 - ab;\r\n }\r\n\r\n return ab;\r\n }\r\n\r\n private _isAngleBetween(ang: number, ang1: number, ang2: number): boolean {\r\n ang %= 2 * Math.PI;\r\n ang = ang < 0 ? ang + 2 * Math.PI : ang;\r\n ang1 %= 2 * Math.PI;\r\n ang1 = ang1 < 0 ? ang1 + 2 * Math.PI : ang1;\r\n ang2 %= 2 * Math.PI;\r\n ang2 = ang2 < 0 ? ang2 + 2 * Math.PI : ang2;\r\n\r\n if (ang1 < ang2) {\r\n if (ang > ang1 && ang < ang2) {\r\n return true;\r\n }\r\n } else {\r\n if (ang > ang2 && ang < ang1) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n\r\n private _updateLinkedTransformRotation(): void {\r\n const bone = this.bone;\r\n if (bone._linkedTransformNode) {\r\n if (!bone._linkedTransformNode.rotationQuaternion) {\r\n bone._linkedTransformNode.rotationQuaternion = new Quaternion();\r\n }\r\n bone.getRotationQuaternionToRef(Space.LOCAL, null, bone._linkedTransformNode.rotationQuaternion);\r\n }\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"boneLookController.js","sourceRoot":"","sources":["../../../../dev/core/src/Bones/boneLookController.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAGnE,OAAO,EAAS,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAEjD;;;GAGG;AACH,MAAM,OAAO,kBAAkB;IAuE3B;;OAEG;IACH,IAAI,MAAM;QACN,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED,IAAI,MAAM,CAAC,KAAa;QACpB,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;QACrB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAClC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAClC,IAAI,IAAI,CAAC,OAAO,IAAI,IAAI,EAAE;YACtB,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC,aAAa,CA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,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;QAE5C,IAAI,IAAI,GAAG,IAAI,EAAE;YACb,IAAI,GAAG,GAAG,IAAI,IAAI,GAAG,GAAG,IAAI,EAAE;gBAC1B,OAAO,IAAI,CAAC;aACf;SACJ;aAAM;YACH,IAAI,GAAG,GAAG,IAAI,IAAI,GAAG,GAAG,IAAI,EAAE;gBAC1B,OAAO,IAAI,CAAC;aACf;SACJ;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;IAEO,8BAA8B;QAClC,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QACvB,IAAI,IAAI,CAAC,oBAAoB,EAAE;YAC3B,IAAI,CAAC,IAAI,CAAC,oBAAoB,CAAC,kBAAkB,EAAE;gBAC/C,IAAI,CAAC,oBAAoB,CAAC,kBAAkB,GAAG,IAAI,UAAU,EAAE,CAAC;aACnE;YACD,IAAI,CAAC,0BAA0B,sBAAc,IAAI,EAAE,IAAI,CAAC,oBAAoB,CAAC,kBAAkB,CAAC,CAAC;SACpG;IACL,CAAC;;AAvkBc,2BAAQ,GAAc,UAAU,CAAC,EAAE,EAAE,OAAO,CAAC,IAAI,CAAC,AAA1C,CAA2C;AACnD,2BAAQ,GAAG,UAAU,CAAC,QAAQ,EAAE,AAAxB,CAAyB;AACjC,2BAAQ,GAAa,UAAU,CAAC,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC,AAA3C,CAA4C","sourcesContent":["import type { Nullable } from \"../types\";\r\nimport { BuildArray } from \"../Misc/arrayTools\";\r\nimport { Vector3, Quaternion, Matrix } from \"../Maths/math.vector\";\r\nimport type { TransformNode } from \"../Meshes/transformNode\";\r\nimport type { Bone } from \"./bone\";\r\nimport { Space, Axis } from \"../Maths/math.axis\";\r\n\r\n/**\r\n * Class used to make a bone look toward a point in space\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/bonesSkeletons#bonelookcontroller\r\n */\r\nexport class BoneLookController {\r\n private static _TmpVecs: Vector3[] = BuildArray(10, Vector3.Zero);\r\n private static _TmpQuat = Quaternion.Identity();\r\n private static _TmpMats: Matrix[] = BuildArray(5, Matrix.Identity);\r\n\r\n /**\r\n * The target Vector3 that the bone will look at\r\n */\r\n public target: Vector3;\r\n\r\n /**\r\n * The TransformNode that the bone is attached to\r\n * Name kept as mesh for back compatibility\r\n */\r\n public mesh: TransformNode;\r\n\r\n /**\r\n * The bone that will be looking to the target\r\n */\r\n public bone: Bone;\r\n\r\n /**\r\n * The up axis of the coordinate system that is used when the bone is rotated\r\n */\r\n public upAxis: Vector3 = Vector3.Up();\r\n\r\n /**\r\n * The space that the up axis is in - Space.BONE, Space.LOCAL (default), or Space.WORLD\r\n */\r\n public upAxisSpace: Space = Space.LOCAL;\r\n\r\n /**\r\n * Used to make an adjustment to the yaw of the bone\r\n */\r\n public adjustYaw = 0;\r\n\r\n /**\r\n * Used to make an adjustment to the pitch of the bone\r\n */\r\n public adjustPitch = 0;\r\n\r\n /**\r\n * Used to make an adjustment to the roll of the bone\r\n */\r\n public adjustRoll = 0;\r\n\r\n /**\r\n * The amount to slerp (spherical linear interpolation) to the target. Set this to a value between 0 and 1 (a value of 1 disables slerp)\r\n */\r\n public slerpAmount = 1;\r\n\r\n private _minYaw: number;\r\n private _maxYaw: number;\r\n private _minPitch: number;\r\n private _maxPitch: number;\r\n private _minYawSin: number;\r\n private _minYawCos: number;\r\n private _maxYawSin: number;\r\n private _maxYawCos: number;\r\n private _midYawConstraint: number;\r\n private _minPitchTan: number;\r\n private _maxPitchTan: number;\r\n\r\n private _boneQuat: Quaternion = Quaternion.Identity();\r\n private _slerping = false;\r\n private _transformYawPitch: Matrix;\r\n private _transformYawPitchInv: Matrix;\r\n private _firstFrameSkipped = false;\r\n private _yawRange: number;\r\n private _fowardAxis: Vector3 = Vector3.Forward();\r\n\r\n /**\r\n * Gets or sets the minimum yaw angle that the bone can look to\r\n */\r\n get minYaw(): number {\r\n return this._minYaw;\r\n }\r\n\r\n set minYaw(value: number) {\r\n this._minYaw = value;\r\n this._minYawSin = Math.sin(value);\r\n this._minYawCos = Math.cos(value);\r\n if (this._maxYaw != null) {\r\n this._midYawConstraint = this._getAngleDiff(this._minYaw, this._maxYaw) * 0.5 + this._minYaw;\r\n this._yawRange = this._maxYaw - this._minYaw;\r\n }\r\n }\r\n\r\n /**\r\n * Gets or sets the maximum yaw angle that the bone can look to\r\n */\r\n get maxYaw(): number {\r\n return this._maxYaw;\r\n }\r\n\r\n set maxYaw(value: number) {\r\n this._maxYaw = value;\r\n this._maxYawSin = Math.sin(value);\r\n this._maxYawCos = Math.cos(value);\r\n if (this._minYaw != null) {\r\n this._midYawConstraint = this._getAngleDiff(this._minYaw, this._maxYaw) * 0.5 + this._minYaw;\r\n this._yawRange = this._maxYaw - this._minYaw;\r\n }\r\n }\r\n\r\n /**\r\n * Use the absolute value for yaw when checking the min/max constraints\r\n */\r\n public useAbsoluteValueForYaw = false;\r\n\r\n /**\r\n * Gets or sets the minimum pitch angle that the bone can look to\r\n */\r\n get minPitch(): number {\r\n return this._minPitch;\r\n }\r\n\r\n set minPitch(value: number) {\r\n this._minPitch = value;\r\n this._minPitchTan = Math.tan(value);\r\n }\r\n\r\n /**\r\n * Gets or sets the maximum pitch angle that the bone can look to\r\n */\r\n get maxPitch(): number {\r\n return this._maxPitch;\r\n }\r\n\r\n set maxPitch(value: number) {\r\n this._maxPitch = value;\r\n this._maxPitchTan = Math.tan(value);\r\n }\r\n\r\n /**\r\n * Create a BoneLookController\r\n * @param mesh the TransformNode that the bone belongs to\r\n * @param bone the bone that will be looking to the target\r\n * @param target the target Vector3 to look at\r\n * @param options optional settings:\r\n * * maxYaw: the maximum angle the bone will yaw to\r\n * * minYaw: the minimum angle the bone will yaw to\r\n * * maxPitch: the maximum angle the bone will pitch to\r\n * * minPitch: the minimum angle the bone will yaw to\r\n * * slerpAmount: set the between 0 and 1 to make the bone slerp to the target.\r\n * * upAxis: the up axis of the coordinate system\r\n * * upAxisSpace: the space that the up axis is in - Space.BONE, Space.LOCAL (default), or Space.WORLD.\r\n * * yawAxis: set yawAxis if the bone does not yaw on the y axis\r\n * * pitchAxis: set pitchAxis if the bone does not pitch on the x axis\r\n * * adjustYaw: used to make an adjustment to the yaw of the bone\r\n * * adjustPitch: used to make an adjustment to the pitch of the bone\r\n * * adjustRoll: used to make an adjustment to the roll of the bone\r\n * @param options.maxYaw\r\n * @param options.minYaw\r\n * @param options.maxPitch\r\n * @param options.minPitch\r\n * @param options.slerpAmount\r\n * @param options.upAxis\r\n * @param options.upAxisSpace\r\n * @param options.yawAxis\r\n * @param options.pitchAxis\r\n * @param options.adjustYaw\r\n * @param options.adjustPitch\r\n * @param options.adjustRoll\r\n **/\r\n constructor(\r\n mesh: TransformNode,\r\n bone: Bone,\r\n target: Vector3,\r\n options?: {\r\n maxYaw?: number;\r\n minYaw?: number;\r\n maxPitch?: number;\r\n minPitch?: number;\r\n slerpAmount?: number;\r\n upAxis?: Vector3;\r\n upAxisSpace?: Space;\r\n yawAxis?: Vector3;\r\n pitchAxis?: Vector3;\r\n adjustYaw?: number;\r\n adjustPitch?: number;\r\n adjustRoll?: number;\r\n useAbsoluteValueForYaw?: boolean;\r\n }\r\n ) {\r\n this.mesh = mesh;\r\n this.bone = bone;\r\n this.target = target;\r\n\r\n if (options) {\r\n if (options.adjustYaw) {\r\n this.adjustYaw = options.adjustYaw;\r\n }\r\n\r\n if (options.adjustPitch) {\r\n this.adjustPitch = options.adjustPitch;\r\n }\r\n\r\n if (options.adjustRoll) {\r\n this.adjustRoll = options.adjustRoll;\r\n }\r\n\r\n if (options.maxYaw != null) {\r\n this.maxYaw = options.maxYaw;\r\n } else {\r\n this.maxYaw = Math.PI;\r\n }\r\n\r\n if (options.minYaw != null) {\r\n this.minYaw = options.minYaw;\r\n } else {\r\n this.minYaw = -Math.PI;\r\n }\r\n\r\n if (options.maxPitch != null) {\r\n this.maxPitch = options.maxPitch;\r\n } else {\r\n this.maxPitch = Math.PI;\r\n }\r\n\r\n if (options.minPitch != null) {\r\n this.minPitch = options.minPitch;\r\n } else {\r\n this.minPitch = -Math.PI;\r\n }\r\n\r\n if (options.slerpAmount != null) {\r\n this.slerpAmount = options.slerpAmount;\r\n }\r\n\r\n if (options.upAxis != null) {\r\n this.upAxis = options.upAxis;\r\n }\r\n\r\n if (options.upAxisSpace != null) {\r\n this.upAxisSpace = options.upAxisSpace;\r\n }\r\n\r\n if (options.yawAxis != null || options.pitchAxis != null) {\r\n let newYawAxis = Axis.Y;\r\n let newPitchAxis = Axis.X;\r\n\r\n if (options.yawAxis != null) {\r\n newYawAxis = options.yawAxis.clone();\r\n newYawAxis.normalize();\r\n }\r\n\r\n if (options.pitchAxis != null) {\r\n newPitchAxis = options.pitchAxis.clone();\r\n newPitchAxis.normalize();\r\n }\r\n\r\n const newRollAxis = Vector3.Cross(newPitchAxis, newYawAxis);\r\n\r\n this._transformYawPitch = Matrix.Identity();\r\n Matrix.FromXYZAxesToRef(newPitchAxis, newYawAxis, newRollAxis, this._transformYawPitch);\r\n\r\n this._transformYawPitchInv = this._transformYawPitch.clone();\r\n this._transformYawPitch.invert();\r\n }\r\n\r\n if (options.useAbsoluteValueForYaw !== undefined) {\r\n this.useAbsoluteValueForYaw = options.useAbsoluteValueForYaw;\r\n }\r\n }\r\n\r\n if (!bone.getParent() && this.upAxisSpace == Space.BONE) {\r\n this.upAxisSpace = Space.LOCAL;\r\n }\r\n }\r\n\r\n /**\r\n * Update the bone to look at the target. This should be called before the scene is rendered (use scene.registerBeforeRender())\r\n */\r\n public update(): void {\r\n //skip the first frame when slerping so that the TransformNode rotation is correct\r\n if (this.slerpAmount < 1 && !this._firstFrameSkipped) {\r\n this._firstFrameSkipped = true;\r\n return;\r\n }\r\n\r\n const bone = this.bone;\r\n const bonePos = BoneLookController._TmpVecs[0];\r\n bone.getAbsolutePositionToRef(this.mesh, bonePos);\r\n\r\n let target = this.target;\r\n const _tmpMat1 = BoneLookController._TmpMats[0];\r\n const _tmpMat2 = BoneLookController._TmpMats[1];\r\n\r\n const mesh = this.mesh;\r\n const parentBone = bone.getParent();\r\n\r\n const upAxis = BoneLookController._TmpVecs[1];\r\n upAxis.copyFrom(this.upAxis);\r\n\r\n if (this.upAxisSpace == Space.BONE && parentBone) {\r\n if (this._transformYawPitch) {\r\n Vector3.TransformCoordinatesToRef(upAxis, this._transformYawPitchInv, upAxis);\r\n }\r\n parentBone.getDirectionToRef(upAxis, this.mesh, upAxis);\r\n } else if (this.upAxisSpace == Space.LOCAL) {\r\n mesh.getDirectionToRef(upAxis, upAxis);\r\n if (mesh.scaling.x != 1 || mesh.scaling.y != 1 || mesh.scaling.z != 1) {\r\n upAxis.normalize();\r\n }\r\n }\r\n\r\n let checkYaw = false;\r\n let checkPitch = false;\r\n\r\n if (this._maxYaw != Math.PI || this._minYaw != -Math.PI) {\r\n checkYaw = true;\r\n }\r\n if (this._maxPitch != Math.PI || this._minPitch != -Math.PI) {\r\n checkPitch = true;\r\n }\r\n\r\n if (checkYaw || checkPitch) {\r\n const spaceMat = BoneLookController._TmpMats[2];\r\n const spaceMatInv = BoneLookController._TmpMats[3];\r\n\r\n if (this.upAxisSpace == Space.BONE && upAxis.y == 1 && parentBone) {\r\n parentBone.getRotationMatrixToRef(Space.WORLD, this.mesh, spaceMat);\r\n } else if (this.upAxisSpace == Space.LOCAL && upAxis.y == 1 && !parentBone) {\r\n spaceMat.copyFrom(mesh.getWorldMatrix());\r\n } else {\r\n let forwardAxis = BoneLookController._TmpVecs[2];\r\n forwardAxis.copyFrom(this._fowardAxis);\r\n\r\n if (this._transformYawPitch) {\r\n Vector3.TransformCoordinatesToRef(forwardAxis, this._transformYawPitchInv, forwardAxis);\r\n }\r\n\r\n if (parentBone) {\r\n parentBone.getDirectionToRef(forwardAxis, this.mesh, forwardAxis);\r\n } else {\r\n mesh.getDirectionToRef(forwardAxis, forwardAxis);\r\n }\r\n\r\n const rightAxis = Vector3.Cross(upAxis, forwardAxis);\r\n rightAxis.normalize();\r\n forwardAxis = Vector3.Cross(rightAxis, upAxis);\r\n\r\n Matrix.FromXYZAxesToRef(rightAxis, upAxis, forwardAxis, spaceMat);\r\n }\r\n\r\n spaceMat.invertToRef(spaceMatInv);\r\n\r\n let xzlen: Nullable<number> = null;\r\n\r\n if (checkPitch) {\r\n const localTarget = BoneLookController._TmpVecs[3];\r\n target.subtractToRef(bonePos, localTarget);\r\n Vector3.TransformCoordinatesToRef(localTarget, spaceMatInv, localTarget);\r\n\r\n xzlen = Math.sqrt(localTarget.x * localTarget.x + localTarget.z * localTarget.z);\r\n const pitch = Math.atan2(localTarget.y, xzlen);\r\n let newPitch = pitch;\r\n\r\n if (pitch > this._maxPitch) {\r\n localTarget.y = this._maxPitchTan * xzlen;\r\n newPitch = this._maxPitch;\r\n } else if (pitch < this._minPitch) {\r\n localTarget.y = this._minPitchTan * xzlen;\r\n newPitch = this._minPitch;\r\n }\r\n\r\n if (pitch != newPitch) {\r\n Vector3.TransformCoordinatesToRef(localTarget, spaceMat, localTarget);\r\n localTarget.addInPlace(bonePos);\r\n target = localTarget;\r\n }\r\n }\r\n\r\n if (checkYaw) {\r\n const localTarget = BoneLookController._TmpVecs[4];\r\n target.subtractToRef(bonePos, localTarget);\r\n Vector3.TransformCoordinatesToRef(localTarget, spaceMatInv, localTarget);\r\n\r\n const yaw = Math.atan2(localTarget.x, localTarget.z);\r\n const yawCheck = this.useAbsoluteValueForYaw ? Math.abs(yaw) : yaw;\r\n let newYaw = yaw;\r\n\r\n if (yawCheck > this._maxYaw || yawCheck < this._minYaw) {\r\n if (xzlen == null) {\r\n xzlen = Math.sqrt(localTarget.x * localTarget.x + localTarget.z * localTarget.z);\r\n }\r\n\r\n if (this._yawRange > Math.PI) {\r\n if (this._isAngleBetween(yaw, this._maxYaw, this._midYawConstraint)) {\r\n localTarget.z = this._maxYawCos * xzlen;\r\n localTarget.x = this._maxYawSin * xzlen;\r\n newYaw = this._maxYaw;\r\n } else if (this._isAngleBetween(yaw, this._midYawConstraint, this._minYaw)) {\r\n localTarget.z = this._minYawCos * xzlen;\r\n localTarget.x = this._minYawSin * xzlen;\r\n newYaw = this._minYaw;\r\n }\r\n } else {\r\n if (yawCheck > this._maxYaw) {\r\n localTarget.z = this._maxYawCos * xzlen;\r\n localTarget.x = this._maxYawSin * xzlen;\r\n if (yaw < 0 && this.useAbsoluteValueForYaw) {\r\n localTarget.x *= -1;\r\n }\r\n newYaw = this._maxYaw;\r\n } else if (yawCheck < this._minYaw) {\r\n localTarget.z = this._minYawCos * xzlen;\r\n localTarget.x = this._minYawSin * xzlen;\r\n if (yaw < 0 && this.useAbsoluteValueForYaw) {\r\n localTarget.x *= -1;\r\n }\r\n newYaw = this._minYaw;\r\n }\r\n }\r\n }\r\n\r\n if (this._slerping && this._yawRange > Math.PI) {\r\n //are we going to be crossing into the min/max region?\r\n const boneFwd = BoneLookController._TmpVecs[8];\r\n boneFwd.copyFrom(Axis.Z);\r\n if (this._transformYawPitch) {\r\n Vector3.TransformCoordinatesToRef(boneFwd, this._transformYawPitchInv, boneFwd);\r\n }\r\n\r\n const boneRotMat = BoneLookController._TmpMats[4];\r\n this._boneQuat.toRotationMatrix(boneRotMat);\r\n this.mesh.getWorldMatrix().multiplyToRef(boneRotMat, boneRotMat);\r\n Vector3.TransformCoordinatesToRef(boneFwd, boneRotMat, boneFwd);\r\n Vector3.TransformCoordinatesToRef(boneFwd, spaceMatInv, boneFwd);\r\n\r\n const boneYaw = Math.atan2(boneFwd.x, boneFwd.z);\r\n const angBtwTar = this._getAngleBetween(boneYaw, yaw);\r\n const angBtwMidYaw = this._getAngleBetween(boneYaw, this._midYawConstraint);\r\n\r\n if (angBtwTar > angBtwMidYaw) {\r\n if (xzlen == null) {\r\n xzlen = Math.sqrt(localTarget.x * localTarget.x + localTarget.z * localTarget.z);\r\n }\r\n\r\n const angBtwMax = this._getAngleBetween(boneYaw, this._maxYaw);\r\n const angBtwMin = this._getAngleBetween(boneYaw, this._minYaw);\r\n\r\n if (angBtwMin < angBtwMax) {\r\n newYaw = boneYaw + Math.PI * 0.75;\r\n localTarget.z = Math.cos(newYaw) * xzlen;\r\n localTarget.x = Math.sin(newYaw) * xzlen;\r\n } else {\r\n newYaw = boneYaw - Math.PI * 0.75;\r\n localTarget.z = Math.cos(newYaw) * xzlen;\r\n localTarget.x = Math.sin(newYaw) * xzlen;\r\n }\r\n }\r\n }\r\n\r\n if (yaw != newYaw) {\r\n Vector3.TransformCoordinatesToRef(localTarget, spaceMat, localTarget);\r\n localTarget.addInPlace(bonePos);\r\n target = localTarget;\r\n }\r\n }\r\n }\r\n\r\n const zaxis = BoneLookController._TmpVecs[5];\r\n const xaxis = BoneLookController._TmpVecs[6];\r\n const yaxis = BoneLookController._TmpVecs[7];\r\n const tmpQuat = BoneLookController._TmpQuat;\r\n const boneScaling = BoneLookController._TmpVecs[9];\r\n\r\n target.subtractToRef(bonePos, zaxis);\r\n zaxis.normalize();\r\n Vector3.CrossToRef(upAxis, zaxis, xaxis);\r\n xaxis.normalize();\r\n Vector3.CrossToRef(zaxis, xaxis, yaxis);\r\n yaxis.normalize();\r\n Matrix.FromXYZAxesToRef(xaxis, yaxis, zaxis, _tmpMat1);\r\n\r\n if (xaxis.x === 0 && xaxis.y === 0 && xaxis.z === 0) {\r\n return;\r\n }\r\n\r\n if (yaxis.x === 0 && yaxis.y === 0 && yaxis.z === 0) {\r\n return;\r\n }\r\n\r\n if (zaxis.x === 0 && zaxis.y === 0 && zaxis.z === 0) {\r\n return;\r\n }\r\n\r\n if (this.adjustYaw || this.adjustPitch || this.adjustRoll) {\r\n Matrix.RotationYawPitchRollToRef(this.adjustYaw, this.adjustPitch, this.adjustRoll, _tmpMat2);\r\n _tmpMat2.multiplyToRef(_tmpMat1, _tmpMat1);\r\n }\r\n\r\n boneScaling.copyFrom(this.bone.getScale());\r\n\r\n if (this.slerpAmount < 1) {\r\n if (!this._slerping) {\r\n this.bone.getRotationQuaternionToRef(Space.WORLD, this.mesh, this._boneQuat);\r\n }\r\n if (this._transformYawPitch) {\r\n this._transformYawPitch.multiplyToRef(_tmpMat1, _tmpMat1);\r\n }\r\n Quaternion.FromRotationMatrixToRef(_tmpMat1, tmpQuat);\r\n Quaternion.SlerpToRef(this._boneQuat, tmpQuat, this.slerpAmount, this._boneQuat);\r\n\r\n this.bone.setRotationQuaternion(this._boneQuat, Space.WORLD, this.mesh);\r\n this._slerping = true;\r\n } else {\r\n if (this._transformYawPitch) {\r\n this._transformYawPitch.multiplyToRef(_tmpMat1, _tmpMat1);\r\n }\r\n this.bone.setRotationMatrix(_tmpMat1, Space.WORLD, this.mesh);\r\n this._slerping = false;\r\n }\r\n\r\n this.bone.setScale(boneScaling);\r\n\r\n this._updateLinkedTransformRotation();\r\n }\r\n\r\n private _getAngleDiff(ang1: number, ang2: number): number {\r\n let angDiff = ang2 - ang1;\r\n angDiff %= Math.PI * 2;\r\n\r\n if (angDiff > Math.PI) {\r\n angDiff -= Math.PI * 2;\r\n } else if (angDiff < -Math.PI) {\r\n angDiff += Math.PI * 2;\r\n }\r\n\r\n return angDiff;\r\n }\r\n\r\n private _getAngleBetween(ang1: number, ang2: number): number {\r\n ang1 %= 2 * Math.PI;\r\n ang1 = ang1 < 0 ? ang1 + 2 * Math.PI : ang1;\r\n\r\n ang2 %= 2 * Math.PI;\r\n ang2 = ang2 < 0 ? ang2 + 2 * Math.PI : ang2;\r\n\r\n let ab = 0;\r\n\r\n if (ang1 < ang2) {\r\n ab = ang2 - ang1;\r\n } else {\r\n ab = ang1 - ang2;\r\n }\r\n\r\n if (ab > Math.PI) {\r\n ab = Math.PI * 2 - ab;\r\n }\r\n\r\n return ab;\r\n }\r\n\r\n private _isAngleBetween(ang: number, ang1: number, ang2: number): boolean {\r\n ang %= 2 * Math.PI;\r\n ang = ang < 0 ? ang + 2 * Math.PI : ang;\r\n ang1 %= 2 * Math.PI;\r\n ang1 = ang1 < 0 ? ang1 + 2 * Math.PI : ang1;\r\n ang2 %= 2 * Math.PI;\r\n ang2 = ang2 < 0 ? ang2 + 2 * Math.PI : ang2;\r\n\r\n if (ang1 < ang2) {\r\n if (ang > ang1 && ang < ang2) {\r\n return true;\r\n }\r\n } else {\r\n if (ang > ang2 && ang < ang1) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n\r\n private _updateLinkedTransformRotation(): void {\r\n const bone = this.bone;\r\n if (bone._linkedTransformNode) {\r\n if (!bone._linkedTransformNode.rotationQuaternion) {\r\n bone._linkedTransformNode.rotationQuaternion = new Quaternion();\r\n }\r\n bone.getRotationQuaternionToRef(Space.LOCAL, null, bone._linkedTransformNode.rotationQuaternion);\r\n }\r\n }\r\n}\r\n"]}
|
|
@@ -59,7 +59,7 @@ export function checkNonFloatVertexBuffers(vertexBuffers, effect) {
|
|
|
59
59
|
if ((currentVertexBufferType !== VertexBuffer.FLOAT && vertexBufferType === undefined) ||
|
|
60
60
|
(vertexBufferType !== undefined && vertexBufferType !== currentVertexBufferType)) {
|
|
61
61
|
if (!shaderProcessingContext) {
|
|
62
|
-
shaderProcessingContext = engine._getShaderProcessingContext(effect.shaderLanguage);
|
|
62
|
+
shaderProcessingContext = engine._getShaderProcessingContext(effect.shaderLanguage, false);
|
|
63
63
|
}
|
|
64
64
|
pipelineContext.vertexBufferKindToType[kind] = currentVertexBufferType;
|
|
65
65
|
if (currentVertexBufferType !== VertexBuffer.FLOAT) {
|