@babylonjs/core 6.32.0 → 6.33.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (138) hide show
  1. package/Animations/animatable.js +13 -1
  2. package/Animations/animatable.js.map +1 -1
  3. package/Animations/animation.d.ts +4 -0
  4. package/Animations/animation.js +13 -1
  5. package/Animations/animation.js.map +1 -1
  6. package/Animations/runtimeAnimation.js +11 -1
  7. package/Animations/runtimeAnimation.js.map +1 -1
  8. package/Behaviors/Meshes/pointerDragBehavior.js +18 -7
  9. package/Behaviors/Meshes/pointerDragBehavior.js.map +1 -1
  10. package/Engines/Extensions/engine.dynamicTexture.js +6 -0
  11. package/Engines/Extensions/engine.dynamicTexture.js.map +1 -1
  12. package/Engines/Extensions/engine.multiRender.js +1 -1
  13. package/Engines/Extensions/engine.multiRender.js.map +1 -1
  14. package/Engines/Extensions/engine.renderTarget.js +1 -1
  15. package/Engines/Extensions/engine.renderTarget.js.map +1 -1
  16. package/Engines/ICanvas.d.ts +45 -0
  17. package/Engines/ICanvas.js.map +1 -1
  18. package/Engines/thinEngine.d.ts +0 -4
  19. package/Engines/thinEngine.js +2 -24
  20. package/Engines/thinEngine.js.map +1 -1
  21. package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.d.ts +3 -0
  22. package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.js +11 -4
  23. package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.js.map +1 -1
  24. package/FlowGraph/flowGraph.d.ts +1 -0
  25. package/FlowGraph/flowGraph.js +26 -1
  26. package/FlowGraph/flowGraph.js.map +1 -1
  27. package/FlowGraph/utils.d.ts +9 -0
  28. package/FlowGraph/utils.js +11 -0
  29. package/FlowGraph/utils.js.map +1 -0
  30. package/Gizmos/axisDragGizmo.js +1 -1
  31. package/Gizmos/axisDragGizmo.js.map +1 -1
  32. package/Gizmos/axisScaleGizmo.d.ts +13 -1
  33. package/Gizmos/axisScaleGizmo.js +37 -8
  34. package/Gizmos/axisScaleGizmo.js.map +1 -1
  35. package/Gizmos/gizmo.d.ts +17 -1
  36. package/Gizmos/gizmo.js +28 -2
  37. package/Gizmos/gizmo.js.map +1 -1
  38. package/Gizmos/planeDragGizmo.d.ts +3 -1
  39. package/Gizmos/planeDragGizmo.js +5 -3
  40. package/Gizmos/planeDragGizmo.js.map +1 -1
  41. package/Gizmos/positionGizmo.d.ts +7 -0
  42. package/Gizmos/positionGizmo.js +15 -0
  43. package/Gizmos/positionGizmo.js.map +1 -1
  44. package/Gizmos/rotationGizmo.d.ts +7 -0
  45. package/Gizmos/rotationGizmo.js +15 -0
  46. package/Gizmos/rotationGizmo.js.map +1 -1
  47. package/Gizmos/scaleGizmo.d.ts +15 -0
  48. package/Gizmos/scaleGizmo.js +30 -0
  49. package/Gizmos/scaleGizmo.js.map +1 -1
  50. package/Materials/Background/backgroundMaterial.js +6 -1
  51. package/Materials/Background/backgroundMaterial.js.map +1 -1
  52. package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js +3 -3
  53. package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js.map +1 -1
  54. package/Materials/Node/Blocks/PBR/subSurfaceBlock.d.ts +4 -0
  55. package/Materials/Node/Blocks/PBR/subSurfaceBlock.js +14 -1
  56. package/Materials/Node/Blocks/PBR/subSurfaceBlock.js.map +1 -1
  57. package/Materials/Node/Blocks/Vertex/vertexOutputBlock.js +5 -2
  58. package/Materials/Node/Blocks/Vertex/vertexOutputBlock.js.map +1 -1
  59. package/Materials/Node/nodeMaterial.js +1 -0
  60. package/Materials/Node/nodeMaterial.js.map +1 -1
  61. package/Materials/Node/nodeMaterialBuildStateSharedData.d.ts +5 -1
  62. package/Materials/Node/nodeMaterialBuildStateSharedData.js.map +1 -1
  63. package/Materials/PBR/pbrBaseMaterial.d.ts +0 -12
  64. package/Materials/PBR/pbrBaseMaterial.js +1 -20
  65. package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
  66. package/Materials/PBR/pbrSubSurfaceConfiguration.d.ts +10 -0
  67. package/Materials/PBR/pbrSubSurfaceConfiguration.js +21 -0
  68. package/Materials/PBR/pbrSubSurfaceConfiguration.js.map +1 -1
  69. package/Materials/Textures/Procedurals/proceduralTexture.d.ts +5 -0
  70. package/Materials/Textures/Procedurals/proceduralTexture.js +16 -0
  71. package/Materials/Textures/Procedurals/proceduralTexture.js.map +1 -1
  72. package/Materials/Textures/internalTexture.d.ts +4 -0
  73. package/Materials/Textures/internalTexture.js +8 -1
  74. package/Materials/Textures/internalTexture.js.map +1 -1
  75. package/Materials/material.d.ts +8 -0
  76. package/Materials/material.js +19 -0
  77. package/Materials/material.js.map +1 -1
  78. package/Materials/shaderMaterial.js +23 -11
  79. package/Materials/shaderMaterial.js.map +1 -1
  80. package/Materials/standardMaterial.d.ts +0 -8
  81. package/Materials/standardMaterial.js +0 -15
  82. package/Materials/standardMaterial.js.map +1 -1
  83. package/Maths/math.plane.d.ts +8 -1
  84. package/Maths/math.plane.js +14 -5
  85. package/Maths/math.plane.js.map +1 -1
  86. package/Maths/math.vector.d.ts +2 -1
  87. package/Maths/math.vector.js +5 -4
  88. package/Maths/math.vector.js.map +1 -1
  89. package/Meshes/Node/Blocks/Set/setColorsBlock.js +3 -0
  90. package/Meshes/Node/Blocks/Set/setColorsBlock.js.map +1 -1
  91. package/Meshes/Node/Blocks/Set/setNormalsBlock.js +3 -0
  92. package/Meshes/Node/Blocks/Set/setNormalsBlock.js.map +1 -1
  93. package/Meshes/Node/Blocks/Set/setPositionsBlock.js +3 -0
  94. package/Meshes/Node/Blocks/Set/setPositionsBlock.js.map +1 -1
  95. package/Meshes/Node/Blocks/Set/setTangentsBlock.js +3 -0
  96. package/Meshes/Node/Blocks/Set/setTangentsBlock.js.map +1 -1
  97. package/Meshes/Node/Blocks/Set/setUVsBlock.js +3 -0
  98. package/Meshes/Node/Blocks/Set/setUVsBlock.js.map +1 -1
  99. package/Meshes/Node/Blocks/mergeGeometryBlock.js +6 -0
  100. package/Meshes/Node/Blocks/mergeGeometryBlock.js.map +1 -1
  101. package/Meshes/Node/Blocks/randomBlock.js +1 -1
  102. package/Meshes/Node/Blocks/randomBlock.js.map +1 -1
  103. package/Meshes/mesh.vertexData.js +78 -94
  104. package/Meshes/mesh.vertexData.js.map +1 -1
  105. package/Meshes/transformNode.d.ts +4 -0
  106. package/Meshes/transformNode.js +6 -0
  107. package/Meshes/transformNode.js.map +1 -1
  108. package/PostProcesses/postProcess.d.ts +88 -3
  109. package/PostProcesses/postProcess.js +34 -21
  110. package/PostProcesses/postProcess.js.map +1 -1
  111. package/Rendering/GaussianSplatting/gaussianSplatting.d.ts +65 -0
  112. package/Rendering/GaussianSplatting/gaussianSplatting.js +285 -0
  113. package/Rendering/GaussianSplatting/gaussianSplatting.js.map +1 -0
  114. package/Rendering/GaussianSplatting/index.d.ts +1 -0
  115. package/Rendering/GaussianSplatting/index.js +2 -0
  116. package/Rendering/GaussianSplatting/index.js.map +1 -0
  117. package/Rendering/index.d.ts +1 -0
  118. package/Rendering/index.js +1 -0
  119. package/Rendering/index.js.map +1 -1
  120. package/Shaders/ShadersInclude/pbrBlockSubSurface.js +119 -44
  121. package/Shaders/ShadersInclude/pbrBlockSubSurface.js.map +1 -1
  122. package/Shaders/ShadersInclude/pbrFragmentDeclaration.js +3 -0
  123. package/Shaders/ShadersInclude/pbrFragmentDeclaration.js.map +1 -1
  124. package/Shaders/background.fragment.d.ts +2 -0
  125. package/Shaders/background.fragment.js +7 -0
  126. package/Shaders/background.fragment.js.map +1 -1
  127. package/Shaders/background.vertex.d.ts +2 -0
  128. package/Shaders/background.vertex.js +4 -0
  129. package/Shaders/background.vertex.js.map +1 -1
  130. package/Shaders/line.fragment.d.ts +2 -0
  131. package/Shaders/line.fragment.js +7 -0
  132. package/Shaders/line.fragment.js.map +1 -1
  133. package/Shaders/line.vertex.d.ts +2 -0
  134. package/Shaders/line.vertex.js +4 -0
  135. package/Shaders/line.vertex.js.map +1 -1
  136. package/Shaders/pbr.fragment.js +3 -0
  137. package/Shaders/pbr.fragment.js.map +1 -1
  138. package/package.json +1 -1
@@ -97,9 +97,16 @@ export declare class Plane {
97
97
  * @param origin origin of the plane to be constructed
98
98
  * @param normal normal of the plane to be constructed
99
99
  * @returns a new Plane the normal vector to this plane at the given origin point.
100
- * Note : the vector "normal" is updated because normalized.
101
100
  */
102
101
  static FromPositionAndNormal(origin: DeepImmutable<Vector3>, normal: Vector3): Plane;
102
+ /**
103
+ * Updates the given Plane "result" from an origin point and a normal.
104
+ * @param origin origin of the plane to be constructed
105
+ * @param normal the normalized normals of the plane to be constructed
106
+ * @param result defines the Plane where to store the result
107
+ * @returns result input
108
+ */
109
+ static FromPositionAndNormalToRef<T extends Plane>(origin: DeepImmutable<Vector3>, normal: DeepImmutable<Vector3>, result: T): T;
103
110
  /**
104
111
  * Calculates the distance from a plane and a point
105
112
  * @param origin origin of the plane to be constructed
@@ -162,13 +162,22 @@ export class Plane {
162
162
  * @param origin origin of the plane to be constructed
163
163
  * @param normal normal of the plane to be constructed
164
164
  * @returns a new Plane the normal vector to this plane at the given origin point.
165
- * Note : the vector "normal" is updated because normalized.
166
165
  */
167
166
  static FromPositionAndNormal(origin, normal) {
168
- const result = new Plane(0.0, 0.0, 0.0, 0.0);
169
- normal.normalize();
170
- result.normal = normal;
171
- result.d = -(normal.x * origin.x + normal.y * origin.y + normal.z * origin.z);
167
+ const plane = new Plane(0.0, 0.0, 0.0, 0.0);
168
+ return this.FromPositionAndNormalToRef(origin, normal, plane);
169
+ }
170
+ /**
171
+ * Updates the given Plane "result" from an origin point and a normal.
172
+ * @param origin origin of the plane to be constructed
173
+ * @param normal the normalized normals of the plane to be constructed
174
+ * @param result defines the Plane where to store the result
175
+ * @returns result input
176
+ */
177
+ static FromPositionAndNormalToRef(origin, normal, result) {
178
+ result.normal.copyFrom(normal);
179
+ result.normal.normalize();
180
+ result.d = -origin.dot(result.normal);
172
181
  return result;
173
182
  }
174
183
  /**
@@ -1 +1 @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AA8B,EAAE,MAA8B,EAAE,KAA6B;QAC3I,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;QAC7E,OAAO,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC;IAC1C,CAAC;;AAzMc,gBAAU,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC","sourcesContent":["import type { DeepImmutable } from \"../types\";\r\nimport { Vector3, Matrix } from \"./math.vector\";\r\n\r\n/**\r\n * Represents a plane by the equation ax + by + cz + d = 0\r\n */\r\nexport class Plane {\r\n private static _TmpMatrix = Matrix.Identity();\r\n\r\n /**\r\n * Normal of the plane (a,b,c)\r\n */\r\n public normal: Vector3;\r\n /**\r\n * d component of the plane\r\n */\r\n public d: number;\r\n /**\r\n * Creates a Plane object according to the given floats a, b, c, d and the plane equation : ax + by + cz + d = 0\r\n * @param a a component of the plane\r\n * @param b b component of the plane\r\n * @param c c component of the plane\r\n * @param d d component of the plane\r\n */\r\n constructor(a: number, b: number, c: number, d: number) {\r\n this.normal = new Vector3(a, b, c);\r\n this.d = d;\r\n }\r\n\r\n /**\r\n * @returns the plane coordinates as a new array of 4 elements [a, b, c, d].\r\n */\r\n public asArray(): number[] {\r\n return [this.normal.x, this.normal.y, this.normal.z, this.d];\r\n }\r\n\r\n // Methods\r\n /**\r\n * @returns a new plane copied from the current Plane.\r\n */\r\n public clone(): Plane {\r\n return new Plane(this.normal.x, this.normal.y, this.normal.z, this.d);\r\n }\r\n /**\r\n * @returns the string \"Plane\".\r\n */\r\n public getClassName(): string {\r\n return \"Plane\";\r\n }\r\n /**\r\n * @returns the Plane hash code.\r\n */\r\n public getHashCode(): number {\r\n let hash = this.normal.getHashCode();\r\n hash = (hash * 397) ^ (this.d | 0);\r\n return hash;\r\n }\r\n /**\r\n * Normalize the current Plane in place.\r\n * @returns the updated Plane.\r\n */\r\n public normalize(): Plane {\r\n const norm = Math.sqrt(this.normal.x * this.normal.x + this.normal.y * this.normal.y + this.normal.z * this.normal.z);\r\n let magnitude = 0.0;\r\n\r\n if (norm !== 0) {\r\n magnitude = 1.0 / norm;\r\n }\r\n this.normal.x *= magnitude;\r\n this.normal.y *= magnitude;\r\n this.normal.z *= magnitude;\r\n this.d *= magnitude;\r\n return this;\r\n }\r\n /**\r\n * Applies a transformation the plane and returns the result\r\n * @param transformation the transformation matrix to be applied to the plane\r\n * @returns a new Plane as the result of the transformation of the current Plane by the given matrix.\r\n */\r\n public transform(transformation: DeepImmutable<Matrix>): Plane {\r\n const invertedMatrix = Plane._TmpMatrix;\r\n transformation.invertToRef(invertedMatrix);\r\n const m = invertedMatrix.m;\r\n const x = this.normal.x;\r\n const y = this.normal.y;\r\n const z = this.normal.z;\r\n const d = this.d;\r\n\r\n const normalX = x * m[0] + y * m[1] + z * m[2] + d * m[3];\r\n const normalY = x * m[4] + y * m[5] + z * m[6] + d * m[7];\r\n const normalZ = x * m[8] + y * m[9] + z * m[10] + d * m[11];\r\n const finalD = x * m[12] + y * m[13] + z * m[14] + d * m[15];\r\n\r\n return new Plane(normalX, normalY, normalZ, finalD);\r\n }\r\n\r\n /**\r\n * Compute the dot product between the point and the plane normal\r\n * @param point point to calculate the dot product with\r\n * @returns the dot product (float) of the point coordinates and the plane normal.\r\n */\r\n public dotCoordinate(point: DeepImmutable<Vector3>): number {\r\n return this.normal.x * point.x + this.normal.y * point.y + this.normal.z * point.z + this.d;\r\n }\r\n\r\n /**\r\n * Updates the current Plane from the plane defined by the three given points.\r\n * @param point1 one of the points used to construct the plane\r\n * @param point2 one of the points used to construct the plane\r\n * @param point3 one of the points used to construct the plane\r\n * @returns the updated Plane.\r\n */\r\n public copyFromPoints(point1: DeepImmutable<Vector3>, point2: DeepImmutable<Vector3>, point3: DeepImmutable<Vector3>): Plane {\r\n const x1 = point2.x - point1.x;\r\n const y1 = point2.y - point1.y;\r\n const z1 = point2.z - point1.z;\r\n const x2 = point3.x - point1.x;\r\n const y2 = point3.y - point1.y;\r\n const z2 = point3.z - point1.z;\r\n const yz = y1 * z2 - z1 * y2;\r\n const xz = z1 * x2 - x1 * z2;\r\n const xy = x1 * y2 - y1 * x2;\r\n const pyth = Math.sqrt(yz * yz + xz * xz + xy * xy);\r\n let invPyth;\r\n\r\n if (pyth !== 0) {\r\n invPyth = 1.0 / pyth;\r\n } else {\r\n invPyth = 0.0;\r\n }\r\n\r\n this.normal.x = yz * invPyth;\r\n this.normal.y = xz * invPyth;\r\n this.normal.z = xy * invPyth;\r\n this.d = -(this.normal.x * point1.x + this.normal.y * point1.y + this.normal.z * point1.z);\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Checks if the plane is facing a given direction (meaning if the plane's normal is pointing in the opposite direction of the given vector).\r\n * Note that for this function to work as expected you should make sure that:\r\n * - direction and the plane normal are normalized\r\n * - epsilon is a number just bigger than -1, something like -0.99 for eg\r\n * @param direction the direction to check if the plane is facing\r\n * @param epsilon value the dot product is compared against (returns true if dot <= epsilon)\r\n * @returns True if the plane is facing the given direction\r\n */\r\n public isFrontFacingTo(direction: DeepImmutable<Vector3>, epsilon: number): boolean {\r\n const dot = Vector3.Dot(this.normal, direction);\r\n return dot <= epsilon;\r\n }\r\n\r\n /**\r\n * Calculates the distance to a point\r\n * @param point point to calculate distance to\r\n * @returns the signed distance (float) from the given point to the Plane.\r\n */\r\n public signedDistanceTo(point: DeepImmutable<Vector3>): number {\r\n return Vector3.Dot(point, this.normal) + this.d;\r\n }\r\n\r\n // Statics\r\n /**\r\n * Creates a plane from an array\r\n * @param array the array to create a plane from\r\n * @returns a new Plane from the given array.\r\n */\r\n static FromArray(array: DeepImmutable<ArrayLike<number>>): Plane {\r\n return new Plane(array[0], array[1], array[2], array[3]);\r\n }\r\n /**\r\n * Creates a plane from three points\r\n * @param point1 point used to create the plane\r\n * @param point2 point used to create the plane\r\n * @param point3 point used to create the plane\r\n * @returns a new Plane defined by the three given points.\r\n */\r\n static FromPoints(point1: DeepImmutable<Vector3>, point2: DeepImmutable<Vector3>, point3: DeepImmutable<Vector3>): Plane {\r\n const result = new Plane(0.0, 0.0, 0.0, 0.0);\r\n result.copyFromPoints(point1, point2, point3);\r\n return result;\r\n }\r\n /**\r\n * Creates a plane from an origin point and a normal\r\n * @param origin origin of the plane to be constructed\r\n * @param normal normal of the plane to be constructed\r\n * @returns a new Plane the normal vector to this plane at the given origin point.\r\n * Note : the vector \"normal\" is updated because normalized.\r\n */\r\n static FromPositionAndNormal(origin: DeepImmutable<Vector3>, normal: Vector3): Plane {\r\n const result = new Plane(0.0, 0.0, 0.0, 0.0);\r\n normal.normalize();\r\n result.normal = normal;\r\n result.d = -(normal.x * origin.x + normal.y * origin.y + normal.z * origin.z);\r\n return result;\r\n }\r\n\r\n /**\r\n * Calculates the distance from a plane and a point\r\n * @param origin origin of the plane to be constructed\r\n * @param normal normal of the plane to be constructed\r\n * @param point point to calculate distance to\r\n * @returns the signed distance between the plane defined by the normal vector at the \"origin\"\" point and the given other point.\r\n */\r\n static SignedDistanceToPlaneFromPositionAndNormal(origin: DeepImmutable<Vector3>, normal: DeepImmutable<Vector3>, point: DeepImmutable<Vector3>): number {\r\n const d = -(normal.x * origin.x + normal.y * origin.y + normal.z * origin.z);\r\n return Vector3.Dot(point, normal) + d;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"math.plane.js","sourceRoot":"","sources":["../../../../dev/core/src/Maths/math.plane.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEhD;;GAEG;AACH,MAAM,OAAO,KAAK;IAWd;;;;;;OAMG;IACH,YAAY,CAAS,EAAE,CAAS,EAAE,CAAS,EAAE,CAAS;QAClD,IAAI,CAAC,MAAM,GAAG,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC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,CAAC;QAC7E,OAAO,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC;IAC1C,CAAC;;AAnNc,gBAAU,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC","sourcesContent":["import type { DeepImmutable } from \"../types\";\r\nimport { Vector3, Matrix } from \"./math.vector\";\r\n\r\n/**\r\n * Represents a plane by the equation ax + by + cz + d = 0\r\n */\r\nexport class Plane {\r\n private static _TmpMatrix = Matrix.Identity();\r\n\r\n /**\r\n * Normal of the plane (a,b,c)\r\n */\r\n public normal: Vector3;\r\n /**\r\n * d component of the plane\r\n */\r\n public d: number;\r\n /**\r\n * Creates a Plane object according to the given floats a, b, c, d and the plane equation : ax + by + cz + d = 0\r\n * @param a a component of the plane\r\n * @param b b component of the plane\r\n * @param c c component of the plane\r\n * @param d d component of the plane\r\n */\r\n constructor(a: number, b: number, c: number, d: number) {\r\n this.normal = new Vector3(a, b, c);\r\n this.d = d;\r\n }\r\n\r\n /**\r\n * @returns the plane coordinates as a new array of 4 elements [a, b, c, d].\r\n */\r\n public asArray(): number[] {\r\n return [this.normal.x, this.normal.y, this.normal.z, this.d];\r\n }\r\n\r\n // Methods\r\n /**\r\n * @returns a new plane copied from the current Plane.\r\n */\r\n public clone(): Plane {\r\n return new Plane(this.normal.x, this.normal.y, this.normal.z, this.d);\r\n }\r\n /**\r\n * @returns the string \"Plane\".\r\n */\r\n public getClassName(): string {\r\n return \"Plane\";\r\n }\r\n /**\r\n * @returns the Plane hash code.\r\n */\r\n public getHashCode(): number {\r\n let hash = this.normal.getHashCode();\r\n hash = (hash * 397) ^ (this.d | 0);\r\n return hash;\r\n }\r\n /**\r\n * Normalize the current Plane in place.\r\n * @returns the updated Plane.\r\n */\r\n public normalize(): Plane {\r\n const norm = Math.sqrt(this.normal.x * this.normal.x + this.normal.y * this.normal.y + this.normal.z * this.normal.z);\r\n let magnitude = 0.0;\r\n\r\n if (norm !== 0) {\r\n magnitude = 1.0 / norm;\r\n }\r\n this.normal.x *= magnitude;\r\n this.normal.y *= magnitude;\r\n this.normal.z *= magnitude;\r\n this.d *= magnitude;\r\n return this;\r\n }\r\n /**\r\n * Applies a transformation the plane and returns the result\r\n * @param transformation the transformation matrix to be applied to the plane\r\n * @returns a new Plane as the result of the transformation of the current Plane by the given matrix.\r\n */\r\n public transform(transformation: DeepImmutable<Matrix>): Plane {\r\n const invertedMatrix = Plane._TmpMatrix;\r\n transformation.invertToRef(invertedMatrix);\r\n const m = invertedMatrix.m;\r\n const x = this.normal.x;\r\n const y = this.normal.y;\r\n const z = this.normal.z;\r\n const d = this.d;\r\n\r\n const normalX = x * m[0] + y * m[1] + z * m[2] + d * m[3];\r\n const normalY = x * m[4] + y * m[5] + z * m[6] + d * m[7];\r\n const normalZ = x * m[8] + y * m[9] + z * m[10] + d * m[11];\r\n const finalD = x * m[12] + y * m[13] + z * m[14] + d * m[15];\r\n\r\n return new Plane(normalX, normalY, normalZ, finalD);\r\n }\r\n\r\n /**\r\n * Compute the dot product between the point and the plane normal\r\n * @param point point to calculate the dot product with\r\n * @returns the dot product (float) of the point coordinates and the plane normal.\r\n */\r\n public dotCoordinate(point: DeepImmutable<Vector3>): number {\r\n return this.normal.x * point.x + this.normal.y * point.y + this.normal.z * point.z + this.d;\r\n }\r\n\r\n /**\r\n * Updates the current Plane from the plane defined by the three given points.\r\n * @param point1 one of the points used to construct the plane\r\n * @param point2 one of the points used to construct the plane\r\n * @param point3 one of the points used to construct the plane\r\n * @returns the updated Plane.\r\n */\r\n public copyFromPoints(point1: DeepImmutable<Vector3>, point2: DeepImmutable<Vector3>, point3: DeepImmutable<Vector3>): Plane {\r\n const x1 = point2.x - point1.x;\r\n const y1 = point2.y - point1.y;\r\n const z1 = point2.z - point1.z;\r\n const x2 = point3.x - point1.x;\r\n const y2 = point3.y - point1.y;\r\n const z2 = point3.z - point1.z;\r\n const yz = y1 * z2 - z1 * y2;\r\n const xz = z1 * x2 - x1 * z2;\r\n const xy = x1 * y2 - y1 * x2;\r\n const pyth = Math.sqrt(yz * yz + xz * xz + xy * xy);\r\n let invPyth;\r\n\r\n if (pyth !== 0) {\r\n invPyth = 1.0 / pyth;\r\n } else {\r\n invPyth = 0.0;\r\n }\r\n\r\n this.normal.x = yz * invPyth;\r\n this.normal.y = xz * invPyth;\r\n this.normal.z = xy * invPyth;\r\n this.d = -(this.normal.x * point1.x + this.normal.y * point1.y + this.normal.z * point1.z);\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Checks if the plane is facing a given direction (meaning if the plane's normal is pointing in the opposite direction of the given vector).\r\n * Note that for this function to work as expected you should make sure that:\r\n * - direction and the plane normal are normalized\r\n * - epsilon is a number just bigger than -1, something like -0.99 for eg\r\n * @param direction the direction to check if the plane is facing\r\n * @param epsilon value the dot product is compared against (returns true if dot <= epsilon)\r\n * @returns True if the plane is facing the given direction\r\n */\r\n public isFrontFacingTo(direction: DeepImmutable<Vector3>, epsilon: number): boolean {\r\n const dot = Vector3.Dot(this.normal, direction);\r\n return dot <= epsilon;\r\n }\r\n\r\n /**\r\n * Calculates the distance to a point\r\n * @param point point to calculate distance to\r\n * @returns the signed distance (float) from the given point to the Plane.\r\n */\r\n public signedDistanceTo(point: DeepImmutable<Vector3>): number {\r\n return Vector3.Dot(point, this.normal) + this.d;\r\n }\r\n\r\n // Statics\r\n /**\r\n * Creates a plane from an array\r\n * @param array the array to create a plane from\r\n * @returns a new Plane from the given array.\r\n */\r\n static FromArray(array: DeepImmutable<ArrayLike<number>>): Plane {\r\n return new Plane(array[0], array[1], array[2], array[3]);\r\n }\r\n /**\r\n * Creates a plane from three points\r\n * @param point1 point used to create the plane\r\n * @param point2 point used to create the plane\r\n * @param point3 point used to create the plane\r\n * @returns a new Plane defined by the three given points.\r\n */\r\n static FromPoints(point1: DeepImmutable<Vector3>, point2: DeepImmutable<Vector3>, point3: DeepImmutable<Vector3>): Plane {\r\n const result = new Plane(0.0, 0.0, 0.0, 0.0);\r\n result.copyFromPoints(point1, point2, point3);\r\n return result;\r\n }\r\n /**\r\n * Creates a plane from an origin point and a normal\r\n * @param origin origin of the plane to be constructed\r\n * @param normal normal of the plane to be constructed\r\n * @returns a new Plane the normal vector to this plane at the given origin point.\r\n */\r\n static FromPositionAndNormal(origin: DeepImmutable<Vector3>, normal: Vector3): Plane {\r\n const plane = new Plane(0.0, 0.0, 0.0, 0.0);\r\n return this.FromPositionAndNormalToRef(origin, normal, plane);\r\n }\r\n\r\n /**\r\n * Updates the given Plane \"result\" from an origin point and a normal.\r\n * @param origin origin of the plane to be constructed\r\n * @param normal the normalized normals of the plane to be constructed\r\n * @param result defines the Plane where to store the result\r\n * @returns result input\r\n */\r\n static FromPositionAndNormalToRef<T extends Plane>(origin: DeepImmutable<Vector3>, normal: DeepImmutable<Vector3>, result: T): T {\r\n result.normal.copyFrom(normal);\r\n result.normal.normalize();\r\n result.d = -origin.dot(result.normal);\r\n return result;\r\n }\r\n\r\n /**\r\n * Calculates the distance from a plane and a point\r\n * @param origin origin of the plane to be constructed\r\n * @param normal normal of the plane to be constructed\r\n * @param point point to calculate distance to\r\n * @returns the signed distance between the plane defined by the normal vector at the \"origin\"\" point and the given other point.\r\n */\r\n static SignedDistanceToPlaneFromPositionAndNormal(origin: DeepImmutable<Vector3>, normal: DeepImmutable<Vector3>, point: DeepImmutable<Vector3>): number {\r\n const d = -(normal.x * origin.x + normal.y * origin.y + normal.z * origin.z);\r\n return Vector3.Dot(point, normal) + d;\r\n }\r\n}\r\n"]}
@@ -3020,9 +3020,10 @@ export declare class Matrix {
3020
3020
  * @param rotation defines the rotation quaternion given as a reference to update
3021
3021
  * @param translation defines the translation vector3 given as a reference to update
3022
3022
  * @param preserveScalingNode Use scaling sign coming from this node. Otherwise scaling sign might change.
3023
+ * @param useAbsoluteScaling Use scaling sign coming from this absoluteScaling when true or scaling otherwise.
3023
3024
  * @returns true if operation was successful
3024
3025
  */
3025
- decompose(scale?: Vector3, rotation?: Quaternion, translation?: Vector3, preserveScalingNode?: TransformNode): boolean;
3026
+ decompose(scale?: Vector3, rotation?: Quaternion, translation?: Vector3, preserveScalingNode?: TransformNode, useAbsoluteScaling?: boolean): boolean;
3026
3027
  /**
3027
3028
  * Gets specific row of the matrix
3028
3029
  * Example Playground - https://playground.babylonjs.com/#AV9X17#36
@@ -5125,9 +5125,10 @@ export class Matrix {
5125
5125
  * @param rotation defines the rotation quaternion given as a reference to update
5126
5126
  * @param translation defines the translation vector3 given as a reference to update
5127
5127
  * @param preserveScalingNode Use scaling sign coming from this node. Otherwise scaling sign might change.
5128
+ * @param useAbsoluteScaling Use scaling sign coming from this absoluteScaling when true or scaling otherwise.
5128
5129
  * @returns true if operation was successful
5129
5130
  */
5130
- decompose(scale, rotation, translation, preserveScalingNode) {
5131
+ decompose(scale, rotation, translation, preserveScalingNode, useAbsoluteScaling = true) {
5131
5132
  if (this._isIdentity) {
5132
5133
  if (translation) {
5133
5134
  translation.setAll(0);
@@ -5149,9 +5150,9 @@ export class Matrix {
5149
5150
  scale.y = Math.sqrt(m[4] * m[4] + m[5] * m[5] + m[6] * m[6]);
5150
5151
  scale.z = Math.sqrt(m[8] * m[8] + m[9] * m[9] + m[10] * m[10]);
5151
5152
  if (preserveScalingNode) {
5152
- const signX = preserveScalingNode.absoluteScaling.x < 0 ? -1 : 1;
5153
- const signY = preserveScalingNode.absoluteScaling.y < 0 ? -1 : 1;
5154
- const signZ = preserveScalingNode.absoluteScaling.z < 0 ? -1 : 1;
5153
+ const signX = (useAbsoluteScaling ? preserveScalingNode.absoluteScaling.x : preserveScalingNode.scaling.x) < 0 ? -1 : 1;
5154
+ const signY = (useAbsoluteScaling ? preserveScalingNode.absoluteScaling.y : preserveScalingNode.scaling.y) < 0 ? -1 : 1;
5155
+ const signZ = (useAbsoluteScaling ? preserveScalingNode.absoluteScaling.z : preserveScalingNode.scaling.z) < 0 ? -1 : 1;
5155
5156
  scale.x *= signX;
5156
5157
  scale.y *= signY;
5157
5158
  scale.z *= signZ;