@onerjs/core 8.30.8 → 8.31.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.
- package/Behaviors/Cameras/interpolatingBehavior.d.ts +52 -0
- package/Behaviors/Cameras/interpolatingBehavior.js +105 -0
- package/Behaviors/Cameras/interpolatingBehavior.js.map +1 -0
- package/Cameras/Inputs/arcRotateCameraPointersInput.d.ts +5 -20
- package/Cameras/Inputs/arcRotateCameraPointersInput.js +9 -69
- package/Cameras/Inputs/arcRotateCameraPointersInput.js.map +1 -1
- package/Cameras/Inputs/geospatialCameraPointersInput.d.ts +10 -2
- package/Cameras/Inputs/geospatialCameraPointersInput.js +20 -2
- package/Cameras/Inputs/geospatialCameraPointersInput.js.map +1 -1
- package/Cameras/Inputs/orbitCameraPointersInput.d.ts +49 -0
- package/Cameras/Inputs/orbitCameraPointersInput.js +105 -0
- package/Cameras/Inputs/orbitCameraPointersInput.js.map +1 -0
- package/Cameras/camera.js +1 -0
- package/Cameras/camera.js.map +1 -1
- package/Cameras/cameraMovement.d.ts +150 -0
- package/Cameras/cameraMovement.js +190 -0
- package/Cameras/cameraMovement.js.map +1 -0
- package/Cameras/targetCamera.js +0 -4
- package/Cameras/targetCamera.js.map +1 -1
- package/Culling/ray.core.js +1 -1
- package/Culling/ray.core.js.map +1 -1
- package/Decorators/nodeDecorator.d.ts +9 -7
- package/Decorators/nodeDecorator.js +9 -7
- package/Decorators/nodeDecorator.js.map +1 -1
- package/Engines/WebGPU/webgpuTextureManager.js +2 -2
- package/Engines/WebGPU/webgpuTextureManager.js.map +1 -1
- package/Engines/abstractEngine.js +2 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/FrameGraph/Node/Blocks/Layers/glowLayerBlock.js +1 -1
- package/FrameGraph/Node/Blocks/Layers/glowLayerBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/Layers/highlightLayerBlock.js +1 -1
- package/FrameGraph/Node/Blocks/Layers/highlightLayerBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/basePostProcessBlock.js +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/baseWithPropertiesPostProcessBlock.js +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/circleOfConfusionPostProcessBlock.js +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/colorCorrectionPostProcessBlock.js +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/depthOfFieldPostProcessBlock.js +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/filterPostProcessBlock.js +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/imageProcessingPostProcessBlock.js +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/ssao2PostProcessBlock.js +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/ssao2PostProcessBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/ssrPostProcessBlock.js +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/ssrPostProcessBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.d.ts +6 -0
- package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.js +26 -0
- package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.d.ts +6 -0
- package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.js +48 -22
- package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/Textures/clearBlock.js +3 -3
- package/FrameGraph/Node/Blocks/Textures/clearBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/Textures/copyTextureBlock.js +1 -1
- package/FrameGraph/Node/Blocks/Textures/generateMipmapsBlock.js +1 -1
- package/FrameGraph/Node/Blocks/Textures/generateMipmapsBlock.js.map +1 -1
- package/FrameGraph/Node/nodeRenderGraph.js +2 -1
- package/FrameGraph/Node/nodeRenderGraph.js.map +1 -1
- package/FrameGraph/Passes/{cullPass.d.ts → objectListPass.d.ts} +8 -8
- package/FrameGraph/Passes/{cullPass.js → objectListPass.js} +9 -9
- package/FrameGraph/Passes/objectListPass.js.map +1 -0
- package/FrameGraph/Passes/renderPass.d.ts +6 -2
- package/FrameGraph/Passes/renderPass.js +14 -2
- package/FrameGraph/Passes/renderPass.js.map +1 -1
- package/FrameGraph/Tasks/Misc/cullObjectsTask.js +2 -2
- package/FrameGraph/Tasks/Misc/cullObjectsTask.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/geometryRendererTask.d.ts +8 -0
- package/FrameGraph/Tasks/Rendering/geometryRendererTask.js +10 -0
- package/FrameGraph/Tasks/Rendering/geometryRendererTask.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/objectRendererTask.d.ts +8 -0
- package/FrameGraph/Tasks/Rendering/objectRendererTask.js +13 -0
- package/FrameGraph/Tasks/Rendering/objectRendererTask.js.map +1 -1
- package/FrameGraph/Tasks/Texture/clearTextureTask.d.ts +1 -1
- package/FrameGraph/Tasks/Texture/clearTextureTask.js +7 -5
- package/FrameGraph/Tasks/Texture/clearTextureTask.js.map +1 -1
- package/FrameGraph/frameGraph.d.ts +10 -4
- package/FrameGraph/frameGraph.js +22 -9
- package/FrameGraph/frameGraph.js.map +1 -1
- package/FrameGraph/frameGraphTask.js +3 -3
- package/FrameGraph/frameGraphTask.js.map +1 -1
- package/FrameGraph/index.d.ts +1 -1
- package/FrameGraph/index.js +1 -1
- package/FrameGraph/index.js.map +1 -1
- package/Materials/floatingOriginMatrixOverrides.js +19 -0
- package/Materials/floatingOriginMatrixOverrides.js.map +1 -1
- package/Materials/shaderMaterial.d.ts +9 -0
- package/Materials/shaderMaterial.js +35 -0
- package/Materials/shaderMaterial.js.map +1 -1
- package/Particles/EmitterTypes/coneParticleEmitter.d.ts +6 -4
- package/Particles/EmitterTypes/coneParticleEmitter.js +18 -12
- package/Particles/EmitterTypes/coneParticleEmitter.js.map +1 -1
- package/Particles/EmitterTypes/customParticleEmitter.d.ts +5 -3
- package/Particles/EmitterTypes/customParticleEmitter.js +8 -6
- package/Particles/EmitterTypes/customParticleEmitter.js.map +1 -1
- package/Particles/Node/Blocks/Emitters/coneShapeBlock.d.ts +15 -4
- package/Particles/Node/Blocks/Emitters/coneShapeBlock.js +66 -36
- package/Particles/Node/Blocks/Emitters/coneShapeBlock.js.map +1 -1
- package/Particles/Node/Blocks/Emitters/customShapeBlock.d.ts +13 -9
- package/Particles/Node/Blocks/Emitters/customShapeBlock.js +36 -23
- package/Particles/Node/Blocks/Emitters/customShapeBlock.js.map +1 -1
- package/Particles/Node/Blocks/Emitters/sphereShapeBlock.d.ts +6 -0
- package/Particles/Node/Blocks/Emitters/sphereShapeBlock.js +22 -1
- package/Particles/Node/Blocks/Emitters/sphereShapeBlock.js.map +1 -1
- package/Particles/Node/Blocks/Update/basicColorUpdateBlock.d.ts +1 -1
- package/Particles/Node/Blocks/Update/basicColorUpdateBlock.js +1 -1
- package/Particles/Node/Blocks/Update/basicColorUpdateBlock.js.map +1 -1
- package/Particles/Node/Blocks/Update/basicPositionUpdateBlock.d.ts +1 -1
- package/Particles/Node/Blocks/Update/basicPositionUpdateBlock.js +1 -1
- package/Particles/Node/Blocks/Update/basicPositionUpdateBlock.js.map +1 -1
- package/Particles/Node/Blocks/Update/updateSizeBlock.d.ts +35 -0
- package/Particles/Node/Blocks/Update/updateSizeBlock.js +73 -0
- package/Particles/Node/Blocks/Update/updateSizeBlock.js.map +1 -0
- package/Particles/Node/Blocks/index.d.ts +1 -0
- package/Particles/Node/Blocks/index.js +1 -0
- package/Particles/Node/Blocks/index.js.map +1 -1
- package/Particles/Node/Blocks/particleInputBlock.js +1 -0
- package/Particles/Node/Blocks/particleInputBlock.js.map +1 -1
- package/Particles/Node/Blocks/particleRandomBlock.d.ts +5 -2
- package/Particles/Node/Blocks/particleRandomBlock.js +32 -14
- package/Particles/Node/Blocks/particleRandomBlock.js.map +1 -1
- package/Particles/Node/Blocks/systemBlock.d.ts +12 -4
- package/Particles/Node/Blocks/systemBlock.js +16 -12
- package/Particles/Node/Blocks/systemBlock.js.map +1 -1
- package/Particles/Node/Enums/nodeParticleContextualSources.d.ts +3 -1
- package/Particles/Node/Enums/nodeParticleContextualSources.js +2 -0
- package/Particles/Node/Enums/nodeParticleContextualSources.js.map +1 -1
- package/Particles/Node/nodeParticleBuildState.js +2 -0
- package/Particles/Node/nodeParticleBuildState.js.map +1 -1
- package/Particles/Node/nodeParticleSystemSet.helper.d.ts +0 -2
- package/Particles/Node/nodeParticleSystemSet.helper.js +293 -44
- package/Particles/Node/nodeParticleSystemSet.helper.js.map +1 -1
- package/Particles/thinParticleSystem.d.ts +3 -3
- package/Particles/thinParticleSystem.js +4 -4
- package/Particles/thinParticleSystem.js.map +1 -1
- package/package.json +1 -1
- package/scene.d.ts +1 -3
- package/scene.js +8 -7
- package/scene.js.map +1 -1
- package/FrameGraph/Passes/cullPass.js.map +0 -1
package/Culling/ray.core.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ray.core.js","sourceRoot":"","sources":["../../../../dev/core/src/Culling/ray.core.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,mCAAkC;AACpD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,gCAA+B;AACrE,OAAO,EAAE,UAAU,EAAE,8BAA6B;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAMlE,OAAO,EAAE,WAAW,EAAE,qCAAoC;AAC1D,OAAO,EAAE,WAAW,EAAE,kCAAiC;AAIvD,OAAO,EAAE,aAAa,EAAE,4BAA2B;AA+BnD;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAA0B;IACvD,qBAAqB,EAAE,SAAS;CACnC,CAAC;AAEF;;GAEG;AACH,MAAM,OAAO,GAAG;IAKZ;;;;;;OAMG;IACH;IACI,mBAAmB;IACZ,MAAe;IACtB,gBAAgB;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\";\r\nimport { Matrix, TmpVectors, Vector3 } from \"core/Maths/math.vector\";\r\nimport { BuildArray } from \"core/Misc/arrayTools\";\r\nimport { IntersectionInfo } from \"../Collisions/intersectionInfo\";\r\nimport type { BoundingBox } from \"./boundingBox\";\r\nimport type { BoundingSphere } from \"./boundingSphere\";\r\nimport type { DeepImmutable, float, Nullable } from \"core/types\";\r\nimport type { Plane } from \"core/Maths/math.plane\";\r\nimport type { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport { PickingInfo } from \"core/Collisions/pickingInfo\";\r\nimport { EngineStore } from \"core/Engines/engineStore\";\r\nimport type { Scene } from \"core/scene\";\r\nimport type { Camera } from \"core/Cameras/camera\";\r\nimport type { Mesh } from \"core/Meshes/mesh\";\r\nimport { _ImportHelper } from \"core/import.helper\";\r\n\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\n/**\r\n * This class allows user to customize internal picking mechanism\r\n */\r\nexport interface IPickingCustomization {\r\n /**\r\n * Predicate to select faces when a mesh intersection is detected\r\n */\r\n internalPickerForMesh?: (\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 ) => PickingInfo;\r\n}\r\n\r\n/**\r\n * Use this object to customize mesh picking behavior\r\n */\r\nexport const PickingCustomization: IPickingCustomization = {\r\n internalPickerForMesh: undefined,\r\n};\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: Epsilon from math constants)\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 length 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 discriminant = a * c - b * b; // always >= 0\r\n let sN: number,\r\n sD = discriminant; // sc = sN / sD, default sD = D >= 0\r\n let tN: number,\r\n tD = discriminant; // tc = tN / tD, default tD = D >= 0\r\n\r\n // compute the line parameters of the two closest points\r\n if (discriminant < 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.TransformCoordinatesToRef(nearScreenSource, matrix, nearVec3);\r\n Vector3.TransformCoordinatesToRef(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/**\r\n * Creates a ray that can be used to pick in the scene\r\n * @param scene defines the scene to use for the picking\r\n * @param x defines the x coordinate of the origin (on-screen)\r\n * @param y defines the y coordinate of the origin (on-screen)\r\n * @param world defines the world matrix to use if you want to pick in object space (instead of world space)\r\n * @param camera defines the camera to use for the picking\r\n * @param cameraViewSpace defines if picking will be done in view space (false by default)\r\n * @returns a Ray\r\n */\r\nexport function CreatePickingRay(scene: Scene, x: number, y: number, world: Nullable<Matrix>, camera: Nullable<Camera>, cameraViewSpace = false): Ray {\r\n const result = Ray.Zero();\r\n\r\n CreatePickingRayToRef(scene, x, y, world, result, camera, cameraViewSpace);\r\n\r\n return result;\r\n}\r\n\r\n/**\r\n * Creates a ray that can be used to pick in the scene\r\n * @param scene defines the scene to use for the picking\r\n * @param x defines the x coordinate of the origin (on-screen)\r\n * @param y defines the y coordinate of the origin (on-screen)\r\n * @param world defines the world matrix to use if you want to pick in object space (instead of world space)\r\n * @param result defines the ray where to store the picking ray\r\n * @param camera defines the camera to use for the picking\r\n * @param cameraViewSpace defines if picking will be done in view space (false by default)\r\n * @param enableDistantPicking defines if picking should handle large values for mesh position/scaling (false by default)\r\n * @returns the current scene\r\n */\r\nexport function CreatePickingRayToRef(\r\n scene: Scene,\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 = scene.getEngine();\r\n\r\n if (!camera && !(camera = scene.activeCamera!)) {\r\n return scene;\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 scene;\r\n}\r\n\r\n/**\r\n * Creates a ray that can be used to pick in the scene\r\n * @param scene defines the scene to use for the picking\r\n * @param x defines the x coordinate of the origin (on-screen)\r\n * @param y defines the y coordinate of the origin (on-screen)\r\n * @param camera defines the camera to use for the picking\r\n * @returns a Ray\r\n */\r\nexport function CreatePickingRayInCameraSpace(scene: Scene, x: number, y: number, camera?: Camera): Ray {\r\n const result = Ray.Zero();\r\n\r\n CreatePickingRayInCameraSpaceToRef(scene, x, y, result, camera);\r\n\r\n return result;\r\n}\r\n\r\n/**\r\n * Creates a ray that can be used to pick in the scene\r\n * @param scene defines the scene to use for the picking\r\n * @param x defines the x coordinate of the origin (on-screen)\r\n * @param y defines the y coordinate of the origin (on-screen)\r\n * @param result defines the ray where to store the picking ray\r\n * @param camera defines the camera to use for the picking\r\n * @returns the current scene\r\n */\r\nexport function CreatePickingRayInCameraSpaceToRef(scene: Scene, x: number, y: number, result: Ray, camera?: Camera): Scene {\r\n if (!PickingInfo) {\r\n return scene;\r\n }\r\n\r\n const engine = scene.getEngine();\r\n\r\n if (!camera && !(camera = scene.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 scene;\r\n}\r\n\r\nfunction 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) {\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\nfunction InternalPick(\r\n scene: Scene,\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 = !!(scene.activeCameras && scene.activeCameras.length > 1 && scene.cameraToUseForPointers !== scene.activeCamera);\r\n const currentCamera = scene.cameraToUseForPointers || scene.activeCamera;\r\n const picker = PickingCustomization.internalPickerForMesh || InternalPickForMesh;\r\n\r\n for (let meshIndex = 0; meshIndex < scene.meshes.length; meshIndex++) {\r\n const mesh = scene.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 = picker(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 = picker(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 = picker(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\nfunction InternalMultiPick(\r\n scene: Scene,\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 = !!(scene.activeCameras && scene.activeCameras.length > 1 && scene.cameraToUseForPointers !== scene.activeCamera);\r\n const currentCamera = scene.cameraToUseForPointers || scene.activeCamera;\r\n const picker = PickingCustomization.internalPickerForMesh || InternalPickForMesh;\r\n\r\n for (let meshIndex = 0; meshIndex < scene.meshes.length; meshIndex++) {\r\n const mesh = scene.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 = picker(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 = picker(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 = picker(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\n/** Launch a ray to try to pick a mesh in the scene using only bounding information of the main mesh (not using submeshes)\r\n * @param scene defines the scene to use for the picking\r\n * @param x position on screen\r\n * @param y position on screen\r\n * @param predicate Predicate function used to determine eligible meshes. Can be set to null. In this case, a mesh must be enabled, visible and with isPickable set to true. thinInstanceIndex is -1 when the mesh is non-instanced\r\n * @param fastCheck defines if the first intersection will be used (and not the closest)\r\n * @param camera to use for computing the picking ray. Can be set to null. In this case, the scene.activeCamera will be used\r\n * @returns a PickingInfo (Please note that some info will not be set like distance, bv, bu and everything that cannot be capture by only using bounding infos)\r\n */\r\nexport function PickWithBoundingInfo(scene: Scene, 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 = InternalPick(\r\n scene,\r\n (world) => {\r\n if (!scene._tempPickingRay) {\r\n scene._tempPickingRay = Ray.Zero();\r\n }\r\n\r\n CreatePickingRayToRef(scene, x, y, world, scene._tempPickingRay, camera || null);\r\n return scene._tempPickingRay;\r\n },\r\n predicate,\r\n fastCheck,\r\n true\r\n );\r\n if (result) {\r\n result.ray = CreatePickingRay(scene, x, y, Matrix.Identity(), camera || null);\r\n }\r\n return result;\r\n}\r\n\r\n/** Launch a ray to try to pick a mesh in the scene\r\n * @param scene defines the scene to use for the picking\r\n * @param x position on screen\r\n * @param y position on screen\r\n * @param predicate Predicate function used to determine eligible meshes. Can be set to null. In this case, a mesh must be enabled, visible and with isPickable set to true. thinInstanceIndex is -1 when the mesh is non-instanced\r\n * @param fastCheck defines if the first intersection will be used (and not the closest)\r\n * @param camera to use for computing the picking ray. Can be set to null. In this case, the scene.activeCamera will be used\r\n * @param trianglePredicate defines an optional predicate used to select faces when a mesh intersection is detected\r\n * @param _enableDistantPicking defines if picking should handle large values for mesh position/scaling (false by default)\r\n * @returns a PickingInfo\r\n */\r\nexport function Pick(\r\n scene: Scene,\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 = InternalPick(\r\n scene,\r\n (world, enableDistantPicking) => {\r\n if (!scene._tempPickingRay) {\r\n scene._tempPickingRay = Ray.Zero();\r\n }\r\n\r\n CreatePickingRayToRef(scene, x, y, world, scene._tempPickingRay, camera || null, false, enableDistantPicking);\r\n return scene._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 = CreatePickingRay(scene, x, y, Matrix.Identity(), camera || null);\r\n }\r\n return result;\r\n}\r\n\r\n/**\r\n * Use the given ray to pick a mesh in the scene. A mesh triangle can be picked both from its front and back sides,\r\n * irrespective of orientation.\r\n * @param scene defines the scene to use for the picking\r\n * @param ray The ray to use to pick meshes\r\n * @param predicate Predicate function used to determine eligible meshes. Can be set to null. In this case, a mesh must have isPickable set to true. thinInstanceIndex is -1 when the mesh is non-instanced\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 * @returns a PickingInfo\r\n */\r\nexport function PickWithRay(scene: Scene, ray: Ray, predicate?: MeshPredicate, fastCheck?: boolean, trianglePredicate?: TrianglePickingPredicate): Nullable<PickingInfo> {\r\n const result = InternalPick(\r\n scene,\r\n (world) => {\r\n if (!scene._pickWithRayInverseMatrix) {\r\n scene._pickWithRayInverseMatrix = Matrix.Identity();\r\n }\r\n world.invertToRef(scene._pickWithRayInverseMatrix);\r\n\r\n if (!scene._cachedRayForTransform) {\r\n scene._cachedRayForTransform = Ray.Zero();\r\n }\r\n\r\n Ray.TransformToRef(ray, scene._pickWithRayInverseMatrix, scene._cachedRayForTransform);\r\n return scene._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\n/**\r\n * Launch a ray to try to pick a mesh in the scene. A mesh triangle can be picked both from its front and back sides,\r\n * irrespective of orientation.\r\n * @param scene defines the scene to use for the picking\r\n * @param x X position on screen\r\n * @param y Y position on screen\r\n * @param predicate Predicate function used to determine eligible meshes and instances. Can be set to null. In this case, a mesh must be enabled, visible and with isPickable set to true. thinInstanceIndex is -1 when the mesh is non-instanced\r\n * @param camera camera to use for computing the picking ray. Can be set to null. In this case, the scene.activeCamera will be used\r\n * @param trianglePredicate defines an optional predicate used to select faces when a mesh intersection is detected\r\n * @returns an array of PickingInfo\r\n */\r\nexport function MultiPick(scene: Scene, x: number, y: number, predicate?: MeshPredicate, camera?: Camera, trianglePredicate?: TrianglePickingPredicate): Nullable<PickingInfo[]> {\r\n return InternalMultiPick(scene, (world) => CreatePickingRay(scene, x, y, world, camera || null), predicate, trianglePredicate);\r\n}\r\n\r\n/**\r\n * Launch a ray to try to pick a mesh in the scene\r\n * @param scene defines the scene to use for the picking\r\n * @param ray Ray to use\r\n * @param predicate Predicate function used to determine eligible meshes and instances. Can be set to null. In this case, a mesh must be enabled, visible and with isPickable set to true. thinInstanceIndex is -1 when the mesh is non-instanced\r\n * @param trianglePredicate defines an optional predicate used to select faces when a mesh intersection is detected\r\n * @returns an array of PickingInfo\r\n */\r\nexport function MultiPickWithRay(scene: Scene, ray: Ray, predicate?: MeshPredicate, trianglePredicate?: TrianglePickingPredicate): Nullable<PickingInfo[]> {\r\n return InternalMultiPick(\r\n scene,\r\n (world) => {\r\n if (!scene._pickWithRayInverseMatrix) {\r\n scene._pickWithRayInverseMatrix = Matrix.Identity();\r\n }\r\n world.invertToRef(scene._pickWithRayInverseMatrix);\r\n\r\n if (!scene._cachedRayForTransform) {\r\n scene._cachedRayForTransform = Ray.Zero();\r\n }\r\n\r\n Ray.TransformToRef(ray, scene._pickWithRayInverseMatrix, scene._cachedRayForTransform);\r\n return scene._cachedRayForTransform;\r\n },\r\n predicate,\r\n trianglePredicate\r\n );\r\n}\r\n\r\n/**\r\n * Gets a ray in the forward direction from the camera.\r\n * @param camera Defines the camera to use to get the ray from\r\n * @param length Defines the length of the ray to create\r\n * @param transform Defines the transform to apply to the ray, by default the world matrix is used to create a workd space ray\r\n * @param origin Defines the start point of the ray which defaults to the camera position\r\n * @returns the forward ray\r\n */\r\nexport function GetForwardRay(camera: Camera, length = 100, transform?: Matrix, origin?: Vector3): Ray {\r\n return GetForwardRayToRef(camera, new Ray(Vector3.Zero(), Vector3.Zero(), length), length, transform, origin);\r\n}\r\n\r\n/**\r\n * Gets a ray in the forward direction from the camera.\r\n * @param camera Defines the camera to use to get the ray from\r\n * @param refRay the ray to (re)use when setting the values\r\n * @param length Defines the length of the ray to create\r\n * @param transform Defines the transform to apply to the ray, by default the world matrx is used to create a workd space ray\r\n * @param origin Defines the start point of the ray which defaults to the camera position\r\n * @returns the forward ray\r\n */\r\nexport function GetForwardRayToRef(camera: Camera, refRay: Ray, length = 100, transform?: Matrix, origin?: Vector3): Ray {\r\n if (!transform) {\r\n transform = camera.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(camera.position);\r\n }\r\n const forward = TmpVectors.Vector3[2];\r\n forward.set(0, 0, camera._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\r\n/**\r\n * Initialize the minimal interdependecies between the Ray and Scene and Camera\r\n * @param sceneClass defines the scene prototype to use\r\n * @param cameraClass defines the camera prototype to use\r\n */\r\nexport function AddRayExtensions(sceneClass: typeof Scene, cameraClass: typeof Camera): void {\r\n if (cameraClass) {\r\n cameraClass.prototype.getForwardRay = function (length = 100, transform?: Matrix, origin?: Vector3): Ray {\r\n return GetForwardRayToRef(this, new Ray(Vector3.Zero(), Vector3.Zero(), length), length, transform, origin);\r\n };\r\n\r\n cameraClass.prototype.getForwardRayToRef = function (refRay: Ray, length = 100, transform?: Matrix, origin?: Vector3): Ray {\r\n return GetForwardRayToRef(this, refRay, length, transform, origin);\r\n };\r\n }\r\n\r\n if (!sceneClass) {\r\n return;\r\n }\r\n\r\n _ImportHelper._IsPickingAvailable = true;\r\n\r\n sceneClass.prototype.createPickingRay = function (x: number, y: number, world: Nullable<Matrix>, camera: Nullable<Camera>, cameraViewSpace = false): Ray {\r\n return CreatePickingRay(this, x, y, world, camera, cameraViewSpace);\r\n };\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"ray.core.js","sourceRoot":"","sources":["../../../../dev/core/src/Culling/ray.core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AAG,GAAG,EAAE,SAAkB,EAAE,MAAgB;YAChH,OAAO,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;QACvE,CAAC,CAAC;IACN,CAAC;IAED,IAAI,CAAC,UAAU,EAAE,CAAC;QACd,OAAO;IACX,CAAC;IAED,aAAa,CAAC,mBAAmB,GAAG,IAAI,CAAC;IAEzC,UAAU,CAAC,SAAS,CAAC,gBAAgB,GAAG,UAAU,CAAS,EAAE,CAAS,EAAE,KAAuB,EAAE,MAAwB,EAAE,eAAe,GAAG,KAAK;QAC9I,OAAO,gBAAgB,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,eAAe,CAAC,CAAC;IACxE,CAAC,CAAC;AACN,CAAC","sourcesContent":["import { Epsilon } from \"core/Maths/math.constants\";\r\nimport { Matrix, TmpVectors, Vector3 } from \"core/Maths/math.vector\";\r\nimport { BuildArray } from \"core/Misc/arrayTools\";\r\nimport { IntersectionInfo } from \"../Collisions/intersectionInfo\";\r\nimport type { BoundingBox } from \"./boundingBox\";\r\nimport type { BoundingSphere } from \"./boundingSphere\";\r\nimport type { DeepImmutable, float, Nullable } from \"core/types\";\r\nimport type { Plane } from \"core/Maths/math.plane\";\r\nimport type { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport { PickingInfo } from \"core/Collisions/pickingInfo\";\r\nimport { EngineStore } from \"core/Engines/engineStore\";\r\nimport type { Scene } from \"core/scene\";\r\nimport type { Camera } from \"core/Cameras/camera\";\r\nimport type { Mesh } from \"core/Meshes/mesh\";\r\nimport { _ImportHelper } from \"core/import.helper\";\r\n\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\n/**\r\n * This class allows user to customize internal picking mechanism\r\n */\r\nexport interface IPickingCustomization {\r\n /**\r\n * Predicate to select faces when a mesh intersection is detected\r\n */\r\n internalPickerForMesh?: (\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 ) => PickingInfo;\r\n}\r\n\r\n/**\r\n * Use this object to customize mesh picking behavior\r\n */\r\nexport const PickingCustomization: IPickingCustomization = {\r\n internalPickerForMesh: undefined,\r\n};\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: Epsilon from math constants)\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 length 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 || distance < 0) {\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 discriminant = a * c - b * b; // always >= 0\r\n let sN: number,\r\n sD = discriminant; // sc = sN / sD, default sD = D >= 0\r\n let tN: number,\r\n tD = discriminant; // tc = tN / tD, default tD = D >= 0\r\n\r\n // compute the line parameters of the two closest points\r\n if (discriminant < 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.TransformCoordinatesToRef(nearScreenSource, matrix, nearVec3);\r\n Vector3.TransformCoordinatesToRef(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/**\r\n * Creates a ray that can be used to pick in the scene\r\n * @param scene defines the scene to use for the picking\r\n * @param x defines the x coordinate of the origin (on-screen)\r\n * @param y defines the y coordinate of the origin (on-screen)\r\n * @param world defines the world matrix to use if you want to pick in object space (instead of world space)\r\n * @param camera defines the camera to use for the picking\r\n * @param cameraViewSpace defines if picking will be done in view space (false by default)\r\n * @returns a Ray\r\n */\r\nexport function CreatePickingRay(scene: Scene, x: number, y: number, world: Nullable<Matrix>, camera: Nullable<Camera>, cameraViewSpace = false): Ray {\r\n const result = Ray.Zero();\r\n\r\n CreatePickingRayToRef(scene, x, y, world, result, camera, cameraViewSpace);\r\n\r\n return result;\r\n}\r\n\r\n/**\r\n * Creates a ray that can be used to pick in the scene\r\n * @param scene defines the scene to use for the picking\r\n * @param x defines the x coordinate of the origin (on-screen)\r\n * @param y defines the y coordinate of the origin (on-screen)\r\n * @param world defines the world matrix to use if you want to pick in object space (instead of world space)\r\n * @param result defines the ray where to store the picking ray\r\n * @param camera defines the camera to use for the picking\r\n * @param cameraViewSpace defines if picking will be done in view space (false by default)\r\n * @param enableDistantPicking defines if picking should handle large values for mesh position/scaling (false by default)\r\n * @returns the current scene\r\n */\r\nexport function CreatePickingRayToRef(\r\n scene: Scene,\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 = scene.getEngine();\r\n\r\n if (!camera && !(camera = scene.activeCamera!)) {\r\n return scene;\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 scene;\r\n}\r\n\r\n/**\r\n * Creates a ray that can be used to pick in the scene\r\n * @param scene defines the scene to use for the picking\r\n * @param x defines the x coordinate of the origin (on-screen)\r\n * @param y defines the y coordinate of the origin (on-screen)\r\n * @param camera defines the camera to use for the picking\r\n * @returns a Ray\r\n */\r\nexport function CreatePickingRayInCameraSpace(scene: Scene, x: number, y: number, camera?: Camera): Ray {\r\n const result = Ray.Zero();\r\n\r\n CreatePickingRayInCameraSpaceToRef(scene, x, y, result, camera);\r\n\r\n return result;\r\n}\r\n\r\n/**\r\n * Creates a ray that can be used to pick in the scene\r\n * @param scene defines the scene to use for the picking\r\n * @param x defines the x coordinate of the origin (on-screen)\r\n * @param y defines the y coordinate of the origin (on-screen)\r\n * @param result defines the ray where to store the picking ray\r\n * @param camera defines the camera to use for the picking\r\n * @returns the current scene\r\n */\r\nexport function CreatePickingRayInCameraSpaceToRef(scene: Scene, x: number, y: number, result: Ray, camera?: Camera): Scene {\r\n if (!PickingInfo) {\r\n return scene;\r\n }\r\n\r\n const engine = scene.getEngine();\r\n\r\n if (!camera && !(camera = scene.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 scene;\r\n}\r\n\r\nfunction 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) {\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\nfunction InternalPick(\r\n scene: Scene,\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 = !!(scene.activeCameras && scene.activeCameras.length > 1 && scene.cameraToUseForPointers !== scene.activeCamera);\r\n const currentCamera = scene.cameraToUseForPointers || scene.activeCamera;\r\n const picker = PickingCustomization.internalPickerForMesh || InternalPickForMesh;\r\n\r\n for (let meshIndex = 0; meshIndex < scene.meshes.length; meshIndex++) {\r\n const mesh = scene.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 = picker(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 = picker(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 = picker(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\nfunction InternalMultiPick(\r\n scene: Scene,\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 = !!(scene.activeCameras && scene.activeCameras.length > 1 && scene.cameraToUseForPointers !== scene.activeCamera);\r\n const currentCamera = scene.cameraToUseForPointers || scene.activeCamera;\r\n const picker = PickingCustomization.internalPickerForMesh || InternalPickForMesh;\r\n\r\n for (let meshIndex = 0; meshIndex < scene.meshes.length; meshIndex++) {\r\n const mesh = scene.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 = picker(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 = picker(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 = picker(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\n/** Launch a ray to try to pick a mesh in the scene using only bounding information of the main mesh (not using submeshes)\r\n * @param scene defines the scene to use for the picking\r\n * @param x position on screen\r\n * @param y position on screen\r\n * @param predicate Predicate function used to determine eligible meshes. Can be set to null. In this case, a mesh must be enabled, visible and with isPickable set to true. thinInstanceIndex is -1 when the mesh is non-instanced\r\n * @param fastCheck defines if the first intersection will be used (and not the closest)\r\n * @param camera to use for computing the picking ray. Can be set to null. In this case, the scene.activeCamera will be used\r\n * @returns a PickingInfo (Please note that some info will not be set like distance, bv, bu and everything that cannot be capture by only using bounding infos)\r\n */\r\nexport function PickWithBoundingInfo(scene: Scene, 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 = InternalPick(\r\n scene,\r\n (world) => {\r\n if (!scene._tempPickingRay) {\r\n scene._tempPickingRay = Ray.Zero();\r\n }\r\n\r\n CreatePickingRayToRef(scene, x, y, world, scene._tempPickingRay, camera || null);\r\n return scene._tempPickingRay;\r\n },\r\n predicate,\r\n fastCheck,\r\n true\r\n );\r\n if (result) {\r\n result.ray = CreatePickingRay(scene, x, y, Matrix.Identity(), camera || null);\r\n }\r\n return result;\r\n}\r\n\r\n/** Launch a ray to try to pick a mesh in the scene\r\n * @param scene defines the scene to use for the picking\r\n * @param x position on screen\r\n * @param y position on screen\r\n * @param predicate Predicate function used to determine eligible meshes. Can be set to null. In this case, a mesh must be enabled, visible and with isPickable set to true. thinInstanceIndex is -1 when the mesh is non-instanced\r\n * @param fastCheck defines if the first intersection will be used (and not the closest)\r\n * @param camera to use for computing the picking ray. Can be set to null. In this case, the scene.activeCamera will be used\r\n * @param trianglePredicate defines an optional predicate used to select faces when a mesh intersection is detected\r\n * @param _enableDistantPicking defines if picking should handle large values for mesh position/scaling (false by default)\r\n * @returns a PickingInfo\r\n */\r\nexport function Pick(\r\n scene: Scene,\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 = InternalPick(\r\n scene,\r\n (world, enableDistantPicking) => {\r\n if (!scene._tempPickingRay) {\r\n scene._tempPickingRay = Ray.Zero();\r\n }\r\n\r\n CreatePickingRayToRef(scene, x, y, world, scene._tempPickingRay, camera || null, false, enableDistantPicking);\r\n return scene._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 = CreatePickingRay(scene, x, y, Matrix.Identity(), camera || null);\r\n }\r\n return result;\r\n}\r\n\r\n/**\r\n * Use the given ray to pick a mesh in the scene. A mesh triangle can be picked both from its front and back sides,\r\n * irrespective of orientation.\r\n * @param scene defines the scene to use for the picking\r\n * @param ray The ray to use to pick meshes\r\n * @param predicate Predicate function used to determine eligible meshes. Can be set to null. In this case, a mesh must have isPickable set to true. thinInstanceIndex is -1 when the mesh is non-instanced\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 * @returns a PickingInfo\r\n */\r\nexport function PickWithRay(scene: Scene, ray: Ray, predicate?: MeshPredicate, fastCheck?: boolean, trianglePredicate?: TrianglePickingPredicate): Nullable<PickingInfo> {\r\n const result = InternalPick(\r\n scene,\r\n (world) => {\r\n if (!scene._pickWithRayInverseMatrix) {\r\n scene._pickWithRayInverseMatrix = Matrix.Identity();\r\n }\r\n world.invertToRef(scene._pickWithRayInverseMatrix);\r\n\r\n if (!scene._cachedRayForTransform) {\r\n scene._cachedRayForTransform = Ray.Zero();\r\n }\r\n\r\n Ray.TransformToRef(ray, scene._pickWithRayInverseMatrix, scene._cachedRayForTransform);\r\n return scene._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\n/**\r\n * Launch a ray to try to pick a mesh in the scene. A mesh triangle can be picked both from its front and back sides,\r\n * irrespective of orientation.\r\n * @param scene defines the scene to use for the picking\r\n * @param x X position on screen\r\n * @param y Y position on screen\r\n * @param predicate Predicate function used to determine eligible meshes and instances. Can be set to null. In this case, a mesh must be enabled, visible and with isPickable set to true. thinInstanceIndex is -1 when the mesh is non-instanced\r\n * @param camera camera to use for computing the picking ray. Can be set to null. In this case, the scene.activeCamera will be used\r\n * @param trianglePredicate defines an optional predicate used to select faces when a mesh intersection is detected\r\n * @returns an array of PickingInfo\r\n */\r\nexport function MultiPick(scene: Scene, x: number, y: number, predicate?: MeshPredicate, camera?: Camera, trianglePredicate?: TrianglePickingPredicate): Nullable<PickingInfo[]> {\r\n return InternalMultiPick(scene, (world) => CreatePickingRay(scene, x, y, world, camera || null), predicate, trianglePredicate);\r\n}\r\n\r\n/**\r\n * Launch a ray to try to pick a mesh in the scene\r\n * @param scene defines the scene to use for the picking\r\n * @param ray Ray to use\r\n * @param predicate Predicate function used to determine eligible meshes and instances. Can be set to null. In this case, a mesh must be enabled, visible and with isPickable set to true. thinInstanceIndex is -1 when the mesh is non-instanced\r\n * @param trianglePredicate defines an optional predicate used to select faces when a mesh intersection is detected\r\n * @returns an array of PickingInfo\r\n */\r\nexport function MultiPickWithRay(scene: Scene, ray: Ray, predicate?: MeshPredicate, trianglePredicate?: TrianglePickingPredicate): Nullable<PickingInfo[]> {\r\n return InternalMultiPick(\r\n scene,\r\n (world) => {\r\n if (!scene._pickWithRayInverseMatrix) {\r\n scene._pickWithRayInverseMatrix = Matrix.Identity();\r\n }\r\n world.invertToRef(scene._pickWithRayInverseMatrix);\r\n\r\n if (!scene._cachedRayForTransform) {\r\n scene._cachedRayForTransform = Ray.Zero();\r\n }\r\n\r\n Ray.TransformToRef(ray, scene._pickWithRayInverseMatrix, scene._cachedRayForTransform);\r\n return scene._cachedRayForTransform;\r\n },\r\n predicate,\r\n trianglePredicate\r\n );\r\n}\r\n\r\n/**\r\n * Gets a ray in the forward direction from the camera.\r\n * @param camera Defines the camera to use to get the ray from\r\n * @param length Defines the length of the ray to create\r\n * @param transform Defines the transform to apply to the ray, by default the world matrix is used to create a workd space ray\r\n * @param origin Defines the start point of the ray which defaults to the camera position\r\n * @returns the forward ray\r\n */\r\nexport function GetForwardRay(camera: Camera, length = 100, transform?: Matrix, origin?: Vector3): Ray {\r\n return GetForwardRayToRef(camera, new Ray(Vector3.Zero(), Vector3.Zero(), length), length, transform, origin);\r\n}\r\n\r\n/**\r\n * Gets a ray in the forward direction from the camera.\r\n * @param camera Defines the camera to use to get the ray from\r\n * @param refRay the ray to (re)use when setting the values\r\n * @param length Defines the length of the ray to create\r\n * @param transform Defines the transform to apply to the ray, by default the world matrx is used to create a workd space ray\r\n * @param origin Defines the start point of the ray which defaults to the camera position\r\n * @returns the forward ray\r\n */\r\nexport function GetForwardRayToRef(camera: Camera, refRay: Ray, length = 100, transform?: Matrix, origin?: Vector3): Ray {\r\n if (!transform) {\r\n transform = camera.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(camera.position);\r\n }\r\n const forward = TmpVectors.Vector3[2];\r\n forward.set(0, 0, camera._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\r\n/**\r\n * Initialize the minimal interdependecies between the Ray and Scene and Camera\r\n * @param sceneClass defines the scene prototype to use\r\n * @param cameraClass defines the camera prototype to use\r\n */\r\nexport function AddRayExtensions(sceneClass: typeof Scene, cameraClass: typeof Camera): void {\r\n if (cameraClass) {\r\n cameraClass.prototype.getForwardRay = function (length = 100, transform?: Matrix, origin?: Vector3): Ray {\r\n return GetForwardRayToRef(this, new Ray(Vector3.Zero(), Vector3.Zero(), length), length, transform, origin);\r\n };\r\n\r\n cameraClass.prototype.getForwardRayToRef = function (refRay: Ray, length = 100, transform?: Matrix, origin?: Vector3): Ray {\r\n return GetForwardRayToRef(this, refRay, length, transform, origin);\r\n };\r\n }\r\n\r\n if (!sceneClass) {\r\n return;\r\n }\r\n\r\n _ImportHelper._IsPickingAvailable = true;\r\n\r\n sceneClass.prototype.createPickingRay = function (x: number, y: number, world: Nullable<Matrix>, camera: Nullable<Camera>, cameraViewSpace = false): Ray {\r\n return CreatePickingRay(this, x, y, world, camera, cameraViewSpace);\r\n };\r\n}\r\n"]}
|
|
@@ -16,20 +16,22 @@ export declare enum PropertyTypeForEdition {
|
|
|
16
16
|
Vector3 = 4,
|
|
17
17
|
/** property is a list of values */
|
|
18
18
|
List = 5,
|
|
19
|
+
/** property is a Color3 */
|
|
20
|
+
Color3 = 6,
|
|
19
21
|
/** property is a Color4 */
|
|
20
|
-
Color4 =
|
|
22
|
+
Color4 = 7,
|
|
21
23
|
/** property (int) should be edited as a combo box with a list of sampling modes */
|
|
22
|
-
SamplingMode =
|
|
24
|
+
SamplingMode = 8,
|
|
23
25
|
/** property (int) should be edited as a combo box with a list of texture formats */
|
|
24
|
-
TextureFormat =
|
|
26
|
+
TextureFormat = 9,
|
|
25
27
|
/** property (int) should be edited as a combo box with a list of texture types */
|
|
26
|
-
TextureType =
|
|
28
|
+
TextureType = 10,
|
|
27
29
|
/** property is a string */
|
|
28
|
-
String =
|
|
30
|
+
String = 11,
|
|
29
31
|
/** property is a matrix */
|
|
30
|
-
Matrix =
|
|
32
|
+
Matrix = 12,
|
|
31
33
|
/** property is a viewport */
|
|
32
|
-
Viewport =
|
|
34
|
+
Viewport = 13
|
|
33
35
|
}
|
|
34
36
|
/**
|
|
35
37
|
* Interface that defines an option in a variable of type list
|
|
@@ -15,20 +15,22 @@ export var PropertyTypeForEdition;
|
|
|
15
15
|
PropertyTypeForEdition[PropertyTypeForEdition["Vector3"] = 4] = "Vector3";
|
|
16
16
|
/** property is a list of values */
|
|
17
17
|
PropertyTypeForEdition[PropertyTypeForEdition["List"] = 5] = "List";
|
|
18
|
+
/** property is a Color3 */
|
|
19
|
+
PropertyTypeForEdition[PropertyTypeForEdition["Color3"] = 6] = "Color3";
|
|
18
20
|
/** property is a Color4 */
|
|
19
|
-
PropertyTypeForEdition[PropertyTypeForEdition["Color4"] =
|
|
21
|
+
PropertyTypeForEdition[PropertyTypeForEdition["Color4"] = 7] = "Color4";
|
|
20
22
|
/** property (int) should be edited as a combo box with a list of sampling modes */
|
|
21
|
-
PropertyTypeForEdition[PropertyTypeForEdition["SamplingMode"] =
|
|
23
|
+
PropertyTypeForEdition[PropertyTypeForEdition["SamplingMode"] = 8] = "SamplingMode";
|
|
22
24
|
/** property (int) should be edited as a combo box with a list of texture formats */
|
|
23
|
-
PropertyTypeForEdition[PropertyTypeForEdition["TextureFormat"] =
|
|
25
|
+
PropertyTypeForEdition[PropertyTypeForEdition["TextureFormat"] = 9] = "TextureFormat";
|
|
24
26
|
/** property (int) should be edited as a combo box with a list of texture types */
|
|
25
|
-
PropertyTypeForEdition[PropertyTypeForEdition["TextureType"] =
|
|
27
|
+
PropertyTypeForEdition[PropertyTypeForEdition["TextureType"] = 10] = "TextureType";
|
|
26
28
|
/** property is a string */
|
|
27
|
-
PropertyTypeForEdition[PropertyTypeForEdition["String"] =
|
|
29
|
+
PropertyTypeForEdition[PropertyTypeForEdition["String"] = 11] = "String";
|
|
28
30
|
/** property is a matrix */
|
|
29
|
-
PropertyTypeForEdition[PropertyTypeForEdition["Matrix"] =
|
|
31
|
+
PropertyTypeForEdition[PropertyTypeForEdition["Matrix"] = 12] = "Matrix";
|
|
30
32
|
/** property is a viewport */
|
|
31
|
-
PropertyTypeForEdition[PropertyTypeForEdition["Viewport"] =
|
|
33
|
+
PropertyTypeForEdition[PropertyTypeForEdition["Viewport"] = 13] = "Viewport";
|
|
32
34
|
})(PropertyTypeForEdition || (PropertyTypeForEdition = {}));
|
|
33
35
|
/**
|
|
34
36
|
* Decorator that flags a property in a node block as being editable
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodeDecorator.js","sourceRoot":"","sources":["../../../../dev/core/src/Decorators/nodeDecorator.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,MAAM,CAAN,IAAkB,
|
|
1
|
+
{"version":3,"file":"nodeDecorator.js","sourceRoot":"","sources":["../../../../dev/core/src/Decorators/nodeDecorator.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,MAAM,CAAN,IAAkB,sBA6BjB;AA7BD,WAAkB,sBAAsB;IACpC,4BAA4B;IAC5B,yEAAO,CAAA;IACP,0BAA0B;IAC1B,qEAAK,CAAA;IACL,wBAAwB;IACxB,iEAAG,CAAA;IACH,4BAA4B;IAC5B,yEAAO,CAAA;IACP,4BAA4B;IAC5B,yEAAO,CAAA;IACP,mCAAmC;IACnC,mEAAI,CAAA;IACJ,2BAA2B;IAC3B,uEAAM,CAAA;IACN,2BAA2B;IAC3B,uEAAM,CAAA;IACN,mFAAmF;IACnF,mFAAY,CAAA;IACZ,oFAAoF;IACpF,qFAAa,CAAA;IACb,kFAAkF;IAClF,kFAAW,CAAA;IACX,2BAA2B;IAC3B,wEAAM,CAAA;IACN,2BAA2B;IAC3B,wEAAM,CAAA;IACN,6BAA6B;IAC7B,4EAAQ,CAAA;AACZ,CAAC,EA7BiB,sBAAsB,KAAtB,sBAAsB,QA6BvC;AA2DD;;;;;;;GAOG;AACH,gEAAgE;AAChE,MAAM,UAAU,sBAAsB,CAClC,WAAmB,EACnB,qDAAqE,EACrE,YAAoB,YAAY,EAChC,OAAiC;IAEjC,OAAO,CAAC,MAAW,EAAE,WAAmB,EAAE,EAAE;QACxC,IAAI,SAAS,GAAqC,MAAM,CAAC,UAAU,CAAC;QACpE,IAAI,CAAC,SAAS,EAAE,CAAC;YACb,SAAS,GAAG,EAAE,CAAC;YACf,MAAM,CAAC,UAAU,GAAG,SAAS,CAAC;QAClC,CAAC;QACD,SAAS,CAAC,IAAI,CAAC;YACX,YAAY,EAAE,WAAW;YACzB,WAAW,EAAE,WAAW;YACxB,IAAI,EAAE,YAAY;YAClB,SAAS,EAAE,SAAS;YACpB,OAAO,EAAE,OAAO,IAAI,EAAE;YACtB,SAAS,EAAE,MAAM,CAAC,YAAY,EAAE;SACnC,CAAC,CAAC;IACP,CAAC,CAAC;AACN,CAAC","sourcesContent":["import type { Nullable } from \"../types\";\r\nimport type { Scene } from \"../scene\";\r\n\r\n/**\r\n * Enum defining the type of properties that can be edited in the property pages in the node editor\r\n */\r\nexport const enum PropertyTypeForEdition {\r\n /** property is a boolean */\r\n Boolean,\r\n /** property is a float */\r\n Float,\r\n /** property is a int */\r\n Int,\r\n /** property is a Vector2 */\r\n Vector2,\r\n /** property is a Vector3 */\r\n Vector3,\r\n /** property is a list of values */\r\n List,\r\n /** property is a Color3 */\r\n Color3,\r\n /** property is a Color4 */\r\n Color4,\r\n /** property (int) should be edited as a combo box with a list of sampling modes */\r\n SamplingMode,\r\n /** property (int) should be edited as a combo box with a list of texture formats */\r\n TextureFormat,\r\n /** property (int) should be edited as a combo box with a list of texture types */\r\n TextureType,\r\n /** property is a string */\r\n String,\r\n /** property is a matrix */\r\n Matrix,\r\n /** property is a viewport */\r\n Viewport,\r\n}\r\n\r\n/**\r\n * Interface that defines an option in a variable of type list\r\n */\r\nexport interface IEditablePropertyListOption {\r\n /** label of the option */\r\n label: string;\r\n /** value of the option */\r\n value: number;\r\n}\r\n\r\n/**\r\n * Interface that defines the options available for an editable property\r\n */\r\nexport interface IEditablePropertyOption {\r\n /**\r\n * Define if the property is displayed inside the source block or in a separate property tab\r\n */\r\n embedded?: boolean;\r\n /** min value */\r\n min?: number;\r\n /** max value */\r\n max?: number;\r\n /** notifiers: indicates which actions to take when the property is changed */\r\n notifiers?: {\r\n /** the entity should be rebuilt */\r\n rebuild?: boolean;\r\n /** the preview should be updated */\r\n update?: boolean;\r\n /** the onPreviewCommandActivated observer of the preview manager should be triggered */\r\n activatePreviewCommand?: boolean;\r\n /** a callback to trigger */\r\n callback?: (scene: Nullable<Scene>, block: any) => boolean | undefined | void;\r\n /** a callback to validate the property. Returns true if the property is ok, else false. If false, the rebuild/update/callback events won't be called */\r\n onValidation?: (block: any, propertyName: string) => boolean;\r\n };\r\n /** list of the options for a variable of type list */\r\n options?: IEditablePropertyListOption[];\r\n}\r\n\r\n/**\r\n * Interface that describes an editable property\r\n */\r\nexport interface IPropertyDescriptionForEdition {\r\n /** name of the property */\r\n propertyName: string;\r\n /** display name of the property */\r\n displayName: string;\r\n /** type of the property */\r\n type: PropertyTypeForEdition;\r\n /** group of the property - all properties with the same group value will be displayed in a specific section */\r\n groupName: string;\r\n /** options for the property */\r\n options: IEditablePropertyOption;\r\n /** name of the class that contains the property */\r\n className: string;\r\n}\r\n\r\n/**\r\n * Decorator that flags a property in a node block as being editable\r\n * @param displayName the display name of the property\r\n * @param propertyType the type of the property\r\n * @param groupName the group name of the property\r\n * @param options the options of the property\r\n * @returns the decorator\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport function editableInPropertyPage(\r\n displayName: string,\r\n propertyType: PropertyTypeForEdition = PropertyTypeForEdition.Boolean,\r\n groupName: string = \"PROPERTIES\",\r\n options?: IEditablePropertyOption\r\n) {\r\n return (target: any, propertyKey: string) => {\r\n let propStore: IPropertyDescriptionForEdition[] = target._propStore;\r\n if (!propStore) {\r\n propStore = [];\r\n target._propStore = propStore;\r\n }\r\n propStore.push({\r\n propertyName: propertyKey,\r\n displayName: displayName,\r\n type: propertyType,\r\n groupName: groupName,\r\n options: options ?? {},\r\n className: target.getClassName(),\r\n });\r\n };\r\n}\r\n"]}
|
|
@@ -896,7 +896,7 @@ export class WebGPUTextureManager {
|
|
|
896
896
|
buffer: buffer,
|
|
897
897
|
offset: 0,
|
|
898
898
|
bytesPerRow,
|
|
899
|
-
rowsPerImage: height,
|
|
899
|
+
rowsPerImage: textureExtent.height / blockInformation.height,
|
|
900
900
|
}, textureCopyView, textureExtent);
|
|
901
901
|
this._device.queue.submit([commandEncoder.finish()]);
|
|
902
902
|
this._bufferManager.releaseBuffer(buffer);
|
|
@@ -905,7 +905,7 @@ export class WebGPUTextureManager {
|
|
|
905
905
|
this._device.queue.writeTexture(textureCopyView, imageBitmap, {
|
|
906
906
|
offset: 0,
|
|
907
907
|
bytesPerRow,
|
|
908
|
-
rowsPerImage: height,
|
|
908
|
+
rowsPerImage: textureExtent.height / blockInformation.height,
|
|
909
909
|
}, textureExtent);
|
|
910
910
|
}
|
|
911
911
|
if (invertY || premultiplyAlpha) {
|