@babylonjs/core 7.27.2 → 7.27.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 (61) hide show
  1. package/Animations/animatable.core.d.ts +198 -0
  2. package/Animations/animatable.core.js +893 -0
  3. package/Animations/animatable.core.js.map +1 -0
  4. package/Animations/animatable.d.ts +4 -213
  5. package/Animations/animatable.js +5 -886
  6. package/Animations/animatable.js.map +1 -1
  7. package/Animations/animationGroup.d.ts +1 -1
  8. package/Animations/animationGroup.js.map +1 -1
  9. package/Animations/runtimeAnimation.d.ts +1 -0
  10. package/Animations/runtimeAnimation.js +25 -1
  11. package/Animations/runtimeAnimation.js.map +1 -1
  12. package/Audio/audioSceneComponent.d.ts +0 -4
  13. package/Audio/audioSceneComponent.js.map +1 -1
  14. package/Behaviors/Cameras/bouncingBehavior.js.map +1 -1
  15. package/Behaviors/Cameras/framingBehavior.js.map +1 -1
  16. package/Bones/skeleton.d.ts +1 -1
  17. package/Bones/skeleton.js.map +1 -1
  18. package/Culling/ray.core.d.ts +328 -0
  19. package/Culling/ray.core.js +934 -0
  20. package/Culling/ray.core.js.map +1 -0
  21. package/Culling/ray.d.ts +1 -220
  22. package/Culling/ray.js +12 -791
  23. package/Culling/ray.js.map +1 -1
  24. package/Engines/abstractEngine.js +2 -2
  25. package/Engines/abstractEngine.js.map +1 -1
  26. package/FlowGraph/Blocks/Execution/Animation/flowGraphPauseAnimationBlock.d.ts +1 -1
  27. package/FlowGraph/Blocks/Execution/Animation/flowGraphPauseAnimationBlock.js.map +1 -1
  28. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.d.ts +1 -1
  29. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.js.map +1 -1
  30. package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.d.ts +1 -1
  31. package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.js.map +1 -1
  32. package/Inputs/scene.inputManager.js +1 -1
  33. package/Inputs/scene.inputManager.js.map +1 -1
  34. package/Layers/effectLayerSceneComponent.d.ts +0 -6
  35. package/Layers/effectLayerSceneComponent.js +0 -1
  36. package/Layers/effectLayerSceneComponent.js.map +1 -1
  37. package/Layers/layerSceneComponent.d.ts +0 -9
  38. package/Layers/layerSceneComponent.js +0 -1
  39. package/Layers/layerSceneComponent.js.map +1 -1
  40. package/LensFlares/lensFlareSystemSceneComponent.d.ts +0 -5
  41. package/LensFlares/lensFlareSystemSceneComponent.js +0 -1
  42. package/LensFlares/lensFlareSystemSceneComponent.js.map +1 -1
  43. package/Lights/light.js.map +1 -1
  44. package/Materials/Textures/Procedurals/proceduralTextureSceneComponent.d.ts +0 -10
  45. package/Materials/Textures/Procedurals/proceduralTextureSceneComponent.js +0 -1
  46. package/Materials/Textures/Procedurals/proceduralTextureSceneComponent.js.map +1 -1
  47. package/Misc/assetsManager.d.ts +1 -1
  48. package/Misc/assetsManager.js.map +1 -1
  49. package/Misc/tools.js +1 -13
  50. package/Misc/tools.js.map +1 -1
  51. package/Sprites/spriteSceneComponent.d.ts +1 -1
  52. package/Sprites/spriteSceneComponent.js +4 -4
  53. package/Sprites/spriteSceneComponent.js.map +1 -1
  54. package/assetContainer.d.ts +1 -1
  55. package/assetContainer.js.map +1 -1
  56. package/node.d.ts +1 -1
  57. package/node.js.map +1 -1
  58. package/package.json +1 -1
  59. package/scene.d.ts +41 -4
  60. package/scene.js +25 -6
  61. package/scene.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"ray.js","sourceRoot":"","sources":["../../../../dev/core/src/Culling/ray.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEnE,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,M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;QACR,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;KAClC;SAAM;QACH,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;KACzC;IACD,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IACtC,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7D,MAAM,YAAY,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAC3C,OAAO,CAAC,oBAAoB,CAAC,OAAO,EAAE,SAAS,EAAE,YAAY,CAAC,CAAC;IAC/D,OAAO,CAAC,cAAc,CAAC,YAAY,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC;IAEvD,OAAO,MAAM,CAAC;AAClB,CAAC,CAAC","sourcesContent":["import type { DeepImmutable, Nullable, float } from \"../types\";\r\nimport { BuildArray } from \"../Misc/arrayTools\";\r\nimport { Matrix, Vector3, TmpVectors } from \"../Maths/math.vector\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport { PickingInfo } from \"../Collisions/pickingInfo\";\r\nimport { IntersectionInfo } from \"../Collisions/intersectionInfo\";\r\nimport type { BoundingBox } from \"./boundingBox\";\r\nimport type { BoundingSphere } from \"./boundingSphere\";\r\nimport { Scene } from \"../scene\";\r\nimport { Camera } from \"../Cameras/camera\";\r\nimport type { Plane } from \"../Maths/math.plane\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\n\r\nimport type { Mesh } from \"../Meshes/mesh\";\r\nimport { Epsilon } from \"core/Maths/math.constants\";\r\n\r\n/**\r\n * Class representing a ray with position and direction\r\n */\r\nexport class Ray {\r\n private static readonly _TmpVector3 = BuildArray(6, Vector3.Zero);\r\n private static _RayDistant = Ray.Zero();\r\n private _tmpRay: Ray;\r\n\r\n /**\r\n * Creates a new ray\r\n * @param origin origin point\r\n * @param direction direction\r\n * @param length length of the ray\r\n * @param epsilon The epsilon value to use when calculating the ray/triangle intersection (default: 0)\r\n */\r\n constructor(\r\n /** origin point */\r\n public origin: Vector3,\r\n /** direction */\r\n public direction: Vector3,\r\n /** [Number.MAX_VALUE] length of the ray */\r\n public length: number = Number.MAX_VALUE,\r\n /** [Epsilon] The epsilon value to use when calculating the ray/triangle intersection (default: Epsilon from math constants) */\r\n public epsilon: number = Epsilon\r\n ) {}\r\n\r\n // Methods\r\n\r\n /**\r\n * Clone the current ray\r\n * @returns a new ray\r\n */\r\n public clone(): Ray {\r\n return new Ray(this.origin.clone(), this.direction.clone(), this.length);\r\n }\r\n\r\n /**\r\n * Checks if the ray intersects a box\r\n * This does not account for the ray length by design to improve perfs.\r\n * @param minimum bound of the box\r\n * @param maximum bound of the box\r\n * @param intersectionTreshold extra extend to be added to the box in all direction\r\n * @returns if the box was hit\r\n */\r\n public intersectsBoxMinMax(minimum: DeepImmutable<Vector3>, maximum: DeepImmutable<Vector3>, intersectionTreshold: number = 0): boolean {\r\n const newMinimum = Ray._TmpVector3[0].copyFromFloats(minimum.x - intersectionTreshold, minimum.y - intersectionTreshold, minimum.z - intersectionTreshold);\r\n const newMaximum = Ray._TmpVector3[1].copyFromFloats(maximum.x + intersectionTreshold, maximum.y + intersectionTreshold, maximum.z + intersectionTreshold);\r\n let d = 0.0;\r\n let maxValue = Number.MAX_VALUE;\r\n let inv: number;\r\n let min: number;\r\n let max: number;\r\n let temp: number;\r\n if (Math.abs(this.direction.x) < 0.0000001) {\r\n if (this.origin.x < newMinimum.x || this.origin.x > newMaximum.x) {\r\n return false;\r\n }\r\n } else {\r\n inv = 1.0 / this.direction.x;\r\n min = (newMinimum.x - this.origin.x) * inv;\r\n max = (newMaximum.x - this.origin.x) * inv;\r\n if (max === -Infinity) {\r\n max = Infinity;\r\n }\r\n\r\n if (min > max) {\r\n temp = min;\r\n min = max;\r\n max = temp;\r\n }\r\n\r\n d = Math.max(min, d);\r\n maxValue = Math.min(max, maxValue);\r\n\r\n if (d > maxValue) {\r\n return false;\r\n }\r\n }\r\n\r\n if (Math.abs(this.direction.y) < 0.0000001) {\r\n if (this.origin.y < newMinimum.y || this.origin.y > newMaximum.y) {\r\n return false;\r\n }\r\n } else {\r\n inv = 1.0 / this.direction.y;\r\n min = (newMinimum.y - this.origin.y) * inv;\r\n max = (newMaximum.y - this.origin.y) * inv;\r\n\r\n if (max === -Infinity) {\r\n max = Infinity;\r\n }\r\n\r\n if (min > max) {\r\n temp = min;\r\n min = max;\r\n max = temp;\r\n }\r\n\r\n d = Math.max(min, d);\r\n maxValue = Math.min(max, maxValue);\r\n\r\n if (d > maxValue) {\r\n return false;\r\n }\r\n }\r\n\r\n if (Math.abs(this.direction.z) < 0.0000001) {\r\n if (this.origin.z < newMinimum.z || this.origin.z > newMaximum.z) {\r\n return false;\r\n }\r\n } else {\r\n inv = 1.0 / this.direction.z;\r\n min = (newMinimum.z - this.origin.z) * inv;\r\n max = (newMaximum.z - this.origin.z) * inv;\r\n\r\n if (max === -Infinity) {\r\n max = Infinity;\r\n }\r\n\r\n if (min > max) {\r\n temp = min;\r\n min = max;\r\n max = temp;\r\n }\r\n\r\n d = Math.max(min, d);\r\n maxValue = Math.min(max, maxValue);\r\n\r\n if (d > maxValue) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n\r\n /**\r\n * Checks if the ray intersects a box\r\n * This does not account for the ray lenght by design to improve perfs.\r\n * @param box the bounding box to check\r\n * @param intersectionTreshold extra extend to be added to the BoundingBox in all direction\r\n * @returns if the box was hit\r\n */\r\n public intersectsBox(box: DeepImmutable<BoundingBox>, intersectionTreshold: number = 0): boolean {\r\n return this.intersectsBoxMinMax(box.minimum, box.maximum, intersectionTreshold);\r\n }\r\n\r\n /**\r\n * If the ray hits a sphere\r\n * @param sphere the bounding sphere to check\r\n * @param intersectionTreshold extra extend to be added to the BoundingSphere in all direction\r\n * @returns true if it hits the sphere\r\n */\r\n public intersectsSphere(sphere: DeepImmutable<BoundingSphere>, intersectionTreshold: number = 0): boolean {\r\n const x = sphere.center.x - this.origin.x;\r\n const y = sphere.center.y - this.origin.y;\r\n const z = sphere.center.z - this.origin.z;\r\n const pyth = x * x + y * y + z * z;\r\n const radius = sphere.radius + intersectionTreshold;\r\n const rr = radius * radius;\r\n\r\n if (pyth <= rr) {\r\n return true;\r\n }\r\n\r\n const dot = x * this.direction.x + y * this.direction.y + z * this.direction.z;\r\n if (dot < 0.0) {\r\n return false;\r\n }\r\n\r\n const temp = pyth - dot * dot;\r\n\r\n return temp <= rr;\r\n }\r\n\r\n /**\r\n * If the ray hits a triange\r\n * @param vertex0 triangle vertex\r\n * @param vertex1 triangle vertex\r\n * @param vertex2 triangle vertex\r\n * @returns intersection information if hit\r\n */\r\n public intersectsTriangle(vertex0: DeepImmutable<Vector3>, vertex1: DeepImmutable<Vector3>, vertex2: DeepImmutable<Vector3>): Nullable<IntersectionInfo> {\r\n const edge1 = Ray._TmpVector3[0];\r\n const edge2 = Ray._TmpVector3[1];\r\n const pvec = Ray._TmpVector3[2];\r\n const tvec = Ray._TmpVector3[3];\r\n const qvec = Ray._TmpVector3[4];\r\n\r\n vertex1.subtractToRef(vertex0, edge1);\r\n vertex2.subtractToRef(vertex0, edge2);\r\n Vector3.CrossToRef(this.direction, edge2, pvec);\r\n const det = Vector3.Dot(edge1, pvec);\r\n\r\n if (det === 0) {\r\n return null;\r\n }\r\n\r\n const invdet = 1 / det;\r\n\r\n this.origin.subtractToRef(vertex0, tvec);\r\n\r\n const bv = Vector3.Dot(tvec, pvec) * invdet;\r\n\r\n if (bv < -this.epsilon || bv > 1.0 + this.epsilon) {\r\n return null;\r\n }\r\n\r\n Vector3.CrossToRef(tvec, edge1, qvec);\r\n\r\n const bw = Vector3.Dot(this.direction, qvec) * invdet;\r\n\r\n if (bw < -this.epsilon || bv + bw > 1.0 + this.epsilon) {\r\n return null;\r\n }\r\n\r\n //check if the distance is longer than the predefined length.\r\n const distance = Vector3.Dot(edge2, qvec) * invdet;\r\n if (distance > this.length) {\r\n return null;\r\n }\r\n\r\n return new IntersectionInfo(1 - bv - bw, bv, distance);\r\n }\r\n\r\n /**\r\n * Checks if ray intersects a plane\r\n * @param plane the plane to check\r\n * @returns the distance away it was hit\r\n */\r\n public intersectsPlane(plane: DeepImmutable<Plane>): Nullable<number> {\r\n let distance: number;\r\n const result1 = Vector3.Dot(plane.normal, this.direction);\r\n if (Math.abs(result1) < 9.99999997475243e-7) {\r\n return null;\r\n } else {\r\n const result2 = Vector3.Dot(plane.normal, this.origin);\r\n distance = (-plane.d - result2) / result1;\r\n if (distance < 0.0) {\r\n if (distance < -9.99999997475243e-7) {\r\n return null;\r\n } else {\r\n return 0;\r\n }\r\n }\r\n\r\n return distance;\r\n }\r\n }\r\n /**\r\n * Calculate the intercept of a ray on a given axis\r\n * @param axis to check 'x' | 'y' | 'z'\r\n * @param offset from axis interception (i.e. an offset of 1y is intercepted above ground)\r\n * @returns a vector containing the coordinates where 'axis' is equal to zero (else offset), or null if there is no intercept.\r\n */\r\n public intersectsAxis(axis: string, offset: number = 0): Nullable<Vector3> {\r\n switch (axis) {\r\n case \"y\": {\r\n const t = (this.origin.y - offset) / this.direction.y;\r\n if (t > 0) {\r\n return null;\r\n }\r\n return new Vector3(this.origin.x + this.direction.x * -t, offset, this.origin.z + this.direction.z * -t);\r\n }\r\n case \"x\": {\r\n const t = (this.origin.x - offset) / this.direction.x;\r\n if (t > 0) {\r\n return null;\r\n }\r\n return new Vector3(offset, this.origin.y + this.direction.y * -t, this.origin.z + this.direction.z * -t);\r\n }\r\n case \"z\": {\r\n const t = (this.origin.z - offset) / this.direction.z;\r\n if (t > 0) {\r\n return null;\r\n }\r\n return new Vector3(this.origin.x + this.direction.x * -t, this.origin.y + this.direction.y * -t, offset);\r\n }\r\n default:\r\n return null;\r\n }\r\n }\r\n\r\n /**\r\n * Checks if ray intersects a mesh. The ray is defined in WORLD space. A mesh triangle can be picked both from its front and back sides,\r\n * irrespective of orientation.\r\n * @param mesh the mesh to check\r\n * @param fastCheck defines if the first intersection will be used (and not the closest)\r\n * @param trianglePredicate defines an optional predicate used to select faces when a mesh intersection is detected\r\n * @param onlyBoundingInfo defines a boolean indicating if picking should only happen using bounding info (false by default)\r\n * @param worldToUse defines the world matrix to use to get the world coordinate of the intersection point\r\n * @param skipBoundingInfo a boolean indicating if we should skip the bounding info check\r\n * @returns picking info of the intersection\r\n */\r\n public intersectsMesh(\r\n mesh: DeepImmutable<AbstractMesh>,\r\n fastCheck?: boolean,\r\n trianglePredicate?: TrianglePickingPredicate,\r\n onlyBoundingInfo = false,\r\n worldToUse?: Matrix,\r\n skipBoundingInfo = false\r\n ): PickingInfo {\r\n const tm = TmpVectors.Matrix[0];\r\n\r\n mesh.getWorldMatrix().invertToRef(tm);\r\n\r\n if (this._tmpRay) {\r\n Ray.TransformToRef(this, tm, this._tmpRay);\r\n } else {\r\n this._tmpRay = Ray.Transform(this, tm);\r\n }\r\n\r\n return mesh.intersects(this._tmpRay, fastCheck, trianglePredicate, onlyBoundingInfo, worldToUse, skipBoundingInfo);\r\n }\r\n\r\n /**\r\n * Checks if ray intersects a mesh\r\n * @param meshes the meshes to check\r\n * @param fastCheck defines if the first intersection will be used (and not the closest)\r\n * @param results array to store result in\r\n * @returns Array of picking infos\r\n */\r\n public intersectsMeshes(meshes: Array<DeepImmutable<AbstractMesh>>, fastCheck?: boolean, results?: Array<PickingInfo>): Array<PickingInfo> {\r\n if (results) {\r\n results.length = 0;\r\n } else {\r\n results = [];\r\n }\r\n\r\n for (let i = 0; i < meshes.length; i++) {\r\n const pickInfo = this.intersectsMesh(meshes[i], fastCheck);\r\n\r\n if (pickInfo.hit) {\r\n results.push(pickInfo);\r\n }\r\n }\r\n\r\n results.sort(this._comparePickingInfo);\r\n\r\n return results;\r\n }\r\n\r\n private _comparePickingInfo(pickingInfoA: DeepImmutable<PickingInfo>, pickingInfoB: DeepImmutable<PickingInfo>): number {\r\n if (pickingInfoA.distance < pickingInfoB.distance) {\r\n return -1;\r\n } else if (pickingInfoA.distance > pickingInfoB.distance) {\r\n return 1;\r\n } else {\r\n return 0;\r\n }\r\n }\r\n\r\n private static _Smallnum = 0.00000001;\r\n private static _Rayl = 10e8;\r\n\r\n /**\r\n * Intersection test between the ray and a given segment within a given tolerance (threshold)\r\n * @param sega the first point of the segment to test the intersection against\r\n * @param segb the second point of the segment to test the intersection against\r\n * @param threshold the tolerance margin, if the ray doesn't intersect the segment but is close to the given threshold, the intersection is successful\r\n * @returns the distance from the ray origin to the intersection point if there's intersection, or -1 if there's no intersection\r\n */\r\n intersectionSegment(sega: DeepImmutable<Vector3>, segb: DeepImmutable<Vector3>, threshold: number): number {\r\n const o = this.origin;\r\n const u = TmpVectors.Vector3[0];\r\n const rsegb = TmpVectors.Vector3[1];\r\n const v = TmpVectors.Vector3[2];\r\n const w = TmpVectors.Vector3[3];\r\n\r\n segb.subtractToRef(sega, u);\r\n\r\n this.direction.scaleToRef(Ray._Rayl, v);\r\n o.addToRef(v, rsegb);\r\n\r\n sega.subtractToRef(o, w);\r\n\r\n const a = Vector3.Dot(u, u); // always >= 0\r\n const b = Vector3.Dot(u, v);\r\n const c = Vector3.Dot(v, v); // always >= 0\r\n const d = Vector3.Dot(u, w);\r\n const e = Vector3.Dot(v, w);\r\n const D = a * c - b * b; // always >= 0\r\n let sN: number,\r\n sD = D; // sc = sN / sD, default sD = D >= 0\r\n let tN: number,\r\n tD = D; // tc = tN / tD, default tD = D >= 0\r\n\r\n // compute the line parameters of the two closest points\r\n if (D < Ray._Smallnum) {\r\n // the lines are almost parallel\r\n sN = 0.0; // force using point P0 on segment S1\r\n sD = 1.0; // to prevent possible division by 0.0 later\r\n tN = e;\r\n tD = c;\r\n } else {\r\n // get the closest points on the infinite lines\r\n sN = b * e - c * d;\r\n tN = a * e - b * d;\r\n if (sN < 0.0) {\r\n // sc < 0 => the s=0 edge is visible\r\n sN = 0.0;\r\n tN = e;\r\n tD = c;\r\n } else if (sN > sD) {\r\n // sc > 1 => the s=1 edge is visible\r\n sN = sD;\r\n tN = e + b;\r\n tD = c;\r\n }\r\n }\r\n\r\n if (tN < 0.0) {\r\n // tc < 0 => the t=0 edge is visible\r\n tN = 0.0;\r\n // recompute sc for this edge\r\n if (-d < 0.0) {\r\n sN = 0.0;\r\n } else if (-d > a) {\r\n sN = sD;\r\n } else {\r\n sN = -d;\r\n sD = a;\r\n }\r\n } else if (tN > tD) {\r\n // tc > 1 => the t=1 edge is visible\r\n tN = tD;\r\n // recompute sc for this edge\r\n if (-d + b < 0.0) {\r\n sN = 0;\r\n } else if (-d + b > a) {\r\n sN = sD;\r\n } else {\r\n sN = -d + b;\r\n sD = a;\r\n }\r\n }\r\n // finally do the division to get sc and tc\r\n const sc = Math.abs(sN) < Ray._Smallnum ? 0.0 : sN / sD;\r\n const tc = Math.abs(tN) < Ray._Smallnum ? 0.0 : tN / tD;\r\n\r\n // get the difference of the two closest points\r\n const qtc = TmpVectors.Vector3[4];\r\n v.scaleToRef(tc, qtc);\r\n const qsc = TmpVectors.Vector3[5];\r\n u.scaleToRef(sc, qsc);\r\n qsc.addInPlace(w);\r\n const dP = TmpVectors.Vector3[6];\r\n qsc.subtractToRef(qtc, dP); // = S1(sc) - S2(tc)\r\n\r\n const isIntersected = tc > 0 && tc <= this.length && dP.lengthSquared() < threshold * threshold; // return intersection result\r\n\r\n if (isIntersected) {\r\n return qsc.length();\r\n }\r\n return -1;\r\n }\r\n\r\n /**\r\n * Update the ray from viewport position\r\n * @param x position\r\n * @param y y position\r\n * @param viewportWidth viewport width\r\n * @param viewportHeight viewport height\r\n * @param world world matrix\r\n * @param view view matrix\r\n * @param projection projection matrix\r\n * @param enableDistantPicking defines if picking should handle large values for mesh position/scaling (false by default)\r\n * @returns this ray updated\r\n */\r\n public update(\r\n x: number,\r\n y: number,\r\n viewportWidth: number,\r\n viewportHeight: number,\r\n world: DeepImmutable<Matrix>,\r\n view: DeepImmutable<Matrix>,\r\n projection: DeepImmutable<Matrix>,\r\n enableDistantPicking: boolean = false\r\n ): Ray {\r\n if (enableDistantPicking) {\r\n // With world matrices having great values (like 8000000000 on 1 or more scaling or position axis),\r\n // multiplying view/projection/world and doing invert will result in loss of float precision in the matrix.\r\n // One way to fix it is to compute the ray with world at identity then transform the ray in object space.\r\n // This is slower (2 matrix inverts instead of 1) but precision is preserved.\r\n // This is hidden behind `EnableDistantPicking` flag (default is false)\r\n if (!Ray._RayDistant) {\r\n Ray._RayDistant = Ray.Zero();\r\n }\r\n\r\n Ray._RayDistant.unprojectRayToRef(x, y, viewportWidth, viewportHeight, Matrix.IdentityReadOnly, view, projection);\r\n\r\n const tm = TmpVectors.Matrix[0];\r\n world.invertToRef(tm);\r\n Ray.TransformToRef(Ray._RayDistant, tm, this);\r\n } else {\r\n this.unprojectRayToRef(x, y, viewportWidth, viewportHeight, world, view, projection);\r\n }\r\n\r\n return this;\r\n }\r\n\r\n // Statics\r\n /**\r\n * Creates a ray with origin and direction of 0,0,0\r\n * @returns the new ray\r\n */\r\n public static Zero(): Ray {\r\n return new Ray(Vector3.Zero(), Vector3.Zero());\r\n }\r\n\r\n /**\r\n * Creates a new ray from screen space and viewport\r\n * @param x position\r\n * @param y y position\r\n * @param viewportWidth viewport width\r\n * @param viewportHeight viewport height\r\n * @param world world matrix\r\n * @param view view matrix\r\n * @param projection projection matrix\r\n * @returns new ray\r\n */\r\n public static CreateNew(\r\n x: number,\r\n y: number,\r\n viewportWidth: number,\r\n viewportHeight: number,\r\n world: DeepImmutable<Matrix>,\r\n view: DeepImmutable<Matrix>,\r\n projection: DeepImmutable<Matrix>\r\n ): Ray {\r\n const result = Ray.Zero();\r\n\r\n return result.update(x, y, viewportWidth, viewportHeight, world, view, projection);\r\n }\r\n\r\n /**\r\n * Function will create a new transformed ray starting from origin and ending at the end point. Ray's length will be set, and ray will be\r\n * transformed to the given world matrix.\r\n * @param origin The origin point\r\n * @param end The end point\r\n * @param world a matrix to transform the ray to. Default is the identity matrix.\r\n * @returns the new ray\r\n */\r\n public static CreateNewFromTo(origin: Vector3, end: Vector3, world: DeepImmutable<Matrix> = Matrix.IdentityReadOnly): Ray {\r\n const result = new Ray(new Vector3(0, 0, 0), new Vector3(0, 0, 0));\r\n return Ray.CreateFromToToRef(origin, end, result, world);\r\n }\r\n\r\n /**\r\n * Function will update a transformed ray starting from origin and ending at the end point. Ray's length will be set, and ray will be\r\n * transformed to the given world matrix.\r\n * @param origin The origin point\r\n * @param end The end point\r\n * @param result the object to store the result\r\n * @param world a matrix to transform the ray to. Default is the identity matrix.\r\n * @returns the ref ray\r\n */\r\n public static CreateFromToToRef(origin: Vector3, end: Vector3, result: Ray, world: DeepImmutable<Matrix> = Matrix.IdentityReadOnly): Ray {\r\n result.origin.copyFrom(origin);\r\n const direction = end.subtractToRef(origin, result.direction);\r\n const length = Math.sqrt(direction.x * direction.x + direction.y * direction.y + direction.z * direction.z);\r\n result.length = length;\r\n result.direction.normalize();\r\n\r\n return Ray.TransformToRef(result, world, result);\r\n }\r\n\r\n /**\r\n * Transforms a ray by a matrix\r\n * @param ray ray to transform\r\n * @param matrix matrix to apply\r\n * @returns the resulting new ray\r\n */\r\n public static Transform(ray: DeepImmutable<Ray>, matrix: DeepImmutable<Matrix>): Ray {\r\n const result = new Ray(new Vector3(0, 0, 0), new Vector3(0, 0, 0));\r\n Ray.TransformToRef(ray, matrix, result);\r\n\r\n return result;\r\n }\r\n\r\n /**\r\n * Transforms a ray by a matrix\r\n * @param ray ray to transform\r\n * @param matrix matrix to apply\r\n * @param result ray to store result in\r\n * @returns the updated result ray\r\n */\r\n public static TransformToRef(ray: DeepImmutable<Ray>, matrix: DeepImmutable<Matrix>, result: Ray): Ray {\r\n Vector3.TransformCoordinatesToRef(ray.origin, matrix, result.origin);\r\n Vector3.TransformNormalToRef(ray.direction, matrix, result.direction);\r\n result.length = ray.length;\r\n result.epsilon = ray.epsilon;\r\n\r\n const dir = result.direction;\r\n const len = dir.length();\r\n\r\n if (!(len === 0 || len === 1)) {\r\n const num = 1.0 / len;\r\n dir.x *= num;\r\n dir.y *= num;\r\n dir.z *= num;\r\n result.length *= len;\r\n }\r\n\r\n return result;\r\n }\r\n\r\n /**\r\n * Unproject a ray from screen space to object space\r\n * @param sourceX defines the screen space x coordinate to use\r\n * @param sourceY defines the screen space y coordinate to use\r\n * @param viewportWidth defines the current width of the viewport\r\n * @param viewportHeight defines the current height of the viewport\r\n * @param world defines the world matrix to use (can be set to Identity to go to world space)\r\n * @param view defines the view matrix to use\r\n * @param projection defines the projection matrix to use\r\n */\r\n public unprojectRayToRef(\r\n sourceX: float,\r\n sourceY: float,\r\n viewportWidth: number,\r\n viewportHeight: number,\r\n world: DeepImmutable<Matrix>,\r\n view: DeepImmutable<Matrix>,\r\n projection: DeepImmutable<Matrix>\r\n ): void {\r\n const matrix = TmpVectors.Matrix[0];\r\n world.multiplyToRef(view, matrix);\r\n matrix.multiplyToRef(projection, matrix);\r\n matrix.invert();\r\n\r\n const engine = EngineStore.LastCreatedEngine;\r\n const nearScreenSource = TmpVectors.Vector3[0];\r\n nearScreenSource.x = (sourceX / viewportWidth) * 2 - 1;\r\n nearScreenSource.y = -((sourceY / viewportHeight) * 2 - 1);\r\n nearScreenSource.z = engine?.useReverseDepthBuffer ? 1 : engine?.isNDCHalfZRange ? 0 : -1;\r\n\r\n // far Z need to be close but < to 1 or camera projection matrix with maxZ = 0 will NaN\r\n const farScreenSource = TmpVectors.Vector3[1].copyFromFloats(nearScreenSource.x, nearScreenSource.y, 1.0 - 1e-8);\r\n const nearVec3 = TmpVectors.Vector3[2];\r\n const farVec3 = TmpVectors.Vector3[3];\r\n Vector3._UnprojectFromInvertedMatrixToRef(nearScreenSource, matrix, nearVec3);\r\n Vector3._UnprojectFromInvertedMatrixToRef(farScreenSource, matrix, farVec3);\r\n\r\n this.origin.copyFrom(nearVec3);\r\n farVec3.subtractToRef(nearVec3, this.direction);\r\n this.direction.normalize();\r\n }\r\n}\r\n\r\n// Picking\r\n/**\r\n * Type used to define predicate for selecting meshes and instances (if exist)\r\n */\r\nexport type MeshPredicate = (mesh: AbstractMesh, thinInstanceIndex: number) => boolean;\r\n\r\n/**\r\n * Type used to define predicate used to select faces when a mesh intersection is detected\r\n */\r\nexport type TrianglePickingPredicate = (p0: Vector3, p1: Vector3, p2: Vector3, ray: Ray, i0: number, i1: number, i2: number) => boolean;\r\n\r\ndeclare module \"../scene\" {\r\n export interface Scene {\r\n /** @internal */\r\n _tempPickingRay: Nullable<Ray>;\r\n\r\n /** @internal */\r\n _cachedRayForTransform: Ray;\r\n\r\n /** @internal */\r\n _pickWithRayInverseMatrix: Matrix;\r\n\r\n /** @internal */\r\n _internalPick(\r\n rayFunction: (world: Matrix, enableDistantPicking: boolean) => Ray,\r\n predicate?: MeshPredicate,\r\n fastCheck?: boolean,\r\n onlyBoundingInfo?: boolean,\r\n trianglePredicate?: TrianglePickingPredicate\r\n ): PickingInfo;\r\n\r\n /** @internal */\r\n _internalMultiPick(\r\n rayFunction: (world: Matrix, enableDistantPicking: boolean) => Ray,\r\n predicate?: MeshPredicate,\r\n trianglePredicate?: TrianglePickingPredicate\r\n ): Nullable<PickingInfo[]>;\r\n\r\n /** @internal */\r\n _internalPickForMesh(\r\n pickingInfo: Nullable<PickingInfo>,\r\n rayFunction: (world: Matrix, enableDistantPicking: boolean) => Ray,\r\n mesh: AbstractMesh,\r\n world: Matrix,\r\n fastCheck?: boolean,\r\n onlyBoundingInfo?: boolean,\r\n trianglePredicate?: TrianglePickingPredicate,\r\n skipBoundingInfo?: boolean\r\n ): Nullable<PickingInfo>;\r\n }\r\n}\r\n\r\nScene.prototype.createPickingRay = function (x: number, y: number, world: Nullable<Matrix>, camera: Nullable<Camera>, cameraViewSpace = false): Ray {\r\n const result = Ray.Zero();\r\n\r\n this.createPickingRayToRef(x, y, world, result, camera, cameraViewSpace);\r\n\r\n return result;\r\n};\r\n\r\nScene.prototype.createPickingRayToRef = function (\r\n x: number,\r\n y: number,\r\n world: Nullable<Matrix>,\r\n result: Ray,\r\n camera: Nullable<Camera>,\r\n cameraViewSpace = false,\r\n enableDistantPicking = false\r\n): Scene {\r\n const engine = this.getEngine();\r\n\r\n if (!camera && !(camera = this.activeCamera!)) {\r\n return this;\r\n }\r\n\r\n const cameraViewport = camera.viewport;\r\n const renderHeight = engine.getRenderHeight();\r\n const { x: vx, y: vy, width, height } = cameraViewport.toGlobal(engine.getRenderWidth(), renderHeight);\r\n\r\n // Moving coordinates to local viewport world\r\n const levelInv = 1 / engine.getHardwareScalingLevel();\r\n x = x * levelInv - vx;\r\n y = y * levelInv - (renderHeight - vy - height);\r\n\r\n result.update(\r\n x,\r\n y,\r\n width,\r\n height,\r\n world ? world : Matrix.IdentityReadOnly,\r\n cameraViewSpace ? Matrix.IdentityReadOnly : camera.getViewMatrix(),\r\n camera.getProjectionMatrix(),\r\n enableDistantPicking\r\n );\r\n return this;\r\n};\r\n\r\nScene.prototype.createPickingRayInCameraSpace = function (x: number, y: number, camera?: Camera): Ray {\r\n const result = Ray.Zero();\r\n\r\n this.createPickingRayInCameraSpaceToRef(x, y, result, camera);\r\n\r\n return result;\r\n};\r\n\r\nScene.prototype.createPickingRayInCameraSpaceToRef = function (x: number, y: number, result: Ray, camera?: Camera): Scene {\r\n if (!PickingInfo) {\r\n return this;\r\n }\r\n\r\n const engine = this.getEngine();\r\n\r\n if (!camera && !(camera = this.activeCamera!)) {\r\n throw new Error(\"Active camera not set\");\r\n }\r\n\r\n const cameraViewport = camera.viewport;\r\n const renderHeight = engine.getRenderHeight();\r\n const { x: vx, y: vy, width, height } = cameraViewport.toGlobal(engine.getRenderWidth(), renderHeight);\r\n const identity = Matrix.Identity();\r\n\r\n // Moving coordinates to local viewport world\r\n const levelInv = 1 / engine.getHardwareScalingLevel();\r\n x = x * levelInv - vx;\r\n y = y * levelInv - (renderHeight - vy - height);\r\n result.update(x, y, width, height, identity, identity, camera.getProjectionMatrix());\r\n return this;\r\n};\r\n\r\nScene.prototype._internalPickForMesh = function (\r\n pickingInfo: Nullable<PickingInfo>,\r\n rayFunction: (world: Matrix, enableDistantPicking: boolean) => Ray,\r\n mesh: AbstractMesh,\r\n world: Matrix,\r\n fastCheck?: boolean,\r\n onlyBoundingInfo?: boolean,\r\n trianglePredicate?: TrianglePickingPredicate,\r\n skipBoundingInfo?: boolean\r\n) {\r\n const ray = rayFunction(world, mesh.enableDistantPicking);\r\n\r\n const result = mesh.intersects(ray, fastCheck, trianglePredicate, onlyBoundingInfo, world, skipBoundingInfo);\r\n if (!result || !result.hit) {\r\n return null;\r\n }\r\n\r\n if (!fastCheck && pickingInfo != null && result.distance >= pickingInfo.distance) {\r\n return null;\r\n }\r\n\r\n return result;\r\n};\r\n\r\nScene.prototype._internalPick = function (\r\n rayFunction: (world: Matrix, enableDistantPicking: boolean) => Ray,\r\n predicate?: MeshPredicate,\r\n fastCheck?: boolean,\r\n onlyBoundingInfo?: boolean,\r\n trianglePredicate?: TrianglePickingPredicate\r\n): PickingInfo {\r\n let pickingInfo = null;\r\n\r\n const computeWorldMatrixForCamera = !!(this.activeCameras && this.activeCameras.length > 1 && this.cameraToUseForPointers !== this.activeCamera);\r\n const currentCamera = this.cameraToUseForPointers || this.activeCamera;\r\n\r\n for (let meshIndex = 0; meshIndex < this.meshes.length; meshIndex++) {\r\n const mesh = this.meshes[meshIndex];\r\n\r\n if (predicate) {\r\n if (!predicate(mesh, -1)) {\r\n continue;\r\n }\r\n } else if (!mesh.isEnabled() || !mesh.isVisible || !mesh.isPickable) {\r\n continue;\r\n }\r\n\r\n const forceCompute = computeWorldMatrixForCamera && mesh.isWorldMatrixCameraDependent();\r\n const world = mesh.computeWorldMatrix(forceCompute, currentCamera);\r\n\r\n if (mesh.hasThinInstances && (mesh as Mesh).thinInstanceEnablePicking) {\r\n // first check if the ray intersects the whole bounding box/sphere of the mesh\r\n const result = this._internalPickForMesh(pickingInfo, rayFunction, mesh, world, true, true, trianglePredicate);\r\n if (result) {\r\n if (onlyBoundingInfo) {\r\n // the user only asked for a bounding info check so we can return\r\n return result;\r\n }\r\n const tmpMatrix = TmpVectors.Matrix[1];\r\n const thinMatrices = (mesh as Mesh).thinInstanceGetWorldMatrices();\r\n for (let index = 0; index < thinMatrices.length; index++) {\r\n if (predicate && !predicate(mesh, index)) {\r\n continue;\r\n }\r\n const thinMatrix = thinMatrices[index];\r\n thinMatrix.multiplyToRef(world, tmpMatrix);\r\n const result = this._internalPickForMesh(pickingInfo, rayFunction, mesh, tmpMatrix, fastCheck, onlyBoundingInfo, trianglePredicate, true);\r\n\r\n if (result) {\r\n pickingInfo = result;\r\n pickingInfo.thinInstanceIndex = index;\r\n\r\n if (fastCheck) {\r\n return pickingInfo;\r\n }\r\n }\r\n }\r\n }\r\n } else {\r\n const result = this._internalPickForMesh(pickingInfo, rayFunction, mesh, world, fastCheck, onlyBoundingInfo, trianglePredicate);\r\n\r\n if (result) {\r\n pickingInfo = result;\r\n\r\n if (fastCheck) {\r\n return pickingInfo;\r\n }\r\n }\r\n }\r\n }\r\n\r\n return pickingInfo || new PickingInfo();\r\n};\r\n\r\nScene.prototype._internalMultiPick = function (\r\n rayFunction: (world: Matrix, enableDistantPicking: boolean) => Ray,\r\n predicate?: MeshPredicate,\r\n trianglePredicate?: TrianglePickingPredicate\r\n): Nullable<PickingInfo[]> {\r\n if (!PickingInfo) {\r\n return null;\r\n }\r\n const pickingInfos: PickingInfo[] = [];\r\n const computeWorldMatrixForCamera = !!(this.activeCameras && this.activeCameras.length > 1 && this.cameraToUseForPointers !== this.activeCamera);\r\n const currentCamera = this.cameraToUseForPointers || this.activeCamera;\r\n\r\n for (let meshIndex = 0; meshIndex < this.meshes.length; meshIndex++) {\r\n const mesh = this.meshes[meshIndex];\r\n\r\n if (predicate) {\r\n if (!predicate(mesh, -1)) {\r\n continue;\r\n }\r\n } else if (!mesh.isEnabled() || !mesh.isVisible || !mesh.isPickable) {\r\n continue;\r\n }\r\n\r\n const forceCompute = computeWorldMatrixForCamera && mesh.isWorldMatrixCameraDependent();\r\n const world = mesh.computeWorldMatrix(forceCompute, currentCamera);\r\n\r\n if (mesh.hasThinInstances && (mesh as Mesh).thinInstanceEnablePicking) {\r\n const result = this._internalPickForMesh(null, rayFunction, mesh, world, true, true, trianglePredicate);\r\n if (result) {\r\n const tmpMatrix = TmpVectors.Matrix[1];\r\n const thinMatrices = (mesh as Mesh).thinInstanceGetWorldMatrices();\r\n for (let index = 0; index < thinMatrices.length; index++) {\r\n if (predicate && !predicate(mesh, index)) {\r\n continue;\r\n }\r\n const thinMatrix = thinMatrices[index];\r\n thinMatrix.multiplyToRef(world, tmpMatrix);\r\n const result = this._internalPickForMesh(null, rayFunction, mesh, tmpMatrix, false, false, trianglePredicate, true);\r\n\r\n if (result) {\r\n result.thinInstanceIndex = index;\r\n pickingInfos.push(result);\r\n }\r\n }\r\n }\r\n } else {\r\n const result = this._internalPickForMesh(null, rayFunction, mesh, world, false, false, trianglePredicate);\r\n\r\n if (result) {\r\n pickingInfos.push(result);\r\n }\r\n }\r\n }\r\n\r\n return pickingInfos;\r\n};\r\n\r\nScene.prototype.pickWithBoundingInfo = function (x: number, y: number, predicate?: MeshPredicate, fastCheck?: boolean, camera?: Nullable<Camera>): Nullable<PickingInfo> {\r\n if (!PickingInfo) {\r\n return null;\r\n }\r\n const result = this._internalPick(\r\n (world) => {\r\n if (!this._tempPickingRay) {\r\n this._tempPickingRay = Ray.Zero();\r\n }\r\n\r\n this.createPickingRayToRef(x, y, world, this._tempPickingRay, camera || null);\r\n return this._tempPickingRay;\r\n },\r\n predicate,\r\n fastCheck,\r\n true\r\n );\r\n if (result) {\r\n result.ray = this.createPickingRay(x, y, Matrix.Identity(), camera || null);\r\n }\r\n return result;\r\n};\r\n\r\nObject.defineProperty(Scene.prototype, \"_pickingAvailable\", {\r\n get: () => true,\r\n enumerable: false,\r\n configurable: false,\r\n});\r\n\r\nScene.prototype.pick = function (\r\n x: number,\r\n y: number,\r\n predicate?: MeshPredicate,\r\n fastCheck?: boolean,\r\n camera?: Nullable<Camera>,\r\n trianglePredicate?: TrianglePickingPredicate,\r\n _enableDistantPicking = false\r\n): PickingInfo {\r\n const result = this._internalPick(\r\n (world, enableDistantPicking) => {\r\n if (!this._tempPickingRay) {\r\n this._tempPickingRay = Ray.Zero();\r\n }\r\n\r\n this.createPickingRayToRef(x, y, world, this._tempPickingRay, camera || null, false, enableDistantPicking);\r\n return this._tempPickingRay;\r\n },\r\n predicate,\r\n fastCheck,\r\n false,\r\n trianglePredicate\r\n );\r\n if (result) {\r\n result.ray = this.createPickingRay(x, y, Matrix.Identity(), camera || null);\r\n }\r\n return result;\r\n};\r\n\r\nScene.prototype.pickWithRay = function (ray: Ray, predicate?: MeshPredicate, fastCheck?: boolean, trianglePredicate?: TrianglePickingPredicate): Nullable<PickingInfo> {\r\n const result = this._internalPick(\r\n (world) => {\r\n if (!this._pickWithRayInverseMatrix) {\r\n this._pickWithRayInverseMatrix = Matrix.Identity();\r\n }\r\n world.invertToRef(this._pickWithRayInverseMatrix);\r\n\r\n if (!this._cachedRayForTransform) {\r\n this._cachedRayForTransform = Ray.Zero();\r\n }\r\n\r\n Ray.TransformToRef(ray, this._pickWithRayInverseMatrix, this._cachedRayForTransform);\r\n return this._cachedRayForTransform;\r\n },\r\n predicate,\r\n fastCheck,\r\n false,\r\n trianglePredicate\r\n );\r\n if (result) {\r\n result.ray = ray;\r\n }\r\n return result;\r\n};\r\n\r\nScene.prototype.multiPick = function (x: number, y: number, predicate?: MeshPredicate, camera?: Camera, trianglePredicate?: TrianglePickingPredicate): Nullable<PickingInfo[]> {\r\n return this._internalMultiPick((world) => this.createPickingRay(x, y, world, camera || null), predicate, trianglePredicate);\r\n};\r\n\r\nScene.prototype.multiPickWithRay = function (ray: Ray, predicate?: MeshPredicate, trianglePredicate?: TrianglePickingPredicate): Nullable<PickingInfo[]> {\r\n return this._internalMultiPick(\r\n (world) => {\r\n if (!this._pickWithRayInverseMatrix) {\r\n this._pickWithRayInverseMatrix = Matrix.Identity();\r\n }\r\n world.invertToRef(this._pickWithRayInverseMatrix);\r\n\r\n if (!this._cachedRayForTransform) {\r\n this._cachedRayForTransform = Ray.Zero();\r\n }\r\n\r\n Ray.TransformToRef(ray, this._pickWithRayInverseMatrix, this._cachedRayForTransform);\r\n return this._cachedRayForTransform;\r\n },\r\n predicate,\r\n trianglePredicate\r\n );\r\n};\r\n\r\nCamera.prototype.getForwardRay = function (length = 100, transform?: Matrix, origin?: Vector3): Ray {\r\n return this.getForwardRayToRef(new Ray(Vector3.Zero(), Vector3.Zero(), length), length, transform, origin);\r\n};\r\n\r\nCamera.prototype.getForwardRayToRef = function (refRay: Ray, length = 100, transform?: Matrix, origin?: Vector3): Ray {\r\n if (!transform) {\r\n transform = this.getWorldMatrix();\r\n }\r\n refRay.length = length;\r\n\r\n if (origin) {\r\n refRay.origin.copyFrom(origin);\r\n } else {\r\n refRay.origin.copyFrom(this.position);\r\n }\r\n const forward = TmpVectors.Vector3[2];\r\n forward.set(0, 0, this._scene.useRightHandedSystem ? -1 : 1);\r\n const worldForward = TmpVectors.Vector3[3];\r\n Vector3.TransformNormalToRef(forward, transform, worldForward);\r\n Vector3.NormalizeToRef(worldForward, refRay.direction);\r\n\r\n return refRay;\r\n};\r\n"]}
1
+ {"version":3,"file":"ray.js","sourceRoot":"","sources":["../../../../dev/core/src/Culling/ray.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAG3C,OAAO,EACH,gBAAgB,EAChB,6BAA6B,EAC7B,kCAAkC,EAClC,qBAAqB,EACrB,SAAS,EACT,gBAAgB,EAChB,IAAI,EACJ,oBAAoB,EACpB,WAAW,GACd,MAAM,YAAY,CAAC;AAEpB,cAAc,YAAY,CAAC;AAE3B,UAAU;AACV,gBAAgB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;A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K,CAAC,SAAS,CAAC,WAAW,GAAG,UAAU,GAAQ,EAAE,SAAyB,EAAE,SAAmB,EAAE,iBAA4C;IAC1I,OAAO,WAAW,CAAC,IAAI,EAAE,GAAG,EAAE,SAAS,EAAE,SAAS,EAAE,iBAAiB,CAAC,CAAC;AAC3E,CAAC,CAAC;AAEF,KAAK,CAAC,SAAS,CAAC,SAAS,GAAG,UAAU,CAAS,EAAE,CAAS,EAAE,SAAyB,EAAE,MAAe,EAAE,iBAA4C;IAChJ,OAAO,SAAS,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,iBAAiB,CAAC,CAAC;AACvE,CAAC,CAAC;AAEF,KAAK,CAAC,SAAS,CAAC,gBAAgB,GAAG,UAAU,GAAQ,EAAE,SAAyB,EAAE,iBAA4C;IAC1H,OAAO,gBAAgB,CAAC,IAAI,EAAE,GAAG,EAAE,SAAS,EAAE,iBAAiB,CAAC,CAAC;AACrE,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"../types\";\r\nimport type { Matrix } from \"../Maths/math.vector\";\r\nimport type { PickingInfo } from \"../Collisions/pickingInfo\";\r\n\r\nimport { Scene } from \"../scene\";\r\nimport { Camera } from \"../Cameras/camera\";\r\n\r\nimport type { MeshPredicate, TrianglePickingPredicate, Ray } from \"./ray.core\";\r\nimport {\r\n AddRayExtensions,\r\n CreatePickingRayInCameraSpace,\r\n CreatePickingRayInCameraSpaceToRef,\r\n CreatePickingRayToRef,\r\n MultiPick,\r\n MultiPickWithRay,\r\n Pick,\r\n PickWithBoundingInfo,\r\n PickWithRay,\r\n} from \"./ray.core\";\r\n\r\nexport * from \"./ray.core\";\r\n\r\n// Picking\r\nAddRayExtensions(Scene, Camera);\r\n\r\nScene.prototype.createPickingRayToRef = function (\r\n x: number,\r\n y: number,\r\n world: Nullable<Matrix>,\r\n result: Ray,\r\n camera: Nullable<Camera>,\r\n cameraViewSpace = false,\r\n enableDistantPicking = false\r\n): Scene {\r\n return CreatePickingRayToRef(this, x, y, world, result, camera, cameraViewSpace, enableDistantPicking);\r\n};\r\n\r\nScene.prototype.createPickingRayInCameraSpace = function (x: number, y: number, camera?: Camera): Ray {\r\n return CreatePickingRayInCameraSpace(this, x, y, camera);\r\n};\r\n\r\nScene.prototype.createPickingRayInCameraSpaceToRef = function (x: number, y: number, result: Ray, camera?: Camera): Scene {\r\n return CreatePickingRayInCameraSpaceToRef(this, x, y, result, camera);\r\n};\r\n\r\nScene.prototype.pickWithBoundingInfo = function (x: number, y: number, predicate?: MeshPredicate, fastCheck?: boolean, camera?: Nullable<Camera>): Nullable<PickingInfo> {\r\n return PickWithBoundingInfo(this, x, y, predicate, fastCheck, camera);\r\n};\r\n\r\nScene.prototype.pick = function (\r\n x: number,\r\n y: number,\r\n predicate?: MeshPredicate,\r\n fastCheck?: boolean,\r\n camera?: Nullable<Camera>,\r\n trianglePredicate?: TrianglePickingPredicate,\r\n _enableDistantPicking = false\r\n): PickingInfo {\r\n return Pick(this, x, y, predicate, fastCheck, camera, trianglePredicate, _enableDistantPicking);\r\n};\r\n\r\nScene.prototype.pickWithRay = function (ray: Ray, predicate?: MeshPredicate, fastCheck?: boolean, trianglePredicate?: TrianglePickingPredicate): Nullable<PickingInfo> {\r\n return PickWithRay(this, ray, predicate, fastCheck, trianglePredicate);\r\n};\r\n\r\nScene.prototype.multiPick = function (x: number, y: number, predicate?: MeshPredicate, camera?: Camera, trianglePredicate?: TrianglePickingPredicate): Nullable<PickingInfo[]> {\r\n return MultiPick(this, x, y, predicate, camera, trianglePredicate);\r\n};\r\n\r\nScene.prototype.multiPickWithRay = function (ray: Ray, predicate?: MeshPredicate, trianglePredicate?: TrianglePickingPredicate): Nullable<PickingInfo[]> {\r\n return MultiPickWithRay(this, ray, predicate, trianglePredicate);\r\n};\r\n"]}
@@ -741,13 +741,13 @@ export class AbstractEngine {
741
741
  */
742
742
  // Not mixed with Version for tooling purpose.
743
743
  static get NpmPackage() {
744
- return "babylonjs@7.27.2";
744
+ return "babylonjs@7.27.3";
745
745
  }
746
746
  /**
747
747
  * Returns the current version of the framework
748
748
  */
749
749
  static get Version() {
750
- return "7.27.2";
750
+ return "7.27.3";
751
751
  }
752
752
  /**
753
753
  * Gets the HTML canvas attached with the current webGL context