@onerjs/core 8.25.1 → 8.25.3

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.
Files changed (119) hide show
  1. package/Bones/bone.js +14 -54
  2. package/Bones/bone.js.map +1 -1
  3. package/Engines/AbstractEngine/abstractEngine.cubeTexture.js +1 -1
  4. package/Engines/AbstractEngine/abstractEngine.cubeTexture.js.map +1 -1
  5. package/Engines/Native/nativeShaderProcessors.js +3 -0
  6. package/Engines/Native/nativeShaderProcessors.js.map +1 -1
  7. package/Engines/WebGL/webGL2ShaderProcessors.js +3 -0
  8. package/Engines/WebGL/webGL2ShaderProcessors.js.map +1 -1
  9. package/Engines/WebGPU/webgpuShaderProcessorsGLSL.d.ts +3 -1
  10. package/Engines/WebGPU/webgpuShaderProcessorsGLSL.js +4 -1
  11. package/Engines/WebGPU/webgpuShaderProcessorsGLSL.js.map +1 -1
  12. package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js +4 -1
  13. package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js.map +1 -1
  14. package/Engines/abstractEngine.d.ts +1 -1
  15. package/Engines/abstractEngine.functions.d.ts +2 -2
  16. package/Engines/abstractEngine.functions.js.map +1 -1
  17. package/Engines/abstractEngine.js +2 -2
  18. package/Engines/abstractEngine.js.map +1 -1
  19. package/Engines/nullEngine.js +1 -0
  20. package/Engines/nullEngine.js.map +1 -1
  21. package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.d.ts +3 -0
  22. package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.js +10 -0
  23. package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.js.map +1 -1
  24. package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.d.ts +3 -0
  25. package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.js +10 -0
  26. package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.js.map +1 -1
  27. package/FrameGraph/Node/Blocks/Rendering/objectRendererBlock.js +8 -0
  28. package/FrameGraph/Node/Blocks/Rendering/objectRendererBlock.js.map +1 -1
  29. package/FrameGraph/Node/Blocks/Rendering/taaObjectRendererBlock.js +16 -0
  30. package/FrameGraph/Node/Blocks/Rendering/taaObjectRendererBlock.js.map +1 -1
  31. package/FrameGraph/Node/Blocks/inputBlock.js +2 -0
  32. package/FrameGraph/Node/Blocks/inputBlock.js.map +1 -1
  33. package/FrameGraph/Tasks/Rendering/geometryRendererTask.d.ts +6 -0
  34. package/FrameGraph/Tasks/Rendering/geometryRendererTask.js +16 -0
  35. package/FrameGraph/Tasks/Rendering/geometryRendererTask.js.map +1 -1
  36. package/FrameGraph/Tasks/Rendering/objectRendererTask.d.ts +8 -1
  37. package/FrameGraph/Tasks/Rendering/objectRendererTask.js +40 -1
  38. package/FrameGraph/Tasks/Rendering/objectRendererTask.js.map +1 -1
  39. package/FrameGraph/Tasks/Rendering/taaObjectRendererTask.d.ts +3 -1
  40. package/FrameGraph/Tasks/Rendering/taaObjectRendererTask.js +10 -7
  41. package/FrameGraph/Tasks/Rendering/taaObjectRendererTask.js.map +1 -1
  42. package/FrameGraph/frameGraph.d.ts +2 -2
  43. package/FrameGraph/frameGraph.js.map +1 -1
  44. package/FrameGraph/frameGraphTextureManager.js +4 -0
  45. package/FrameGraph/frameGraphTextureManager.js.map +1 -1
  46. package/Gizmos/cameraGizmo.js +11 -13
  47. package/Gizmos/cameraGizmo.js.map +1 -1
  48. package/Gizmos/planeDragGizmo.js +21 -13
  49. package/Gizmos/planeDragGizmo.js.map +1 -1
  50. package/Loading/sceneLoader.d.ts +3 -1
  51. package/Loading/sceneLoader.js +3 -2
  52. package/Loading/sceneLoader.js.map +1 -1
  53. package/Materials/Background/backgroundMaterial.js +1 -1
  54. package/Materials/Background/backgroundMaterial.js.map +1 -1
  55. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js +1 -1
  56. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js.map +1 -1
  57. package/Materials/Node/nodeMaterial.d.ts +1 -1
  58. package/Materials/Node/nodeMaterial.js +3 -14
  59. package/Materials/Node/nodeMaterial.js.map +1 -1
  60. package/Materials/PBR/pbrBaseMaterial.js +1 -1
  61. package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
  62. package/Materials/Textures/renderTargetTexture.d.ts +5 -0
  63. package/Materials/Textures/renderTargetTexture.js +9 -0
  64. package/Materials/Textures/renderTargetTexture.js.map +1 -1
  65. package/Materials/material.d.ts +17 -1
  66. package/Materials/material.js +38 -7
  67. package/Materials/material.js.map +1 -1
  68. package/Materials/materialDefines.d.ts +1 -0
  69. package/Materials/materialDefines.js +1 -0
  70. package/Materials/materialDefines.js.map +1 -1
  71. package/Materials/materialHelper.functions.d.ts +2 -1
  72. package/Materials/materialHelper.functions.js +3 -1
  73. package/Materials/materialHelper.functions.js.map +1 -1
  74. package/Materials/standardMaterial.js +1 -1
  75. package/Materials/standardMaterial.js.map +1 -1
  76. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +3 -10
  77. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
  78. package/Meshes/geometry.js +4 -4
  79. package/Meshes/geometry.js.map +1 -1
  80. package/Misc/assetsManager.d.ts +81 -25
  81. package/Misc/assetsManager.js +70 -32
  82. package/Misc/assetsManager.js.map +1 -1
  83. package/Misc/fileTools.d.ts +2 -2
  84. package/Misc/fileTools.js +3 -1
  85. package/Misc/fileTools.js.map +1 -1
  86. package/Misc/sceneSerializer.js +3 -1
  87. package/Misc/sceneSerializer.js.map +1 -1
  88. package/Particles/IParticleSystem.d.ts +6 -0
  89. package/Particles/IParticleSystem.js.map +1 -1
  90. package/Particles/gpuParticleSystem.d.ts +4 -0
  91. package/Particles/gpuParticleSystem.js +4 -0
  92. package/Particles/gpuParticleSystem.js.map +1 -1
  93. package/Particles/thinParticleSystem.d.ts +14 -0
  94. package/Particles/thinParticleSystem.js +19 -0
  95. package/Particles/thinParticleSystem.js.map +1 -1
  96. package/Physics/joinedPhysicsEngineComponent.js +1 -1
  97. package/Physics/joinedPhysicsEngineComponent.js.map +1 -1
  98. package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.d.ts +5 -3
  99. package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js +22 -9
  100. package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js.map +1 -1
  101. package/PostProcesses/RenderPipeline/Pipelines/taaMaterialManager.js +3 -0
  102. package/PostProcesses/RenderPipeline/Pipelines/taaMaterialManager.js.map +1 -1
  103. package/Rendering/objectRenderer.d.ts +18 -2
  104. package/Rendering/objectRenderer.js +69 -29
  105. package/Rendering/objectRenderer.js.map +1 -1
  106. package/Rendering/outlineRenderer.d.ts +4 -0
  107. package/Rendering/outlineRenderer.js +10 -0
  108. package/Rendering/outlineRenderer.js.map +1 -1
  109. package/Shaders/pbr.vertex.js +1 -5
  110. package/Shaders/pbr.vertex.js.map +1 -1
  111. package/Shaders/ssao2.fragment.js +14 -2
  112. package/Shaders/ssao2.fragment.js.map +1 -1
  113. package/ShadersWGSL/ssao2.fragment.js +14 -2
  114. package/ShadersWGSL/ssao2.fragment.js.map +1 -1
  115. package/XR/features/WebXRDepthSensing.js +6 -2
  116. package/XR/features/WebXRDepthSensing.js.map +1 -1
  117. package/package.json +1 -1
  118. package/scene.js +2 -0
  119. package/scene.js.map +1 -1
package/Bones/bone.js CHANGED
@@ -267,6 +267,7 @@ export class Bone extends Node {
267
267
  * @returns the bone matrix, in world space
268
268
  */
269
269
  getAbsoluteMatrix() {
270
+ this._skeleton.computeAbsoluteMatrices();
270
271
  return this._absoluteMatrix;
271
272
  }
272
273
  /**
@@ -275,7 +276,7 @@ export class Bone extends Node {
275
276
  * @deprecated Please use getAbsoluteMatrix instead
276
277
  */
277
278
  getAbsoluteTransform() {
278
- return this._absoluteMatrix;
279
+ return this.getAbsoluteMatrix();
279
280
  }
280
281
  /**
281
282
  * Links with the given transform node.
@@ -432,21 +433,12 @@ export class Bone extends Node {
432
433
  }
433
434
  }
434
435
  else {
435
- let wm = null;
436
- //tNode.getWorldMatrix() needs to be called before skeleton.computeAbsoluteMatrices()
437
- if (tNode) {
438
- wm = tNode.getWorldMatrix();
439
- }
440
- this._skeleton.computeAbsoluteMatrices();
441
436
  const tmat = Bone._TmpMats[0];
442
437
  const tvec = Bone._TmpVecs[0];
443
438
  if (this.parent) {
444
- if (tNode && wm) {
445
- tmat.copyFrom(this.parent.getAbsoluteMatrix());
446
- tmat.multiplyToRef(wm, tmat);
447
- }
448
- else {
449
- tmat.copyFrom(this.parent.getAbsoluteMatrix());
439
+ tmat.copyFrom(this.parent.getAbsoluteMatrix());
440
+ if (tNode) {
441
+ tmat.multiplyToRef(tNode.getWorldMatrix(), tmat);
450
442
  }
451
443
  }
452
444
  else {
@@ -698,7 +690,6 @@ export class Bone extends Node {
698
690
  }
699
691
  }
700
692
  lmat.setTranslationFromFloats(lx, ly, lz);
701
- this.computeAbsoluteMatrices();
702
693
  this._markAsDirtyAndDecompose();
703
694
  }
704
695
  _getAbsoluteInverseMatrixUnscaledToRef(rotMatInv, tNode) {
@@ -746,19 +737,9 @@ export class Bone extends Node {
746
737
  result.z = lm.m[14];
747
738
  }
748
739
  else {
749
- let wm = null;
750
- //tNode.getWorldMatrix() needs to be called before skeleton.computeAbsoluteMatrices()
740
+ const tmat = Bone._TmpMats[0].copyFrom(this.getAbsoluteMatrix());
751
741
  if (tNode) {
752
- wm = tNode.getWorldMatrix();
753
- }
754
- this._skeleton.computeAbsoluteMatrices();
755
- let tmat = Bone._TmpMats[0];
756
- if (tNode && wm) {
757
- tmat.copyFrom(this.getAbsoluteMatrix());
758
- tmat.multiplyToRef(wm, tmat);
759
- }
760
- else {
761
- tmat = this.getAbsoluteMatrix();
742
+ tmat.multiplyToRef(tNode.getWorldMatrix(), tmat);
762
743
  }
763
744
  result.x = tmat.m[12];
764
745
  result.y = tmat.m[13];
@@ -829,18 +810,11 @@ export class Bone extends Node {
829
810
  * @param result The vector3 that the world direction will be copied to
830
811
  */
831
812
  getDirectionToRef(localAxis, tNode = null, result) {
832
- let wm = null;
833
- //tNode.getWorldMatrix() needs to be called before skeleton.computeAbsoluteMatrices()
813
+ const tMat = Bone._TmpMats[0].copyFrom(this.getAbsoluteMatrix());
834
814
  if (tNode) {
835
- wm = tNode.getWorldMatrix();
836
- }
837
- this._skeleton.computeAbsoluteMatrices();
838
- const mat = Bone._TmpMats[0];
839
- mat.copyFrom(this.getAbsoluteMatrix());
840
- if (tNode && wm) {
841
- mat.multiplyToRef(wm, mat);
815
+ tMat.multiplyToRef(tNode.getWorldMatrix(), tMat);
842
816
  }
843
- Vector3.TransformNormalToRef(localAxis, mat, result);
817
+ Vector3.TransformNormalToRef(localAxis, tMat, result);
844
818
  result.normalize();
845
819
  }
846
820
  /**
@@ -956,16 +930,9 @@ export class Bone extends Node {
956
930
  * @param result The vector3 that the world position should be copied to
957
931
  */
958
932
  getAbsolutePositionFromLocalToRef(position, tNode = null, result) {
959
- let wm = null;
960
- //tNode.getWorldMatrix() needs to be called before skeleton.computeAbsoluteMatrices()
933
+ const tmat = Bone._TmpMats[0].copyFrom(this.getAbsoluteMatrix());
961
934
  if (tNode) {
962
- wm = tNode.getWorldMatrix();
963
- }
964
- this._skeleton.computeAbsoluteMatrices();
965
- const tmat = Bone._TmpMats[0];
966
- tmat.copyFrom(this.getAbsoluteMatrix());
967
- if (tNode && wm) {
968
- tmat.multiplyToRef(wm, tmat);
935
+ tmat.multiplyToRef(tNode.getWorldMatrix(), tmat);
969
936
  }
970
937
  Vector3.TransformCoordinatesToRef(position, tmat, result);
971
938
  }
@@ -987,16 +954,9 @@ export class Bone extends Node {
987
954
  * @param result The vector3 that the local position should be copied to
988
955
  */
989
956
  getLocalPositionFromAbsoluteToRef(position, tNode = null, result) {
990
- let wm = null;
991
- //tNode.getWorldMatrix() needs to be called before skeleton.computeAbsoluteMatrices()
957
+ const tmat = Bone._TmpMats[0].copyFrom(this.getAbsoluteMatrix());
992
958
  if (tNode) {
993
- wm = tNode.getWorldMatrix();
994
- }
995
- this._skeleton.computeAbsoluteMatrices();
996
- const tmat = Bone._TmpMats[0];
997
- tmat.copyFrom(this.getAbsoluteMatrix());
998
- if (tNode && wm) {
999
- tmat.multiplyToRef(wm, tmat);
959
+ tmat.multiplyToRef(tNode.getWorldMatrix(), tmat);
1000
960
  }
1001
961
  tmat.invert();
1002
962
  Vector3.TransformCoordinatesToRef(position, tmat, result);
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,CAAC;YAC5E,OAAO;QACX,CAAC;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,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vB,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC;IAC9C,CAAC;IAED;;OAEG;IACa,OAAO;QACnB,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC;QAEjC,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACjD,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE,CAAC;YACf,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QAC1C,CAAC;QAED,IAAI,IAAI,CAAC,WAAW,IAAK,IAAI,CAAC,WAAoB,CAAC,QAAQ,EAAE,CAAC;YAC1D,MAAM,QAAQ,GAAI,IAAI,CAAC,WAAoB,CAAC,QAAQ,CAAC;YACrD,MAAM,KAAK,GAAG,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YACrC,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE,CAAC;gBACf,QAAQ,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;YAC9B,CAAC;QACL,CAAC;QAED,KAAK,CAAC,OAAO,EAAE,CAAC;IACpB,CAAC;;AArtCc,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 /**\r\n * Releases associated resources\r\n */\r\n public override dispose(): void {\r\n this._linkedTransformNode = null;\r\n\r\n const index = this._skeleton.bones.indexOf(this);\r\n if (index !== -1) {\r\n this._skeleton.bones.splice(index, 1);\r\n }\r\n\r\n if (this._parentNode && (this._parentNode as Bone).children) {\r\n const children = (this._parentNode as Bone).children;\r\n const index = children.indexOf(this);\r\n if (index !== -1) {\r\n children.splice(index, 1);\r\n }\r\n }\r\n\r\n super.dispose();\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,gBAA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IAAI,KAAK,KAAK,CAAC,CAAC,EAAE,CAAC;gBACf,QAAQ,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;YAC9B,CAAC;QACL,CAAC;QAED,KAAK,CAAC,OAAO,EAAE,CAAC;IACpB,CAAC;;AA7pCc,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 this._skeleton.computeAbsoluteMatrices();\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.getAbsoluteMatrix();\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 const tmat = Bone._TmpMats[0];\r\n const tvec = Bone._TmpVecs[0];\r\n\r\n if (this.parent) {\r\n tmat.copyFrom(this.parent.getAbsoluteMatrix());\r\n if (tNode) {\r\n tmat.multiplyToRef(tNode.getWorldMatrix(), tmat);\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._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 const tmat = Bone._TmpMats[0].copyFrom(this.getAbsoluteMatrix());\r\n\r\n if (tNode) {\r\n tmat.multiplyToRef(tNode.getWorldMatrix(), tmat);\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 const tMat = Bone._TmpMats[0].copyFrom(this.getAbsoluteMatrix());\r\n\r\n if (tNode) {\r\n tMat.multiplyToRef(tNode.getWorldMatrix(), tMat);\r\n }\r\n\r\n Vector3.TransformNormalToRef(localAxis, tMat, 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 const tmat = Bone._TmpMats[0].copyFrom(this.getAbsoluteMatrix());\r\n\r\n if (tNode) {\r\n tmat.multiplyToRef(tNode.getWorldMatrix(), 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 const tmat = Bone._TmpMats[0].copyFrom(this.getAbsoluteMatrix());\r\n\r\n if (tNode) {\r\n tmat.multiplyToRef(tNode.getWorldMatrix(), 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 /**\r\n * Releases associated resources\r\n */\r\n public override dispose(): void {\r\n this._linkedTransformNode = null;\r\n\r\n const index = this._skeleton.bones.indexOf(this);\r\n if (index !== -1) {\r\n this._skeleton.bones.splice(index, 1);\r\n }\r\n\r\n if (this._parentNode && (this._parentNode as Bone).children) {\r\n const children = (this._parentNode as Bone).children;\r\n const index = children.indexOf(this);\r\n if (index !== -1) {\r\n children.splice(index, 1);\r\n }\r\n }\r\n\r\n super.dispose();\r\n }\r\n}\r\n"]}
@@ -126,7 +126,7 @@ AbstractEngine.prototype.createCubeTextureBase = function (rootUrl, scene, files
126
126
  }
127
127
  }
128
128
  else {
129
- this._loadFile(rootUrl, (data) => onLoadData(new Uint8Array(data)), undefined, undefined, true, onInternalError);
129
+ this._loadFile(rootUrl, (data) => onLoadData(new Uint8Array(data)), undefined, scene ? scene.offlineProvider || null : undefined, true, onInternalError);
130
130
  }
131
131
  });
132
132
  }
@@ -1 +1 @@
1
- {"version":3,"file":"abstractEngine.cubeTexture.js","sourceRoot":"","sources":["../../../../../dev/core/src/Engines/AbstractEngine/abstractEngine.cubeTexture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAyB,MAAM,0CAA0C,CAAC;AAClG,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAG3C,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,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K,EAAE,YAAY,CAAC,CAAC;gBAC7H,CAAC;qBAAM,CAAC;oBACJ,YAAY,CAAC,0CAA0C,CAAC,CAAC;gBAC7D,CAAC;YACL,CAAC;iBAAM,CAAC;gBACJ,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,UAAU,CAAC,IAAmB,CAAC,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,eAAe,CAAC,CAAC;YACpI,CAAC;QACL,CAAC,CAAC,CAAC;IACP,CAAC;SAAM,CAAC;QACJ,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC/B,MAAM,IAAI,KAAK,CAAC,0FAA0F,CAAC,CAAC;QAChH,CAAC;QAED,IAAI,CAAC,gBAAgB,CACjB,KAAK,EACL,OAAO,EACP,CAAC,OAAwB,EAAE,IAAwC,EAAE,EAAE;YACnE,IAAI,YAAY,EAAE,CAAC;gBACf,YAAY,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;YAChC,CAAC;QACL,CAAC,EACD,KAAK,EACL,YAAY,CACf,CAAC;IACN,CAAC;IAED,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAE1C,OAAO,OAAO,CAAC;AACnB,CAAC,CAAC","sourcesContent":["import { InternalTexture, InternalTextureSource } from \"../../Materials/Textures/internalTexture\";\r\nimport { Logger } from \"../../Misc/logger\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { Scene } from \"../../scene\";\r\nimport { LoadImage } from \"../../Misc/fileTools\";\r\nimport { RandomGUID } from \"../../Misc/guid\";\r\nimport type { IWebRequest } from \"../../Misc/interfaces/iWebRequest\";\r\nimport { AbstractEngine } from \"../abstractEngine\";\r\nimport { _GetCompatibleTextureLoader } from \"core/Materials/Textures/Loaders/textureLoaderManager\";\r\nimport { GetExtensionFromUrl } from \"core/Misc/urlTools\";\r\n\r\ndeclare module \"../../Engines/abstractEngine\" {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n export interface AbstractEngine {\r\n /** @internal */\r\n createCubeTextureBase(\r\n rootUrl: string,\r\n scene: Nullable<Scene>,\r\n files: Nullable<string[]>,\r\n noMipmap: boolean,\r\n onLoad: Nullable<(data?: any) => void>,\r\n onError: Nullable<(message?: string, exception?: any) => void>,\r\n format: number | undefined,\r\n forcedExtension: any,\r\n createPolynomials: boolean,\r\n lodScale: number,\r\n lodOffset: number,\r\n fallback: Nullable<InternalTexture>,\r\n beforeLoadCubeDataCallback: Nullable<(texture: InternalTexture, data: ArrayBufferView | ArrayBufferView[]) => void>,\r\n imageHandler: Nullable<(texture: InternalTexture, imgs: HTMLImageElement[] | ImageBitmap[]) => void>,\r\n useSRGBBuffer: boolean,\r\n buffer: Nullable<ArrayBufferView>\r\n ): InternalTexture;\r\n\r\n /** @internal */\r\n _partialLoadFile(\r\n url: string,\r\n index: number,\r\n loadedFiles: ArrayBuffer[],\r\n onfinish: (files: ArrayBuffer[]) => void,\r\n onErrorCallBack: Nullable<(message?: string, exception?: any) => void>\r\n ): void;\r\n\r\n /** @internal */\r\n _cascadeLoadFiles(scene: Nullable<Scene>, onfinish: (images: ArrayBuffer[]) => void, files: string[], onError: Nullable<(message?: string, exception?: any) => void>): void;\r\n\r\n /** @internal */\r\n _cascadeLoadImgs(\r\n scene: Nullable<Scene>,\r\n texture: InternalTexture,\r\n onfinish: Nullable<(texture: InternalTexture, images: HTMLImageElement[] | ImageBitmap[]) => void>,\r\n files: string[],\r\n onError: Nullable<(message?: string, exception?: any) => void>,\r\n mimeType?: string\r\n ): void;\r\n\r\n /** @internal */\r\n _partialLoadImg(\r\n url: string,\r\n index: number,\r\n loadedImages: HTMLImageElement[] | ImageBitmap[],\r\n scene: Nullable<Scene>,\r\n texture: InternalTexture,\r\n onfinish: Nullable<(texture: InternalTexture, images: HTMLImageElement[] | ImageBitmap[]) => void>,\r\n onErrorCallBack: Nullable<(message?: string, exception?: any) => void>,\r\n mimeType?: string\r\n ): void;\r\n }\r\n}\r\n\r\nAbstractEngine.prototype._partialLoadFile = function (\r\n url: string,\r\n index: number,\r\n loadedFiles: ArrayBuffer[],\r\n onfinish: (files: ArrayBuffer[]) => void,\r\n onErrorCallBack: Nullable<(message?: string, exception?: any) => void> = null\r\n): void {\r\n const onload = (data: ArrayBuffer) => {\r\n loadedFiles[index] = data;\r\n (<any>loadedFiles)._internalCount++;\r\n\r\n if ((<any>loadedFiles)._internalCount === 6) {\r\n onfinish(loadedFiles);\r\n }\r\n };\r\n\r\n const onerror = (request?: IWebRequest, exception?: any) => {\r\n if (onErrorCallBack && request) {\r\n onErrorCallBack(request.status + \" \" + request.statusText, exception);\r\n }\r\n };\r\n\r\n this._loadFile(url, onload as (data: string | ArrayBuffer) => void, undefined, undefined, true, onerror);\r\n};\r\n\r\nAbstractEngine.prototype._cascadeLoadFiles = function (\r\n scene: Nullable<Scene>,\r\n onfinish: (images: ArrayBuffer[]) => void,\r\n files: string[],\r\n onError: Nullable<(message?: string, exception?: any) => void> = null\r\n): void {\r\n const loadedFiles: ArrayBuffer[] = [];\r\n (<any>loadedFiles)._internalCount = 0;\r\n\r\n for (let index = 0; index < 6; index++) {\r\n this._partialLoadFile(files[index], index, loadedFiles, onfinish, onError);\r\n }\r\n};\r\n\r\nAbstractEngine.prototype._cascadeLoadImgs = function (\r\n scene: Nullable<Scene>,\r\n texture: InternalTexture,\r\n onfinish: Nullable<(texture: InternalTexture, images: HTMLImageElement[] | ImageBitmap[]) => void>,\r\n files: string[],\r\n onError: Nullable<(message?: string, exception?: any) => void> = null,\r\n mimeType?: string\r\n) {\r\n const loadedImages: HTMLImageElement[] | ImageBitmap[] = [];\r\n (<any>loadedImages)._internalCount = 0;\r\n\r\n for (let index = 0; index < 6; index++) {\r\n this._partialLoadImg(files[index], index, loadedImages, scene, texture, onfinish, onError, mimeType);\r\n }\r\n};\r\n\r\nAbstractEngine.prototype._partialLoadImg = function (\r\n url: string,\r\n index: number,\r\n loadedImages: HTMLImageElement[] | ImageBitmap[],\r\n scene: Nullable<Scene>,\r\n texture: InternalTexture,\r\n onfinish: Nullable<(texture: InternalTexture, images: HTMLImageElement[] | ImageBitmap[]) => void>,\r\n onErrorCallBack: Nullable<(message?: string, exception?: any) => void> = null,\r\n mimeType?: string\r\n) {\r\n const tokenPendingData = RandomGUID();\r\n\r\n const onload = (img: HTMLImageElement | ImageBitmap) => {\r\n loadedImages[index] = img;\r\n (<any>loadedImages)._internalCount++;\r\n\r\n if (scene) {\r\n scene.removePendingData(tokenPendingData);\r\n }\r\n\r\n if ((<any>loadedImages)._internalCount === 6 && onfinish) {\r\n onfinish(texture, loadedImages);\r\n }\r\n };\r\n\r\n const onerror = (message?: string, exception?: any) => {\r\n if (scene) {\r\n scene.removePendingData(tokenPendingData);\r\n }\r\n\r\n if (onErrorCallBack) {\r\n onErrorCallBack(message, exception);\r\n }\r\n };\r\n\r\n LoadImage(url, onload, onerror, scene ? scene.offlineProvider : null, mimeType);\r\n if (scene) {\r\n scene.addPendingData(tokenPendingData);\r\n }\r\n};\r\n\r\nAbstractEngine.prototype.createCubeTextureBase = function (\r\n rootUrl: string,\r\n scene: Nullable<Scene>,\r\n files: Nullable<string[]>,\r\n noMipmap?: boolean,\r\n onLoad: Nullable<(data?: any) => void> = null,\r\n onError: Nullable<(message?: string, exception?: any) => void> = null,\r\n format?: number,\r\n forcedExtension: any = null,\r\n createPolynomials: boolean = false,\r\n lodScale: number = 0,\r\n lodOffset: number = 0,\r\n fallback: Nullable<InternalTexture> = null,\r\n beforeLoadCubeDataCallback: Nullable<(texture: InternalTexture, data: ArrayBufferView | ArrayBufferView[]) => void> = null,\r\n imageHandler: Nullable<(texture: InternalTexture, imgs: HTMLImageElement[] | ImageBitmap[]) => void> = null,\r\n useSRGBBuffer = false,\r\n buffer: Nullable<ArrayBufferView> = null\r\n): InternalTexture {\r\n const texture = fallback ? fallback : new InternalTexture(this, InternalTextureSource.Cube);\r\n texture.isCube = true;\r\n texture.url = rootUrl;\r\n texture.generateMipMaps = !noMipmap;\r\n texture._lodGenerationScale = lodScale;\r\n texture._lodGenerationOffset = lodOffset;\r\n texture._useSRGBBuffer = !!useSRGBBuffer && this._caps.supportSRGBBuffers && (this.version > 1 || this.isWebGPU || !!noMipmap);\r\n if (texture !== fallback) {\r\n texture.label = rootUrl.substring(0, 60); // default label, can be overriden by the caller\r\n }\r\n\r\n if (!this._doNotHandleContextLost) {\r\n texture._extension = forcedExtension;\r\n texture._files = files;\r\n texture._buffer = buffer;\r\n }\r\n\r\n const originalRootUrl = rootUrl;\r\n if (this._transformTextureUrl && !fallback) {\r\n rootUrl = this._transformTextureUrl(rootUrl);\r\n }\r\n\r\n const extension = forcedExtension ?? GetExtensionFromUrl(rootUrl);\r\n\r\n const loaderPromise = _GetCompatibleTextureLoader(extension);\r\n\r\n const localOnError = (message?: string, exception?: any) => {\r\n // if an error was thrown during load, dispose the texture, otherwise it will stay in the cache\r\n texture.dispose();\r\n if (onError) {\r\n onError(message, exception);\r\n } else if (message) {\r\n Logger.Warn(message);\r\n }\r\n };\r\n\r\n const onInternalError = (request?: IWebRequest, exception?: any) => {\r\n if (rootUrl === originalRootUrl) {\r\n if (request) {\r\n localOnError(request.status + \" \" + request.statusText, exception);\r\n }\r\n } else {\r\n // fall back to the original url if the transformed url fails to load\r\n Logger.Warn(`Failed to load ${rootUrl}, falling back to the ${originalRootUrl}`);\r\n this.createCubeTextureBase(\r\n originalRootUrl,\r\n scene,\r\n files,\r\n !!noMipmap,\r\n onLoad,\r\n localOnError,\r\n format,\r\n forcedExtension,\r\n createPolynomials,\r\n lodScale,\r\n lodOffset,\r\n texture,\r\n beforeLoadCubeDataCallback,\r\n imageHandler,\r\n useSRGBBuffer,\r\n buffer\r\n );\r\n }\r\n };\r\n\r\n if (loaderPromise) {\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises, github/no-then\r\n loaderPromise.then((loader) => {\r\n const onLoadData = (data: ArrayBufferView | ArrayBufferView[]) => {\r\n if (beforeLoadCubeDataCallback) {\r\n beforeLoadCubeDataCallback(texture, data);\r\n }\r\n loader.loadCubeData(data, texture, createPolynomials, onLoad, (message?: string, exception?: any) => {\r\n localOnError(message, exception);\r\n });\r\n };\r\n if (buffer) {\r\n onLoadData(buffer);\r\n } else if (files && files.length === 6) {\r\n if (loader.supportCascades) {\r\n this._cascadeLoadFiles(scene, (images) => onLoadData(images.map((image) => new Uint8Array(image))), files, localOnError);\r\n } else {\r\n localOnError(\"Textures type does not support cascades.\");\r\n }\r\n } else {\r\n this._loadFile(rootUrl, (data) => onLoadData(new Uint8Array(data as ArrayBuffer)), undefined, undefined, true, onInternalError);\r\n }\r\n });\r\n } else {\r\n if (!files || files.length === 0) {\r\n throw new Error(\"Cannot load cubemap because files were not defined, or the correct loader was not found.\");\r\n }\r\n\r\n this._cascadeLoadImgs(\r\n scene,\r\n texture,\r\n (texture: InternalTexture, imgs: HTMLImageElement[] | ImageBitmap[]) => {\r\n if (imageHandler) {\r\n imageHandler(texture, imgs);\r\n }\r\n },\r\n files,\r\n localOnError\r\n );\r\n }\r\n\r\n this._internalTexturesCache.push(texture);\r\n\r\n return texture;\r\n};\r\n"]}
1
+ {"version":3,"file":"abstractEngine.cubeTexture.js","sourceRoot":"","sources":["../../../../../dev/core/src/Engines/AbstractEngine/abstractEngine.cubeTexture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAyB,MAAM,0CAA0C,CAAC;AAClG,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAG3C,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,2BAA2B,EAAE,iEAA6D;AACnG,OAAO,EAAE,mBAAmB,EAAE,+BAA2B;AA6DzD,cAAc,CA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P,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,UAAU,CAAC,IAAmB,CAAC,CAAC,EACzD,SAAS,EACT,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,eAAe,IAAI,IAAI,CAAC,CAAC,CAAC,SAAS,EACjD,IAAI,EACJ,eAAe,CAClB,CAAC;YACN,CAAC;QACL,CAAC,CAAC,CAAC;IACP,CAAC;SAAM,CAAC;QACJ,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC/B,MAAM,IAAI,KAAK,CAAC,0FAA0F,CAAC,CAAC;QAChH,CAAC;QAED,IAAI,CAAC,gBAAgB,CACjB,KAAK,EACL,OAAO,EACP,CAAC,OAAwB,EAAE,IAAwC,EAAE,EAAE;YACnE,IAAI,YAAY,EAAE,CAAC;gBACf,YAAY,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;YAChC,CAAC;QACL,CAAC,EACD,KAAK,EACL,YAAY,CACf,CAAC;IACN,CAAC;IAED,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAE1C,OAAO,OAAO,CAAC;AACnB,CAAC,CAAC","sourcesContent":["import { InternalTexture, InternalTextureSource } from \"../../Materials/Textures/internalTexture\";\r\nimport { Logger } from \"../../Misc/logger\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { Scene } from \"../../scene\";\r\nimport { LoadImage } from \"../../Misc/fileTools\";\r\nimport { RandomGUID } from \"../../Misc/guid\";\r\nimport type { IWebRequest } from \"../../Misc/interfaces/iWebRequest\";\r\nimport { AbstractEngine } from \"../abstractEngine\";\r\nimport { _GetCompatibleTextureLoader } from \"core/Materials/Textures/Loaders/textureLoaderManager\";\r\nimport { GetExtensionFromUrl } from \"core/Misc/urlTools\";\r\n\r\ndeclare module \"../../Engines/abstractEngine\" {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n export interface AbstractEngine {\r\n /** @internal */\r\n createCubeTextureBase(\r\n rootUrl: string,\r\n scene: Nullable<Scene>,\r\n files: Nullable<string[]>,\r\n noMipmap: boolean,\r\n onLoad: Nullable<(data?: any) => void>,\r\n onError: Nullable<(message?: string, exception?: any) => void>,\r\n format: number | undefined,\r\n forcedExtension: any,\r\n createPolynomials: boolean,\r\n lodScale: number,\r\n lodOffset: number,\r\n fallback: Nullable<InternalTexture>,\r\n beforeLoadCubeDataCallback: Nullable<(texture: InternalTexture, data: ArrayBufferView | ArrayBufferView[]) => void>,\r\n imageHandler: Nullable<(texture: InternalTexture, imgs: HTMLImageElement[] | ImageBitmap[]) => void>,\r\n useSRGBBuffer: boolean,\r\n buffer: Nullable<ArrayBufferView>\r\n ): InternalTexture;\r\n\r\n /** @internal */\r\n _partialLoadFile(\r\n url: string,\r\n index: number,\r\n loadedFiles: ArrayBuffer[],\r\n onfinish: (files: ArrayBuffer[]) => void,\r\n onErrorCallBack: Nullable<(message?: string, exception?: any) => void>\r\n ): void;\r\n\r\n /** @internal */\r\n _cascadeLoadFiles(scene: Nullable<Scene>, onfinish: (images: ArrayBuffer[]) => void, files: string[], onError: Nullable<(message?: string, exception?: any) => void>): void;\r\n\r\n /** @internal */\r\n _cascadeLoadImgs(\r\n scene: Nullable<Scene>,\r\n texture: InternalTexture,\r\n onfinish: Nullable<(texture: InternalTexture, images: HTMLImageElement[] | ImageBitmap[]) => void>,\r\n files: string[],\r\n onError: Nullable<(message?: string, exception?: any) => void>,\r\n mimeType?: string\r\n ): void;\r\n\r\n /** @internal */\r\n _partialLoadImg(\r\n url: string,\r\n index: number,\r\n loadedImages: HTMLImageElement[] | ImageBitmap[],\r\n scene: Nullable<Scene>,\r\n texture: InternalTexture,\r\n onfinish: Nullable<(texture: InternalTexture, images: HTMLImageElement[] | ImageBitmap[]) => void>,\r\n onErrorCallBack: Nullable<(message?: string, exception?: any) => void>,\r\n mimeType?: string\r\n ): void;\r\n }\r\n}\r\n\r\nAbstractEngine.prototype._partialLoadFile = function (\r\n url: string,\r\n index: number,\r\n loadedFiles: ArrayBuffer[],\r\n onfinish: (files: ArrayBuffer[]) => void,\r\n onErrorCallBack: Nullable<(message?: string, exception?: any) => void> = null\r\n): void {\r\n const onload = (data: ArrayBuffer) => {\r\n loadedFiles[index] = data;\r\n (<any>loadedFiles)._internalCount++;\r\n\r\n if ((<any>loadedFiles)._internalCount === 6) {\r\n onfinish(loadedFiles);\r\n }\r\n };\r\n\r\n const onerror = (request?: IWebRequest, exception?: any) => {\r\n if (onErrorCallBack && request) {\r\n onErrorCallBack(request.status + \" \" + request.statusText, exception);\r\n }\r\n };\r\n\r\n this._loadFile(url, onload as (data: string | ArrayBuffer) => void, undefined, undefined, true, onerror);\r\n};\r\n\r\nAbstractEngine.prototype._cascadeLoadFiles = function (\r\n scene: Nullable<Scene>,\r\n onfinish: (images: ArrayBuffer[]) => void,\r\n files: string[],\r\n onError: Nullable<(message?: string, exception?: any) => void> = null\r\n): void {\r\n const loadedFiles: ArrayBuffer[] = [];\r\n (<any>loadedFiles)._internalCount = 0;\r\n\r\n for (let index = 0; index < 6; index++) {\r\n this._partialLoadFile(files[index], index, loadedFiles, onfinish, onError);\r\n }\r\n};\r\n\r\nAbstractEngine.prototype._cascadeLoadImgs = function (\r\n scene: Nullable<Scene>,\r\n texture: InternalTexture,\r\n onfinish: Nullable<(texture: InternalTexture, images: HTMLImageElement[] | ImageBitmap[]) => void>,\r\n files: string[],\r\n onError: Nullable<(message?: string, exception?: any) => void> = null,\r\n mimeType?: string\r\n) {\r\n const loadedImages: HTMLImageElement[] | ImageBitmap[] = [];\r\n (<any>loadedImages)._internalCount = 0;\r\n\r\n for (let index = 0; index < 6; index++) {\r\n this._partialLoadImg(files[index], index, loadedImages, scene, texture, onfinish, onError, mimeType);\r\n }\r\n};\r\n\r\nAbstractEngine.prototype._partialLoadImg = function (\r\n url: string,\r\n index: number,\r\n loadedImages: HTMLImageElement[] | ImageBitmap[],\r\n scene: Nullable<Scene>,\r\n texture: InternalTexture,\r\n onfinish: Nullable<(texture: InternalTexture, images: HTMLImageElement[] | ImageBitmap[]) => void>,\r\n onErrorCallBack: Nullable<(message?: string, exception?: any) => void> = null,\r\n mimeType?: string\r\n) {\r\n const tokenPendingData = RandomGUID();\r\n\r\n const onload = (img: HTMLImageElement | ImageBitmap) => {\r\n loadedImages[index] = img;\r\n (<any>loadedImages)._internalCount++;\r\n\r\n if (scene) {\r\n scene.removePendingData(tokenPendingData);\r\n }\r\n\r\n if ((<any>loadedImages)._internalCount === 6 && onfinish) {\r\n onfinish(texture, loadedImages);\r\n }\r\n };\r\n\r\n const onerror = (message?: string, exception?: any) => {\r\n if (scene) {\r\n scene.removePendingData(tokenPendingData);\r\n }\r\n\r\n if (onErrorCallBack) {\r\n onErrorCallBack(message, exception);\r\n }\r\n };\r\n\r\n LoadImage(url, onload, onerror, scene ? scene.offlineProvider : null, mimeType);\r\n if (scene) {\r\n scene.addPendingData(tokenPendingData);\r\n }\r\n};\r\n\r\nAbstractEngine.prototype.createCubeTextureBase = function (\r\n rootUrl: string,\r\n scene: Nullable<Scene>,\r\n files: Nullable<string[]>,\r\n noMipmap?: boolean,\r\n onLoad: Nullable<(data?: any) => void> = null,\r\n onError: Nullable<(message?: string, exception?: any) => void> = null,\r\n format?: number,\r\n forcedExtension: any = null,\r\n createPolynomials: boolean = false,\r\n lodScale: number = 0,\r\n lodOffset: number = 0,\r\n fallback: Nullable<InternalTexture> = null,\r\n beforeLoadCubeDataCallback: Nullable<(texture: InternalTexture, data: ArrayBufferView | ArrayBufferView[]) => void> = null,\r\n imageHandler: Nullable<(texture: InternalTexture, imgs: HTMLImageElement[] | ImageBitmap[]) => void> = null,\r\n useSRGBBuffer = false,\r\n buffer: Nullable<ArrayBufferView> = null\r\n): InternalTexture {\r\n const texture = fallback ? fallback : new InternalTexture(this, InternalTextureSource.Cube);\r\n texture.isCube = true;\r\n texture.url = rootUrl;\r\n texture.generateMipMaps = !noMipmap;\r\n texture._lodGenerationScale = lodScale;\r\n texture._lodGenerationOffset = lodOffset;\r\n texture._useSRGBBuffer = !!useSRGBBuffer && this._caps.supportSRGBBuffers && (this.version > 1 || this.isWebGPU || !!noMipmap);\r\n if (texture !== fallback) {\r\n texture.label = rootUrl.substring(0, 60); // default label, can be overriden by the caller\r\n }\r\n\r\n if (!this._doNotHandleContextLost) {\r\n texture._extension = forcedExtension;\r\n texture._files = files;\r\n texture._buffer = buffer;\r\n }\r\n\r\n const originalRootUrl = rootUrl;\r\n if (this._transformTextureUrl && !fallback) {\r\n rootUrl = this._transformTextureUrl(rootUrl);\r\n }\r\n\r\n const extension = forcedExtension ?? GetExtensionFromUrl(rootUrl);\r\n\r\n const loaderPromise = _GetCompatibleTextureLoader(extension);\r\n\r\n const localOnError = (message?: string, exception?: any) => {\r\n // if an error was thrown during load, dispose the texture, otherwise it will stay in the cache\r\n texture.dispose();\r\n if (onError) {\r\n onError(message, exception);\r\n } else if (message) {\r\n Logger.Warn(message);\r\n }\r\n };\r\n\r\n const onInternalError = (request?: IWebRequest, exception?: any) => {\r\n if (rootUrl === originalRootUrl) {\r\n if (request) {\r\n localOnError(request.status + \" \" + request.statusText, exception);\r\n }\r\n } else {\r\n // fall back to the original url if the transformed url fails to load\r\n Logger.Warn(`Failed to load ${rootUrl}, falling back to the ${originalRootUrl}`);\r\n this.createCubeTextureBase(\r\n originalRootUrl,\r\n scene,\r\n files,\r\n !!noMipmap,\r\n onLoad,\r\n localOnError,\r\n format,\r\n forcedExtension,\r\n createPolynomials,\r\n lodScale,\r\n lodOffset,\r\n texture,\r\n beforeLoadCubeDataCallback,\r\n imageHandler,\r\n useSRGBBuffer,\r\n buffer\r\n );\r\n }\r\n };\r\n\r\n if (loaderPromise) {\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises, github/no-then\r\n loaderPromise.then((loader) => {\r\n const onLoadData = (data: ArrayBufferView | ArrayBufferView[]) => {\r\n if (beforeLoadCubeDataCallback) {\r\n beforeLoadCubeDataCallback(texture, data);\r\n }\r\n loader.loadCubeData(data, texture, createPolynomials, onLoad, (message?: string, exception?: any) => {\r\n localOnError(message, exception);\r\n });\r\n };\r\n if (buffer) {\r\n onLoadData(buffer);\r\n } else if (files && files.length === 6) {\r\n if (loader.supportCascades) {\r\n this._cascadeLoadFiles(scene, (images) => onLoadData(images.map((image) => new Uint8Array(image))), files, localOnError);\r\n } else {\r\n localOnError(\"Textures type does not support cascades.\");\r\n }\r\n } else {\r\n this._loadFile(\r\n rootUrl,\r\n (data) => onLoadData(new Uint8Array(data as ArrayBuffer)),\r\n undefined,\r\n scene ? scene.offlineProvider || null : undefined,\r\n true,\r\n onInternalError\r\n );\r\n }\r\n });\r\n } else {\r\n if (!files || files.length === 0) {\r\n throw new Error(\"Cannot load cubemap because files were not defined, or the correct loader was not found.\");\r\n }\r\n\r\n this._cascadeLoadImgs(\r\n scene,\r\n texture,\r\n (texture: InternalTexture, imgs: HTMLImageElement[] | ImageBitmap[]) => {\r\n if (imageHandler) {\r\n imageHandler(texture, imgs);\r\n }\r\n },\r\n files,\r\n localOnError\r\n );\r\n }\r\n\r\n this._internalTexturesCache.push(texture);\r\n\r\n return texture;\r\n};\r\n"]}
@@ -60,6 +60,9 @@ export class NativeShaderProcessor {
60
60
  code = code.replace(/void\s+?main\s*\(/g, (hasDrawBuffersExtension || hasOutput ? "" : "layout(location = 0) out vec4 glFragColor;\n") + "void main(");
61
61
  }
62
62
  else {
63
+ if (defines.indexOf("#define VERTEXOUTPUT_INVARIANT") >= 0) {
64
+ code = "invariant gl_Position;\n" + code;
65
+ }
63
66
  if (this._nativeProcessingContext?.injectInVertexMain) {
64
67
  code = InjectStartingAndEndingCode(code, "void main", this._nativeProcessingContext.injectInVertexMain);
65
68
  }